Page 1 of 1
Two Event handler on same service
Posted: Sat Aug 03, 2019 8:37 am
by anjali
Hello Team,
I want to execute two event handler on the same service, one I need to execute when service is down and another I want to execute when service is again up.
So how I can achieve that? Please help me in that.
Re: Two Event handler on same service
Posted: Sat Aug 03, 2019 6:54 pm
by eloyd
One event handler for both things. If you read the event handler documentation (
https://assets.nagios.com/downloads/nag ... dlers.html) you'll see that the event handler can be told if this is a CRITICAL (going down) or an OK (recovery/coming up) event. You would program your script to take different actions accordingly.
Re: Two Event handler on same service
Posted: Mon Aug 05, 2019 12:04 am
by anjali
Hello,
But how I can get that event handler is executed for up or downstate in my custom script?
Re: Two Event handler on same service
Posted: Mon Aug 05, 2019 6:02 am
by eloyd
Read the documentation. Assigning the event handler will make it execute for every check performed. It's up to you to write the handler in such a way that it knows whether it is supposed to do something or not.
Re: Two Event handler on same service
Posted: Mon Aug 05, 2019 8:49 am
by scottwilkerson
Eric is right, in the documentation he referenced
https://assets.nagios.com/downloads/nag ... dlers.html you can see in the script you can put the code you want to execute in different parts of the example script to run on different state changes
Re: Two Event handler on same service
Posted: Mon Aug 05, 2019 11:52 pm
by anjali
ok thanks, I achieve that by using service state in my custom script.
Re: Two Event handler on same service
Posted: Tue Aug 06, 2019 6:48 am
by scottwilkerson
anjali wrote:ok thanks, I achieve that by using service state in my custom script.
Great!
Locking thread