From df069adc5ef0c81d7cc65b31e24debff8b19affd Mon Sep 17 00:00:00 2001 From: Markus Hauschild Date: Mon, 28 Oct 2024 19:53:06 +0100 Subject: [PATCH] icinga: add apt and disk service definitions --- .../icinga2/zones.d/master/services.conf | 21 +++++++++++++++++++ roles/icinga/tasks/main.yml | 4 ++++ 2 files changed, 25 insertions(+) create mode 100644 roles/icinga/files/icinga2/zones.d/master/services.conf diff --git a/roles/icinga/files/icinga2/zones.d/master/services.conf b/roles/icinga/files/icinga2/zones.d/master/services.conf new file mode 100644 index 0000000..dce2778 --- /dev/null +++ b/roles/icinga/files/icinga2/zones.d/master/services.conf @@ -0,0 +1,21 @@ +apply Service "apt" { + import "generic-service" + + check_command = "apt" + + command_endpoint = host.vars.agent_endpoint + + assign where host.vars.agent_endpoint && host.vars.os == "Linux" +} + +apply Service "disk" for (disk => config in host.vars.disks) { + import "generic-service" + + check_command = "disk" + + command_endpoint = host.vars.agent_endpoint + + assign where host.vars.agent_endpoint + + vars += config +} diff --git a/roles/icinga/tasks/main.yml b/roles/icinga/tasks/main.yml index 15c1b91..5cf799c 100644 --- a/roles/icinga/tasks/main.yml +++ b/roles/icinga/tasks/main.yml @@ -72,6 +72,10 @@ owner: "{{ icinga_user }}" group: "{{ icinga_group }}" +- name: Configure services + copy: src=icinga2/zones.d/master/services.conf dest=/etc/icinga2/zones.d/master/services.conf owner={{ icinga_user }} group={{ icinga_group }} + notify: Restart icinga2 + - name: Configure zones template: src=icinga2/zones.conf.j2 dest=/etc/icinga2/zones.conf owner={{ icinga_user }} group={{ icinga_group }} notify: Restart icinga2