Page 1 of 1

Multiple event handler for single service

Posted: Mon Mar 10, 2014 6:31 am
by NRamesh
Hi,

We have a use case were we need to hook multiple event handlers to services in Nagios. For example, when a http service goes down, we may have an event handler to restart the service another one to notify this change to some other external system. So in general, we need to configure multiple event handlers for a single service. We are thinking of writing a master event handler which will be called by Nagios and internally this master event handler can decide what are the other event handlers needs to be called and call all of them one by one. We are having some issue in passing right arguments to event handlers, because different event handler may expect different set of arguments but all of them may not available to master event handler. Is it the right way to solve this problem or is there any other standard way to solve this.

Thanks in advance for the help :)


Regards,
Ramesh

Re: Multiple event handler for single service

Posted: Mon Mar 10, 2014 1:01 pm
by sreinhardt
I think this is probably the best route to take. However as you mentioned, some of the items may not always be available with host vs services and such. As such, you might look into doing key value pairs to get passed to the master script, which can them parse them out and forward onto the actual script you need executed. One example would be to pass HOSTGROUP:$HOSTGROUP$ so that your script sees HOSTGROUP:[Actuall nagios hostgroup] and then you can parse the given arguments looking for HOSTGROUP: and taking the rest of the string beyond that.