Merge pull request #6 from tcpcloud/stacklight
Stacklight
diff --git a/keepalived/files/collectd_vrrp.conf b/keepalived/files/collectd_vrrp.conf
new file mode 100644
index 0000000..c75d208
--- /dev/null
+++ b/keepalived/files/collectd_vrrp.conf
@@ -0,0 +1,12 @@
+Import "collectd_vrrp"
+
+<Module "collectd_vrrp">
+{%- for item in plugin.ip_addresses %}
+ <IPAddress>
+ address "{{ item.address }}"
+{%- if item.label is defined %}
+ label "{{ item.label }}"
+{%- endif %}
+ </IPAddress>
+{%- endfor %}
+</Module>
diff --git a/keepalived/map.jinja b/keepalived/map.jinja
index 940546b..94dc500 100644
--- a/keepalived/map.jinja
+++ b/keepalived/map.jinja
@@ -1,6 +1,6 @@
{% set cluster = salt['grains.filter_by']({
'Debian': {
- 'pkgs': ['keepalived'],
+ 'pkgs': ['keepalived', 'python-pyroute2'],
'service': 'keepalived',
'config': '/etc/keepalived/keepalived.conf',
'instance': {}
diff --git a/keepalived/meta/collectd.yml b/keepalived/meta/collectd.yml
new file mode 100644
index 0000000..d458b41
--- /dev/null
+++ b/keepalived/meta/collectd.yml
@@ -0,0 +1,24 @@
+{%- if pillar.keepalived.cluster is defined %}
+{%- from "keepalived/map.jinja" import cluster with context %}
+{%- set vrrp_addresses = [] %}
+{%- for instance_name, instance in cluster.instance.iteritems() %}
+ {%- if instance.addresses is defined %}
+ {%- for address in instance.addresses %}
+ {%- do vrrp_addresses.append({'label': instance_name, 'address': address}) %}
+ {%- endfor %}
+ {%- else %}
+ {%- do vrrp_addresses.append({'label': instance_name, 'address': instance.address}) %}
+ {%- endif %}
+{%- endfor %}
+{%- if cluster.get('enabled', False) and vrrp_addresses|length > 0 %}
+local_plugin:
+ collectd_vrrp:
+ plugin: python
+ template: keepalived/files/collectd_vrrp.conf
+ ip_addresses:
+{%- for item in vrrp_addresses %}
+ - address: {{ item.address }}
+ label: {{ item.label }}
+{%- endfor %}
+{%- endif %}
+{%- endif %}
diff --git a/metadata/service/support.yml b/metadata/service/support.yml
index 344ad80..6a97241 100644
--- a/metadata/service/support.yml
+++ b/metadata/service/support.yml
@@ -2,7 +2,7 @@
keepalived:
_support:
collectd:
- enabled: false
+ enabled: true
heka:
enabled: false
sensu: