network/salt/collectd/collectd.conf

65 lines
1.5 KiB
Plaintext

Hostname "{{ salt['grains.get']('id') }}"
FQDNLookup false
Interval 10
LoadPlugin logfile
<Plugin logfile>
LogLevel info
File STDOUT
</Plugin>
{%- for plugin, conf in pillar['collectd'].items() %}
{%- if plugin == 'network' and conf == 'client' %}
LoadPlugin network
<Plugin network>
Server "{{ pillar['hosts-inet6']['dn42']['serv']['stats'] }}" "25826"
</Plugin>
{%- elif plugin == 'network' and conf == 'server' %}
LoadPlugin network
<Plugin network>
Listen "::" "25826"
Forward true
Server "{{ pillar['hosts-inet']['serv']['spaceapi'] }}" "25826"
Server "{{ pillar['hosts-inet']['serv']['grafana'] }}" "25826"
</Plugin>
{%- elif plugin == 'ping' %}
LoadPlugin ping
<Plugin ping>
{%- for host in conf %}
Host "{{ host }}"
{%- endfor %}
Interval 10
</Plugin>
{%- elif plugin == 'dhcpcount' and conf %}
{%- set timeout = 180 %}
{%- for iface, ips in salt['grains.get']('ip_interfaces').items() %}
{%- set dhcp_conf = pillar['dhcp'].get(iface) %}
{%- if dhcp_conf and dhcp_conf.get('time') and dhcp_conf.get('time') > timeout %}
{%- set timeout = dhcp_conf['time'] %}
{%- endif %}
{%- endfor %}
LoadPlugin exec
<Plugin exec>
Exec "nobody" "/usr/bin/dhcpcount.rb" "{{ timeout }}"
</Plugin>
{%- elif conf is mapping %}
LoadPlugin {{ plugin }}
<Plugin {{ plugin }}>
{%- for k, v in conf.items() %}
{{ k }} "{{ v }}"
{%- endfor %}
</Plugin>
{%- else %}
LoadPlugin {{ plugin }}
{%- endif %}
{%- endfor %}