Page 1 of 1
stop Event Handler during Scheduled Downtime
Posted: Mon Jul 10, 2017 12:44 pm
by caterpillartce
Hello,
I used macro $HOSTDOWNTIME$ and the script for event handler will simply exit if $HOSTDOWNTIME$ is not zero. But it did not seem to have worked. Is it not the right macro to use?
Thanks!
Re: stop Event Handler during Scheduled Downtime
Posted: Mon Jul 10, 2017 12:45 pm
by tmcdonald
It might be easier if you posted your script so we can take a look at it.
Re: stop Event Handler during Scheduled Downtime
Posted: Mon Jul 10, 2017 12:55 pm
by caterpillartce
Thanks for the reply! It is a rather complicated script to send alerts as tickets to BMC Remedy that I got from the BMC support team in our company, and I am not sure if I am allowed to post the script here . But I used the same logic to add another macro so that this event handler script ignores SOFT state changes, and that works fine; so I am wondering this time I may not be using the correct macro?
Now thinking about it, I probably should have used $SERVICEDOWNTIME$? The event handler is set in a service template that has been applied to the monitoring services.
We schedule downtime for all hosts in a certain host group, not down to individual services. But when a host is in "scheduled downtime", are all its monitoring services in "scheduled downtime" too? If so, $SERVICEDOWNTIME$ should work...
Thanks!
Re: stop Event Handler during Scheduled Downtime
Posted: Mon Jul 10, 2017 3:55 pm
by tmcdonald
How are you scheduling the downtime? Certain methods will affect the services and leave the hosts alone, or vice-versa.
Re: stop Event Handler during Scheduled Downtime
Posted: Wed Jul 12, 2017 7:49 am
by caterpillartce
I surveyed people who normally do this, and looks like there are two ways they schedule downtime in Nagios:
1. HostGroup Summary, View Hostgroup Commands, Schedule downtime for all SERVICES in this group, in the next screen, select "Schedule Downtime for hosts too"
2. HostGroup Summary, View Hostgroup Commands, Schedule downtime for all HOSTS in this group
So, I am thinking, in the script, if I check both $SERVICEDOWNTIME$ and $HOSTDOWNTIME$ and if either one is non-zero, the script simply exits, and this should cover both scenarios when service or host is in downtime.
Your thoughts?
Thanks
Re: stop Event Handler during Scheduled Downtime
Posted: Wed Jul 12, 2017 12:52 pm
by tgriep
Yes, checking both of those macros would catch all of the combinations for hosts and services being down so testing them both would be a good idea.