Page 1 of 1
Hostgroup name variable
Posted: Tue May 26, 2020 5:59 pm
by rdembski
Is there a notifications variable for the name of a hostgroup? I've tried searching, but found nothing besides a variable list that's over 4 years old.
Nagios XI version: 5.6.8
Thanks in advance.
Re: Hostgroup name variable
Posted: Wed May 27, 2020 10:24 am
by cdienger
Were you referring to
https://assets.nagios.com/downloads/nag ... olist.html ? That list contains:
https://assets.nagios.com/downloads/nag ... tgroupname
https://assets.nagios.com/downloads/nag ... groupnames
Neither of these are variables in the notification commands, but that can be changed. See
https://assets.nagios.com/downloads/nag ... iables.pdf. And for example you could modify the xi_host_notification_handler command to look like:
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$" --hostduration="$HOSTDURATION$" --hostgroups "$HOSTGROUPNAMES$"
and then "%hostgroups% could be used in a notification.