Page 1 of 1

Appear Hostgroup in email (first group in list)

Posted: Fri Nov 13, 2020 6:36 am
by Shalauras
Hi, I am trying to send an email appearing the first variable HOSTGROUP

define command{
command_name notify-host-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/bin/mailx -r [email protected] -s "** $NOTIFICATIONTYPE$ Alert: $HOSTGROUPNAME$/$HOSTNAME$ state $HOSTSTATE$ **" $CONTACTEMAIL$
}

Actually hosts is added in 2 groups -> AA and Linux
I added " $HOSTGROUPNAME$ ", so I receive email with Hostgroup right but I have 2 group (AA and Linux), as Linux alphabetic is last, I see email with "Linux" and not with "AA", are there any way to send in hostgroupname the first variable?
Now I have Alert: LINUX/HOST state xx
I want: AA/HOST state xx

Any ideas? thanks!