Event Handler is not running
Posted: Tue May 05, 2015 5:36 pm
Here is my configuration and the script:
Because I put the wrong port in the check command, the check should always fail. I did get the service notification in the /usr/local/nagios/var/nagios.log:
[1430864078] SERVICE NOTIFICATION: Julie;server-name;HTTP port:8060;CRITICAL;notify-service-by-email;Connection refused
But the event handler script check_pager has never been executed. The /tmp/test.log has never been created. If I manually run ./check_pager as user nagios, then the script does create the log file.
Does anyone know why the event handler script not running?
Code: Select all
define command{
command_name check_pager
command_line $USER1$/check_pager
}
define service{
use generic-service
host_name server_name
service_description HTTP port:8060
check_command check_http!-H server_name -p 8040
check_interval 1
retry_interval 1
max_check_attempts 5
notification_period 24x7
notification_interval 5
contact_groups team-pager
event_handler_enabled 1
event_handler check_pager
}
>>cat /usr/local/nagios/libexec/check_pager
#!/bin/bash
set -x
LOGFILE="/tmp/test.log"
touch $LOGFILE
echo Test `date` >> $LOGFILE
exit 0
>>ls -l /usr/local/nagios/libexec/check_pager
-rwxr-xr-x 1 root root 171 May 5 15:28 check_pager
[1430864078] SERVICE NOTIFICATION: Julie;server-name;HTTP port:8060;CRITICAL;notify-service-by-email;Connection refused
But the event handler script check_pager has never been executed. The /tmp/test.log has never been created. If I manually run ./check_pager as user nagios, then the script does create the log file.
Does anyone know why the event handler script not running?