Page 1 of 1

Query about event handlers

Posted: Fri Sep 21, 2018 5:00 am
by caf_infra
Hi,

I'm in the process of setting up an event handler that when the CPU on a server hits 100% it stops and restarts a service on the server.

Everything works, but as the service may take longer to stop and restart than Nagios's check interval, I don't want the script to fire off again if the CPU is still 100%.

I've done it programmatically in the batch file that gets run by having it create a file when it starts and skip to eof if it gets called again and that file exists, as well as having a 90 second delay between the stopping and starting of the service, but was wondering if there was a more elegant way of doing it.

Thanks

Re: Query about event handlers

Posted: Fri Sep 21, 2018 10:51 am
by scottwilkerson
caf_infra wrote:I've done it programmatically in the batch file that gets run by having it create a file when it starts and skip to eof if it gets called again and that file exists, as well as having a 90 second delay between the stopping and starting of the service, but was wondering if there was a more elegant way of doing it.
This is exactly what I would do