mirror of
https://github.com/valitydev/salt-common.git
synced 2024-11-06 10:25:23 +00:00
120 lines
2.9 KiB
Plaintext
120 lines
2.9 KiB
Plaintext
{% 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/
|
|
|
|
/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:
|
|
{% if extra_plugin_config.get('jmx', False) %}
|
|
file.managed:
|
|
- source: salt://collectd/files/conf.d/10-jmx.conf
|
|
- mode: 640
|
|
- user: root
|
|
- group: collectd
|
|
{% else %}
|
|
file.absent:
|
|
{% endif %}
|
|
- require:
|
|
- file: /etc/collectd/conf.d/
|
|
- watch_in:
|
|
- service: collectd
|
|
|
|
/etc/collectd/conf.d/20-python-consul-health.conf:
|
|
{% if extra_plugin_config.get('consul_health_plugin', False) %}
|
|
file.managed:
|
|
- source: salt://collectd/files/conf.d/20-python-consul-health.conf
|
|
- mode: 640
|
|
- user: root
|
|
- group: collectd
|
|
{% else %}
|
|
file.absent:
|
|
{% endif %}
|
|
- require:
|
|
- file: /etc/collectd/conf.d/
|
|
- watch_in:
|
|
- service: collectd
|
|
|
|
{% if extra_plugin_config.get('consul_health_plugin', False) %}
|
|
/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
|
|
- require_in:
|
|
- file: /etc/collectd/conf.d/20-python-consul-health.conf
|
|
/usr/share/collectd/consul-health:
|
|
file.directory:
|
|
- create: True
|
|
- mode: 755
|
|
- user: root
|
|
- group: collectd
|
|
{% endif %}
|