Pass Non-Macro Arguments to Event Handlers

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.
Locked
vlakshman
Posts: 27
Joined: Tue Aug 21, 2018 11:03 am

Pass Non-Macro Arguments to Event Handlers

Post by vlakshman »

Team,
I have 2 services: Service-A & Service-B.
Service B takes 2 arguments (Which are NOT Macro Variables).
Service-B needs to be called when Service-A - Recovers or Critical.
Is there a way to pass these NON Macro Variables to event handlers?
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: Pass Non-Macro Arguments to Event Handlers

Post by benjaminsmith »

Hi @vlakshman,

In Nagios you have macros and custom or free variables. You have the option of creating variables for your arguments in the service definition and calling those custom object variables ( similar to using macros ).

For example, from the documentation,
define host {
host_name linuxbox
address 192.168.1.1
_MACADDRESS 00:01:02:03:04:05
...
}
The _MACADDRESS custom variable would be available in a macro called $_HOSTMACADDRESS$.

However, if you are trying to run an event handler on Service B whenever Service A recovers, then I believe you would want to create a custom script to be called by Service A. Event handlers are executed for hard problem and recovery states.

See: Event Handlers
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked