Add Hostgroup to Notifications

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
brucej543
Posts: 134
Joined: Thu Jun 21, 2018 9:33 am

Add Hostgroup to Notifications

Post by brucej543 »

Nagios 5.6.14 - On the notifications being sent, is there an easy way to add the hostgroup to the notifications. We are moving to having a central group for the alerts notification and they need to know what type of OS the alert is for so they can contact the correct group for resolution.
I reviewed the Understanding Notification Variables document and to not see any reference to Hostgroups.
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Add Hostgroup to Notifications

Post by cdienger »

$HOSTGROUPNAME$ AND $HOSTGROUPNAMES$ are available and can be added to notifications:

https://assets.nagios.com/downloads/nag ... olist.html

Edit the xi_hostnotification_handler to add $HOSTGROUPNAMES$:

Code: Select all

/usr/bin/php /usr/local/nagiosxi/scripts/handle_nagioscore_notification.php --notification-type=host --contact="$CONTACTNAME$" --contactemail="$CONTACTEMAIL$" --type=$NOTIFICATIONTYPE$ --escalated="$NOTIFICATIONISESCALATED$" --author="$NOTIFICATIONAUTHOR$" --comments="$NOTIFICATIONCOMMENT$" --host="$HOSTNAME$" --hostaddress="$HOSTADDRESS$" --hostalias="$HOSTALIAS$" --hostdisplayname="$HOSTDISPLAYNAME$" --hoststate=$HOSTSTATE$ --hoststateid=$HOSTSTATEID$ --lasthoststate=$LASTHOSTSTATE$ --lasthoststateid=$LASTHOSTSTATEID$ --hoststatetype=$HOSTSTATETYPE$ --currentattempt=$HOSTATTEMPT$ --maxattempts=$MAXHOSTATTEMPTS$ --hosteventid=$HOSTEVENTID$ --hostproblemid=$HOSTPROBLEMID$ --hostoutput="$HOSTOUTPUT$" --longhostoutput="$LONGHOSTOUTPUT$" --datetime="$LONGDATETIME$" --hostgroups="$HOSTGROUPNAMES$"
A list of the hostgroups will then be stored in %hostgroups% which can be used in the notification message.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
brucej543
Posts: 134
Joined: Thu Jun 21, 2018 9:33 am

Re: Add Hostgroup to Notifications

Post by brucej543 »

Thank you for the information. This post can be closed.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Add Hostgroup to Notifications

Post by scottwilkerson »

brucej543 wrote:Thank you for the information. This post can be closed.
Great

Closing thread
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked