icinga_agent: add basic disk monitoring

This commit is contained in:
Markus 2024-03-02 21:01:42 +01:00
parent d5f8a39219
commit f839bd1db9
3 changed files with 32 additions and 0 deletions

View 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 }}"

View File

@ -0,0 +1,8 @@
{% for disk in disks %}
vars.disks["{{ disk }}"] = {
disk_partitions = "{{ disks }}"
disk_wfree = "10%"
disk_cfree = "5%"
}
{% endfor %}

View File

@ -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:
- "/"