Re: Email is not getting generated for some cases
Posted: Wed Apr 24, 2019 3:09 pm
It seems that i have figured out the error:
define command {
command_name notify-host-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nHOSTGROUP: $HOSTGROUPNAMES\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/bin/mailx -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
}
There was one $ missing in the command after the HOSTGROUPNAMES. Now i have added $ after the HOSTGROUPNAMES. will see monitor it for some time.
define command {
command_name notify-host-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nHOSTGROUP: $HOSTGROUPNAMES\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/bin/mailx -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
}
There was one $ missing in the command after the HOSTGROUPNAMES. Now i have added $ after the HOSTGROUPNAMES. will see monitor it for some time.