EventHandler behaviour

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
FCC_Nagios_Support
Posts: 161
Joined: Tue Mar 10, 2020 11:07 am

EventHandler behaviour

Post by FCC_Nagios_Support »

Good Morning,
I have to trigger an EventHandler to a Windows System based in restart a Windows Service with a 12 minutos delayed between thenend and the start. Are there any issue if Nagios call the .bat and sleeps a while or the call is dissconected?
Thanks
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: EventHandler behaviour

Post by ssax »

I wouldn't sleep an event handler for 12 minutes, you could probably make that work (by increasing a lot of different limits) but I wouldn't recommend it. Is there any reason the event handler needs to wait for it?
FCC_Nagios_Support
Posts: 161
Joined: Tue Mar 10, 2020 11:07 am

Re: EventHandler behaviour

Post by FCC_Nagios_Support »

Hi,
Becuase the windows service spends 10 minutos to stop and then start
KR
FCC_Nagios_Support
Posts: 161
Joined: Tue Mar 10, 2020 11:07 am

Re: EventHandler behaviour

Post by FCC_Nagios_Support »

I will try to explain it better.
my 'event handler' calls a command, this command is a check_nrpe to which I pass another command that executes a service restart on the target machine.
If this last event took 10 or 12 minutes to complete, would the event handler give a timeout error? or how it has been launched without returning any error is it considered executed?

in my Nagios:
Host H - Service X --> CRITICAL --> EVENTHANDLER Y: check_nrpe -c restart_service

in host H (nsclient.ini)
restart_service --> net stop ServiceX // net start ServiceX --> it's takes 10 or 12 minutes to complete
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: EventHandler behaviour

Post by ssax »

It would timeout without modifying the event handler timeout in /usr/local/nagios/etc/nagios.cfg to be higher than the time it takes to complete:

Code: Select all

event_handler_timeout=30
If you adjust it you'll need to apply config or restart the nagios service for the changes to take effect.

Another option, since this is likely a one-off I'd probably setup a scheduled task bat script on the remote system that checks for a file's existence on that remote system and if that file exists have it restart the service and delete the file. Then you could just have your event handler call a plugin you write to create that file. That would take the 12 minute event handler out of the picture. It's not the most elegant but it's a workaround.
Locked