How to make a persistent acknowledgment in Icinga/Nagios?
I am using Icinga (Nagios fork) to also monitor uptime of external hosts and services. Currently when looking at the "Critical" count I find it difficult to decide if an internal service is affected (I should take immediate action) or an external service (I just acknowledge the problem).
Is there a way to keep a problem acknowledgement for future down-times of the checked host/service? Is there some way to auto-acknowledge the state change of external hosts/services?
Have found out how to do auto-acknowledges for external hosts.
First define an event handler for the external host:
define host {
name some-external-server
# ...
event_handler handle_external_host
# ...
}
Then define the command to be used as the event handler:
define command {
command_name handle_external_host
command_line $USER1$/eventhandlers/acknowledge_host_problem $HOSTNAME$ icingaadmin "Handled by external user"
}
Finally put the event handler script into file /usr/local/icinga/libexec/eventhandlers/acknowledge_host_problem (or where your event handers are installed):
#!/bin/sh
printf_cmd="/usr/bin/printf"
command_file="/usr/local/icinga/var/rw/icinga.cmd"
hostname="$1"
author="$2"
comment="$3"
# get the current date/time in seconds since UNIX epoch
now=`date +%s`
# pipe the command to the command file
$printf_cmd "[%lu] ACKNOWLEDGE_HOST_PROBLEM;%s;1;1;0;%s;%s\n" $now "$hostname" "$author" "$comment" >> $command_file
Don't forget to make the script executable using command "chmod +x" or similar. For details on ACKNOWLEDGE_HOST_PROBLEM see the Icinga documentation.