Page 1 of 2
Inconsistency in Notification Email
Posted: Tue Dec 03, 2013 3:06 pm
by vinothsethuram
Hi,
I'm facing following issues in Nagios notification.
1) Custom notification is working for few services,but not for all the services. For few services, custom notification is not sending emails.
2) For few services/host, critical/recovery emails were received without info. i.e email body is blank and few emails had partial info.
Please share your thoughts/view to fix this issue
Re: Inconsistency in Notification Email
Posted: Tue Dec 03, 2013 3:22 pm
by abrist
Well, lets start by looking at the custom notification handlers. Could you post them? There is a good chance from your description that there is a syntax problem in the handler.
Re: Inconsistency in Notification Email
Posted: Tue Dec 03, 2013 3:33 pm
by vinothsethuram
Could you please let me know file name and the location for custom handlers. I searched in etc and objects directory, but couldnt find
Re: Inconsistency in Notification Email
Posted: Tue Dec 03, 2013 3:45 pm
by abrist
Usually, you will find the notify-*-by-email commands in the commands.cfg file. You mentioned that these are custom notifications, is that not the case? Nagios ships with a few notification commands, did you change these?
Re: Inconsistency in Notification Email
Posted: Tue Dec 03, 2013 3:50 pm
by vinothsethuram
I changed two commands in commands.cfg. They are
1) notify-host-by-email
2) notify-service-by-email.
Apart from above two services, I didn't change any commands.
Re: Inconsistency in Notification Email
Posted: Tue Dec 03, 2013 3:57 pm
by tmcdonald
abrist was asking if you could post them so we can see what you have.
Re: Inconsistency in Notification Email
Posted: Tue Dec 03, 2013 3:59 pm
by vinothsethuram
Code: Select all
# 'notify-host-by-email' command definition
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$$LONGHOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | sed 's/\r//' | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
}
# 'notify-service-by-email' command definition
define command{
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$$LONGSERVICEOUTPUT$\n" | sed 's/\r//' | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}
Re: Inconsistency in Notification Email
Posted: Wed Dec 04, 2013 1:02 pm
by abrist
I believe the sed may be causing some issues . . . .
Re: Inconsistency in Notification Email
Posted: Wed Dec 04, 2013 3:51 pm
by vinothsethuram
Even without sed also facing the issue.
Re: Inconsistency in Notification Email
Posted: Wed Dec 04, 2013 4:56 pm
by lmiltchev
I am not sure if this is going to fix your problem, but I noticed that you don't have any space between these macros: $HOSTOUTPUT$$LONGHOSTOUTPUT$ and $SERVICEOUTPUT$$LONGSERVICEOUTPUT$. Try putting a space in and see if this is going to help...
$HOSTOUTPUT$ $LONGHOSTOUTPUT$
and
$SERVICEOUTPUT$ $LONGSERVICEOUTPUT$