Page 4 of 4

Re: Email is not getting generated for some cases

Posted: Wed Apr 24, 2019 3:09 pm
by amitgupta19
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.

Re: Email is not getting generated for some cases

Posted: Wed Apr 24, 2019 3:17 pm
by scottwilkerson
amitgupta19 wrote: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.
that would do it!

Let us know how it turns out

Re: Email is not getting generated for some cases

Posted: Thu Apr 25, 2019 4:34 am
by amitgupta19
yes it is working now.
Thanks for your support

Re: Email is not getting generated for some cases

Posted: Thu Apr 25, 2019 8:30 am
by scottwilkerson
amitgupta19 wrote:yes it is working now.
Thanks for your support
Great!

Locking thread