Event Handler Function does not run

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
kwhogster
Posts: 644
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:

Event Handler Function does not run

Post by kwhogster »

Nagios Core 4.3.4

My event handler does not work at all.

I do not know how to check to see if it is even being called by the command

My event handler

Code: Select all

#!/bin/sh

case "$1" in

OK)

;;

WARNING)

;;

UNKNOWN)

;;

CRITICAL)

     case "$2" in

     SOFT)

          case "$3" in

          3)

                /usr/local/nagios/libexec/check_nrpe -H "$2" -p 5666 -c restart_service -a "$3"

                ;;
                esac

          ;;

      HARD)

               /usr/local/nagios/libexec/check_nrpe -H "$2" -p 5666 -c restart_service -a "$3"

               ;;

      esac

      ;;
esac

exit 0

My command

Code: Select all

define command{
        command_name    restart-aservice
        command_line    /usr/local/nagios/libexec/restart-aservice.sh $SERVICESTATE$ $SERVICESTATETYPE$ $SERVICEATTEMPT$ $HOSTNAME$
}


I did a tail of the nagios.log file but I saw nothing that would indicate a problem.

Is there any thing I can do to check if this works or not?

On the client the nsclient.ini is good the cmd file on the client works every time

if I run the command from the command line on the nagios server it works.

But when the event occurs it never send the request to the client.

I know this because I placed the client in debug mode running ncsp test



Here is the defined service

Code: Select all

define service {
        host_name               TGKW002
        service_description     Check All Service
        check_command           check_nrpe!checkservicestate! -a CheckAll exclude=RemoteRegistry exclude=sppsvc exclude=MapsBroker exclude=dbupdate exclude=DoSvc exclude=TrustedInstller exclude=gpsvc exclude=WbioSrvc exclude=edgeupdate
        servicegroups           AllServices
        check_interval          60
        notification_interval   60
        event_handler_enabled   1
        event_handler           restart-aservice
        use                     generic-service
        }

Any ideas or suggestions
Locked