Remote collecting
diff --git a/collectd/client.sls b/collectd/client.sls
index a5b2128..f092dcc 100644
--- a/collectd/client.sls
+++ b/collectd/client.sls
@@ -94,7 +94,7 @@
{%- for plugin_name, plugin in service_grains.collectd.local_plugin.iteritems() %}
-{%- if (plugin.get('execution', 'local') == 'local' or client.remote_collector) and plugin.get('plugin', 'native') not in ['python'] %}
+{%- plugin.get('plugin', 'native') not in ['python'] %}
{{ client.config_dir }}/{{ plugin_name }}.conf:
file.managed:
@@ -119,6 +119,37 @@
{%- endfor %}
+{%- if client.remote_collector %}
+
+{%- for plugin_name, plugin in service_grains.collectd.local_plugin.iteritems() %}
+
+{%- plugin.get('plugin', 'native') not in ['python'] %}
+
+{{ client.config_dir }}/{{ plugin_name }}.conf:
+ file.managed:
+ {%- if plugin.template is defined %}
+ - source: salt://{{ plugin.template }}
+ - template: jinja
+ - defaults:
+ plugin: {{ plugin|yaml }}
+ {%- else %}
+ - contents: "<LoadPlugin {{ plugin.plugin }}>\n Globals false\n</LoadPlugin>\n"
+ {%- endif %}
+ - user: root
+ - mode: 660
+ - require:
+ - file: collectd_client_conf_dir
+ - require_in:
+ - file: collectd_client_conf_dir_clean
+ - watch_in:
+ - service: collectd_service
+
+{%- endif %}
+
+{%- endfor %}
+
+{%- endif %}
+
{%- if client.file_logging %}
/etc/collectd/conf.d/00_collectd_logfile.conf:
diff --git a/collectd/files/collectd.conf b/collectd/files/collectd.conf
index fc48a19..6e2394e 100644
--- a/collectd/files/collectd.conf
+++ b/collectd/files/collectd.conf
@@ -882,10 +882,16 @@
Include "/etc/collectd/conf.d/00_collectd_logfile.conf"
{%- endif %}
{%- for plugin_name, plugin in service_grains.collectd.local_plugin.iteritems() %}
-{%- if (plugin.get('execution', 'local') == 'local' or client.remote_collector) and plugin.get('plugin', 'native') not in ['python'] %}
+{%- if plugin.get('plugin', 'native') not in ['python'] %}
Include "{{ client.config_dir }}/{{ plugin_name }}.conf"
{%- endif %}
{%- endfor %}
+{%- if client.remote_collector %}
+{%- for plugin_name, plugin in service_grains.collectd.remote_plugin.iteritems() %}
+{%- if plugin.get('plugin', 'native') not in ['python'] %}
+{%- endif %}
+{%- endfor %}
+{%- endif %}
Include "{{ client.config_dir }}/collectd_python.conf"
{%- for backend_name, backend in client.backend.iteritems() %}
Include "{{ client.config_dir }}/collectd_writer_{{ backend_name }}.conf"
diff --git a/collectd/files/collectd_python.conf b/collectd/files/collectd_python.conf
index 6142345..9111065 100644
--- a/collectd/files/collectd_python.conf
+++ b/collectd/files/collectd_python.conf
@@ -7,10 +7,18 @@
LogTraces false
Interactive false
- {%- for plugin_name, plugin in plugin.iteritems() %}
- {%- if (plugin.get('execution', 'local') == 'local' or client.remote_collector) and plugin.get('plugin', 'native') == 'python' %}
+ {%- for plugin_name, plugin in local_plugin.iteritems() %}
+ {%- if plugin.get('plugin', 'native') == 'python' %}
{%- include plugin.template %}
{%- endif %}
{%- endfor %}
+ {%- if client.remote_collector %}
+ {%- for plugin_name, plugin in remote_plugin.iteritems() %}
+ {%- if plugin.get('plugin', 'native') == 'python' %}
+ {%- include plugin.template %}
+ {%- endif %}
+ {%- endfor %}
+ {%- endif %}
+
</Plugin>