Page 1 of 1

Pass Non-Macro Arguments to Event Handlers

Posted: Mon Aug 19, 2019 6:18 am
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?

Re: Pass Non-Macro Arguments to Event Handlers

Posted: Mon Aug 19, 2019 4:56 pm
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