forked from infra/ansible
icinga_agent: add basic disk monitoring
This commit is contained in:
parent
d5f8a39219
commit
f839bd1db9
17
roles/icinga-monitor/tasks/disk.yml
Normal file
17
roles/icinga-monitor/tasks/disk.yml
Normal file
@ -0,0 +1,17 @@
|
||||
---
|
||||
|
||||
- name: Configure monitoring for disk
|
||||
template:
|
||||
src: disk.j2
|
||||
dest: /etc/icinga2/conf.d/hosts/{{ inventory_hostname }}.disk
|
||||
owner: "{{ icinga_user }}"
|
||||
group: "{{ icinga_group }}"
|
||||
delegate_to: "{{ icinga_server }}"
|
||||
|
||||
- name: Regenerate hosts.conf
|
||||
assemble:
|
||||
src: /etc/icinga2/conf.d/hosts
|
||||
dest: /etc/icinga2/conf.d/hosts.conf
|
||||
# validate: /usr/sbin/icinga2 daemon -c %s --validate
|
||||
notify: Restart icinga2
|
||||
delegate_to: "{{ icinga_server }}"
|
8
roles/icinga-monitor/templates/disk.j2
Normal file
8
roles/icinga-monitor/templates/disk.j2
Normal file
@ -0,0 +1,8 @@
|
||||
{% for disk in disks %}
|
||||
|
||||
vars.disks["{{ disk }}"] = {
|
||||
disk_partitions = "{{ disks }}"
|
||||
disk_wfree = "10%"
|
||||
disk_cfree = "5%"
|
||||
}
|
||||
{% endfor %}
|
@ -56,3 +56,10 @@
|
||||
- --accept-commands
|
||||
- --accept-config
|
||||
when: not cert_file.stat.exists
|
||||
|
||||
# TODO expand this to cover more than just the root partition
|
||||
- name: Monitor disks
|
||||
include_role: name=icinga-monitor tasks_from=disk
|
||||
vars:
|
||||
disks:
|
||||
- "/"
|
||||
|
Loading…
Reference in New Issue
Block a user