Page 1 of 1

Passing contact macro to external script

Posted: Thu Feb 15, 2018 8:50 am
by johnwchen
Moderator Edit: This thread has been split from another - https://support.nagios.com/forum/viewto ... 16&t=47336

In the future, please create a new thread and link to the old one instead of adding on.


npolovenko,

I have tried that and it doesn't seem to be supported for Services event handlers. Only thing that seem to work is custom defined MACRO. My goals is to write a event handler that is generic to all host and use the pre-defined contact for that host. I don't want to go to each host and create custom MACRO for each services and each contact again.

Re: Passing contact macro to external script

Posted: Thu Feb 15, 2018 10:56 am
by mcapra
Contact macros are, unfortunately, not available to Service and Host event handlers:
https://assets.nagios.com/downloads/nag ... olist.html

But you could probably leverage parts of the Nagios XI REST API to get that information loaded into your event handler. You'd just need to code it yourself. More info regarding the REST API can be found in the "Help" section of the Nagios XI GUI.

If you were to configure this as a Global Event Handler using the Nagios XI component, your script could accept a host_name or service_description and use that information to evaluate the appropriate contacts by leveraging the REST API.

Re: Passing contact macro to external script

Posted: Thu Feb 15, 2018 12:05 pm
by kyang
Thanks for the help @mcapra!

johnwchen, Let us know if you have any more questions!