diff --git a/playbooks/icinga2.yml b/playbooks/icinga2.yml index fce54fe..9c70e73 100644 --- a/playbooks/icinga2.yml +++ b/playbooks/icinga2.yml @@ -14,6 +14,7 @@ - monitoring-plugins-common - monitoring-plugins-standard - monitoring-plugins-systemd + - monitoring-plugins-contrib state: present - name: Setup Icinga2 master diff --git a/roles/icinga2_master/templates/zones.d/global-templates/commands.conf.j2 b/roles/icinga2_master/templates/zones.d/global-templates/commands.conf.j2 index d621370..6d43a90 100644 --- a/roles/icinga2_master/templates/zones.d/global-templates/commands.conf.j2 +++ b/roles/icinga2_master/templates/zones.d/global-templates/commands.conf.j2 @@ -10,3 +10,48 @@ object CheckCommand "check_systemd" { import "systemd" command = [ PluginDir + "/check_systemd" ] } + +object CheckCommand "memory" { + command = [ PluginDir + "/check_memory" ] + arguments = { + "-a" = { + set_if = "$memory_available$" + description = "Display the free/available memory" + } + "-b" = { + set_if = "$memory_output_b$" + description = "Show output in bytes" + } + "-k" = { + set_if = "$memory_output_k$" + description = "Show output in KB (the default)" + } + "-m" = { + set_if = "$memory_output_m$" + description = "Show output in MB" + } + "-g" = { + set_if = "$memory_output_g$" + description = "Show output in GB" + } + "-s" = { + set_if = "$memory_vmstats$" + description = "Display the virtual memory perfdata" + } + "-w" = { + value = "$memory_warn$" + description = "Warning threshold" + } + "-c" = { + value = "$memory_crit$" + description = "Critical threshold" + } + } + + vars.memory_available = false + vars.memory_output_b = false + vars.memory_output_k = true + vars.memory_output_m = false + vars.memory_output_g = false + vars.memory_vmstats = false +} diff --git a/roles/icinga2_master/templates/zones.d/master/services/common.conf.j2 b/roles/icinga2_master/templates/zones.d/master/services/common.conf.j2 index 219af81..951552a 100644 --- a/roles/icinga2_master/templates/zones.d/master/services/common.conf.j2 +++ b/roles/icinga2_master/templates/zones.d/master/services/common.conf.j2 @@ -52,6 +52,15 @@ apply Service "load" { assign where true } +apply Service "memory" { + import "generic-service" + check_command = "memory" + vars.memory_warn = "80%" + vars.memory_crit = "90%" + command_endpoint = host.name + assign where true +} + apply Service "procs" { import "generic-service" check_command = "procs"