I have created a Custom Variable called _location in all of my hosts.
I would like the variable's value to be mentioned in Service Nortifications.
I have edited the Service Alert Message to be as follows, notice the location definition:
Code: Select all
***** Nagios XI Alert *****
%alertsummary%
Notification Type: %type%
Service: %service%
Host: %host%
Location: %location%
Address: %hostaddress%
State: %servicestate%
Info:
%serviceoutput%
Date/Time: %datetime%
Respond: %responseurl%
Nagios URL: %xiserverurl%
The value cannot be hardcoded in every Service _location custom variable because we have custom Services spanning multiple hosts with different location values. Is it possible to add the dynamic definition in the service custom variable definition? I.E. Name: _location, Value $_HOSTlocation$ ? Perhaps as an environmental variable NAGIOS__HOSTlocation?
If not how should the xi_service_notification_handler command be structured to allow for dynamic on demand host macros? Would the following work?
Code: Select all
/usr/bin/php/user/local/nagiosxi/scripts/handle_nagioscore_notification.php --location="$_HOSTlocation:HOSTNAME$"