Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
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.
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.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.