salt-common/sls/collectd/service.sls

128 lines
3.1 KiB
Plaintext
Raw Normal View History

{% set collectd = salt.pillar.get('collectd', {}) -%}
{% set p_network = collectd.get('network', False) -%}
{% set extra_plugins = collectd.get('extra-plugins', []) %}
{% set extra_plugin_config = collectd.get('extra-plugin-config', {}) %}
collectd:
service.running:
- enable: True
- watch:
- file: /etc/conf.d/collectd
- file: /etc/collectd/collectd.conf
- file: /etc/collectd/types.db
- file: /etc/collectd/conf.d/
2020-02-19 12:44:26 +00:00
- file: /etc/init.d/collectd
/etc/init.d/collectd:
file.managed:
- source: salt://collectd/files/collectd.init
- mode: 755
- user: root
- group: root
/etc/conf.d/collectd:
file.managed:
- source: salt://collectd/files/collectd.confd
- mode: 644
- user: root
- group: root
/etc/collectd:
file.directory:
- create: True
- mode: 755
- user: root
- group: collectd
/etc/collectd/collectd.conf:
file.managed:
- source: salt://collectd/files/collectd.conf.tpl
- template: jinja
- defaults:
virtual_machine: {{ salt['grains.get']('virtual', False) }}
nfs_server: {{ salt['grains.get']('nfs_server', False) }}
- mode: 640
- user: root
- group: collectd
- require:
- file: /etc/collectd
- file: /etc/collectd/types.db
/etc/collectd/types.db:
file.managed:
- source: salt://collectd/files/types.db
- mode: 644
- user: root
- group: collectd
- require:
- file: /etc/collectd
{% if p_network.get('users', False) %}
/etc/collectd/collectd.passwd:
file.managed:
- source: salt://collectd/files/collectd.passwd
- template: jinja
- mode: 640
- user: root
- group: collectd
- require:
- file: /etc/collectd
- watch_in:
- service: collectd
{% endif %}
/etc/collectd/conf.d/:
file.directory:
- create: True
- mode: 755
- user: root
- group: collectd
/etc/collectd/conf.d/10-jmx.conf:
2019-04-01 11:14:29 +00:00
{% if extra_plugin_config.get('jmx', False) %}
file.managed:
- source: salt://collectd/files/conf.d/10-jmx.conf
- mode: 640
- user: root
- group: collectd
2019-04-01 11:14:29 +00:00
{% else %}
file.absent:
{% endif %}
- require:
- file: /etc/collectd/conf.d/
- watch_in:
- service: collectd
2019-08-08 13:50:28 +00:00
2019-08-08 17:53:37 +00:00
/etc/collectd/conf.d/20-python-consul-health.conf:
2019-08-08 15:45:09 +00:00
{% if extra_plugin_config.get('consul_health_plugin', False) %}
2019-08-08 13:50:28 +00:00
file.managed:
2019-08-08 17:53:37 +00:00
- source: salt://collectd/files/conf.d/20-python-consul-health.conf
2019-08-08 13:50:28 +00:00
- mode: 640
- user: root
- group: collectd
{% else %}
file.absent:
{% endif %}
- require:
- file: /etc/collectd/conf.d/
- watch_in:
- service: collectd
2019-08-08 15:45:09 +00:00
{% if extra_plugin_config.get('consul_health_plugin', False) %}
2019-08-08 13:50:28 +00:00
/usr/share/collectd/consul-health/consul_health_plugin.py:
file.managed:
- source: salt://collectd/files/consul_health_plugin.py
- mode: 640
- user: root
- group: collectd
- require:
- file: /usr/share/collectd/consul-health
2019-08-08 15:45:09 +00:00
- require_in:
2019-08-08 17:53:37 +00:00
- file: /etc/collectd/conf.d/20-python-consul-health.conf
2019-08-08 13:50:28 +00:00
/usr/share/collectd/consul-health:
file.directory:
- create: True
- mode: 755
- user: root
- group: collectd
{% endif %}