Event Handler is not running

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Julie
Posts: 1
Joined: Tue May 05, 2015 4:45 pm

Event Handler is not running

Post by Julie »

Here is my configuration and the script:

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
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?
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Event Handler is not running

Post by tgriep »

Could you run the following and post back the output?

Code: Select all

grep event /usr/local/nagios/etc/nagios.cfg
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked