diff --git a/salt-pillar/collectd/server1.sls b/salt-pillar/collectd/server1.sls new file mode 100644 index 000000000..1b082fb --- /dev/null +++ b/salt-pillar/collectd/server1.sls @@ -0,0 +1,14 @@ +collectd: + network: client + irq: True + cpu: True + load: True + memory: True + swap: True + entropy: True + disk: True + df: True + processes: True + hddtemp: True + sensors: True + thermal: True diff --git a/salt-pillar/collectd/stats-server.sls b/salt-pillar/collectd/stats-server.sls new file mode 100644 index 000000000..580fa78 --- /dev/null +++ b/salt-pillar/collectd/stats-server.sls @@ -0,0 +1,8 @@ +collectd: + network: server + disk: True + df: True + rrdtool: + DataDir: "/var/lib/collectd/rrd" + CacheTimeout: 300 + CacheFlush: 600 diff --git a/salt-pillar/collectd/upstream.sls b/salt-pillar/collectd/upstream.sls new file mode 100644 index 000000000..8e1abb8 --- /dev/null +++ b/salt-pillar/collectd/upstream.sls @@ -0,0 +1,8 @@ +collectd: + network: client + interface: True + ping: + - google.de + - 8.8.8.8 + - www.vodafone.de + conntrack: True diff --git a/salt-pillar/lxc-containers/server1.sls b/salt-pillar/lxc-containers/server1.sls index 44632e5..b010a60 100644 --- a/salt-pillar/lxc-containers/server1.sls +++ b/salt-pillar/lxc-containers/server1.sls @@ -142,3 +142,10 @@ containers: type: veth gw: serv-gw gw6: serv-gw + + stats: + interfaces: + serv: + type: veth + gw: serv-gw + gw6: serv-gw diff --git a/salt-pillar/top.sls b/salt-pillar/top.sls index 38db24b..7028664 100644 --- a/salt-pillar/top.sls +++ b/salt-pillar/top.sls @@ -8,6 +8,7 @@ base: - bird.ospf - switches - cpe.aps + - collectd.server1 'priv*-gw': - dhcp - bird.radv @@ -23,6 +24,7 @@ base: - bird.bgp 'upstream*': - bird.ospf + - collectd.upstream # for forward-zones in unbound - bind.dns 'upstream1': @@ -33,5 +35,8 @@ base: - bird.ospf - vpn.anon1 - upstream.anon1 + - collectd.upstream 'dns': - bind.dns + 'stats': + - collectd.stats-server diff --git a/salt/collectd/collectd.conf b/salt/collectd/collectd.conf new file mode 100644 index 000000000..5ef7727 --- /dev/null +++ b/salt/collectd/collectd.conf @@ -0,0 +1,47 @@ +Hostname "{{ salt['grains.get']('id') }}" +FQDNLookup false +Interval 10 + +LoadPlugin logfile + + LogLevel info + File STDOUT + + + +{%- for plugin, conf in pillar['collectd'].items() %} + +{%- if plugin == 'network' and conf == 'client' %} +LoadPlugin network + + Server "{{ pillar['hosts-inet6']['serv']['stats'] }}" "25826" + +{%- elif plugin == 'network' and conf == 'server' %} +LoadPlugin network + + Listen "::" "25826" + + +{%- elif plugin == 'ping' %} +LoadPlugin ping + +{%- for host in conf %} + Host "{{ host }}" +{%- endfor %} + Interval 10 + + +{%- elif type(conf) == dict %} +LoadPlugin {{ plugin }} + + +{%- for k, v in conf.items() %} + {{ k }} "{{ v }}" +{%- endfor %} + +{%- else %} +LoadPlugin {{ plugin }} + +{%- endif %} + +{%- endfor %} diff --git a/salt/collectd/init.sls b/salt/collectd/init.sls new file mode 100644 index 000000000..d4bea17 --- /dev/null +++ b/salt/collectd/init.sls @@ -0,0 +1,17 @@ +collectd-core: + pkg.installed: [] + +liboping0: + pkg.installed: [] + +collectd: + service: + - running + - watch: + - pkg: collectd-core + - file: /etc/collectd/collectd.conf + +/etc/collectd/collectd.conf: + file.managed: + - source: salt://collectd/collectd.conf + - template: 'jinja' diff --git a/salt/top.sls b/salt/top.sls index fec2bdf..25a3aff 100644 --- a/salt/top.sls +++ b/salt/top.sls @@ -6,6 +6,7 @@ base: - bird - switches - cpe + - collectd 'priv*-gw': - no-ssh - forwarding @@ -31,6 +32,7 @@ base: - unbound - upstream.dhcp - upstream.shaping + - collectd 'upstream1': - upstream.6to4 - upstream.nat66 @@ -46,6 +48,10 @@ base: - upstream.masquerade - upstream.shaping - upstream.nat66 + - collectd 'dns': - no-ssh - bind + 'stats': + - no-ssh + - collectd