diff options
Diffstat (limited to 'roles/monitoring/collectd')
5 files changed, 77 insertions, 0 deletions
diff --git a/roles/monitoring/collectd/base/defaults/main.yml b/roles/monitoring/collectd/base/defaults/main.yml new file mode 100644 index 00000000..ac45b850 --- /dev/null +++ b/roles/monitoring/collectd/base/defaults/main.yml @@ -0,0 +1,14 @@ +--- +collectd_common_plugin_config: {} + +# collectd_common_plugin_config: +# interface: |- +# Interface "/^veth/" +# IgnoreSelected True +# df: |- +# MountPoint "/^/ingore/this/" +# IgnoreSelected True +# disk: |- +# Disk "sdd" +# Disk "/vda[34]/" +# IgnoreSelected True diff --git a/roles/monitoring/collectd/base/handlers/main.yml b/roles/monitoring/collectd/base/handlers/main.yml new file mode 100644 index 00000000..6bb81b5a --- /dev/null +++ b/roles/monitoring/collectd/base/handlers/main.yml @@ -0,0 +1,5 @@ +--- +- name: restart collectd + service: + name: collectd + state: restarted diff --git a/roles/monitoring/collectd/base/tasks/main.yml b/roles/monitoring/collectd/base/tasks/main.yml new file mode 100644 index 00000000..90603172 --- /dev/null +++ b/roles/monitoring/collectd/base/tasks/main.yml @@ -0,0 +1,37 @@ +--- +- name: install collectd packages + apt: + name: collectd-core + state: present + +- name: install collectd.conf + template: + src: collectd.conf.j2 + dest: /etc/collectd/collectd.conf + mode: 0644 + notify: restart collectd + +- name: create conf.d directory + file: + path: /etc/collectd/conf.d + state: directory + notify: restart collectd + +- name: install common config + template: + src: common.conf.j2 + dest: /etc/collectd/conf.d/common.conf + mode: 0644 + notify: restart collectd + +- name: install plugin specific config + loop: "{{ collectd_common_plugin_config | dict2items }}" + loop_control: + label: "{{ item.key }}" + copy: + dest: "/etc/collectd/conf.d/{{ item.key }}.conf" + content: | + <Plugin "{{ item.key }}"> + {{ item.value | indent(width=2) }} + </Plugin> + notify: restart collectd diff --git a/roles/monitoring/collectd/base/templates/collectd.conf.j2 b/roles/monitoring/collectd/base/templates/collectd.conf.j2 new file mode 100644 index 00000000..46ee5d5c --- /dev/null +++ b/roles/monitoring/collectd/base/templates/collectd.conf.j2 @@ -0,0 +1,6 @@ +LoadPlugin syslog +<Plugin syslog> + LogLevel info +</Plugin> + +Include "/etc/collectd/conf.d/*.conf" diff --git a/roles/monitoring/collectd/base/templates/common.conf.j2 b/roles/monitoring/collectd/base/templates/common.conf.j2 new file mode 100644 index 00000000..6447f3f1 --- /dev/null +++ b/roles/monitoring/collectd/base/templates/common.conf.j2 @@ -0,0 +1,15 @@ +LoadPlugin cpu +LoadPlugin df +LoadPlugin disk +LoadPlugin entropy +LoadPlugin interface +LoadPlugin irq +LoadPlugin load +LoadPlugin memory +LoadPlugin processes +LoadPlugin users + +<Plugin "df"> + ValuesAbsolute true + ValuesPercentage true +</Plugin> |