Page 1 of 1

Secondary event handlers

Posted: Tue Jun 04, 2013 11:17 am
by c.slagel
Is there a way to get an event handler to run again after a certain period of time?

Example:

We are using the Windows Service Restart event handler provided by Nagios. However sometimes there's lag or whatnot and it fails to effectively restart the service.

Would like to have a way that if after X amount of time, if the service has not recovered, the event handler will run again.

Is there an easy way of doing this?

Thanks,
Chris

Re: Secondary event handlers

Posted: Tue Jun 04, 2013 2:41 pm
by abrist
One idea: You could sleep the event handler script for a few minutes and then have it recheck. If the service is still down, try to restart it and sleep again, if it is up, exit out of the script.

You could alternatively make the check volatile, and add logic to the beginning of the script to check if the service is down. If it is down, the script will restart it, if it is up, the script will exit. By setting the check to volatile, the event handler will run on every check so you have to make sure your event handler script has some logic to deal with that.