r/collectd-nut: Configure nut plugin for collectd
The *nut* plugin for *collectd* fetches data from Network UPS Tools. This is useful for monitoring UPS statistics over time.
This commit is contained in:
2
roles/collectd-nut/defaults/main.yml
Normal file
2
roles/collectd-nut/defaults/main.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
collectd_load_nut_plugin: true
|
||||
collectd_nut_ups: []
|
||||
4
roles/collectd-nut/handlers/main.yml
Normal file
4
roles/collectd-nut/handlers/main.yml
Normal file
@@ -0,0 +1,4 @@
|
||||
- name: restart collectd
|
||||
service:
|
||||
name: collectd
|
||||
state: restarted
|
||||
26
roles/collectd-nut/tasks/main.yml
Normal file
26
roles/collectd-nut/tasks/main.yml
Normal file
@@ -0,0 +1,26 @@
|
||||
- name: ensure collectd nut plugin is installed
|
||||
package:
|
||||
name: collectd-nut
|
||||
state: present
|
||||
tags:
|
||||
- install
|
||||
|
||||
- name: ensure collectd nut plugin is configured
|
||||
template:
|
||||
src: collectd-nut.conf.j2
|
||||
dest: /etc/collectd.d/nut.conf
|
||||
mode: u=rw,go=r
|
||||
notify:
|
||||
- restart collectd
|
||||
tags:
|
||||
- collectd-config
|
||||
|
||||
- name: ensure collectd is allowed to connect to nut
|
||||
seboolean:
|
||||
name: collectd_tcp_network_connect
|
||||
state: true
|
||||
persistent: true
|
||||
notify:
|
||||
- restart collectd
|
||||
tags:
|
||||
- selinux
|
||||
9
roles/collectd-nut/templates/collectd-nut.conf.j2
Normal file
9
roles/collectd-nut/templates/collectd-nut.conf.j2
Normal file
@@ -0,0 +1,9 @@
|
||||
{% if collectd_load_nut_plugin %}
|
||||
LoadPlugin nut
|
||||
|
||||
{% endif %}
|
||||
<Plugin nut>
|
||||
{% for ups in collectd_nut_ups %}
|
||||
UPS "{{ ups }}"
|
||||
{% endfor %}
|
||||
</Plugin>
|
||||
Reference in New Issue
Block a user