Inconsistency in Notification Email
-
vinothsethuram
- Posts: 147
- Joined: Thu Nov 07, 2013 11:44 am
Inconsistency in Notification Email
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
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
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.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
-
vinothsethuram
- Posts: 147
- Joined: Thu Nov 07, 2013 11:44 am
Re: Inconsistency in Notification Email
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
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?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
-
vinothsethuram
- Posts: 147
- Joined: Thu Nov 07, 2013 11:44 am
Re: Inconsistency in Notification Email
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.
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
abrist was asking if you could post them so we can see what you have.
Former Nagios employee
-
vinothsethuram
- Posts: 147
- Joined: Thu Nov 07, 2013 11:44 am
Re: Inconsistency in Notification Email
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
I believe the sed may be causing some issues . . . .
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
-
vinothsethuram
- Posts: 147
- Joined: Thu Nov 07, 2013 11:44 am
Re: Inconsistency in Notification Email
Even without sed also facing the issue.
Re: Inconsistency in Notification Email
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$
$HOSTOUTPUT$ $LONGHOSTOUTPUT$
and
$SERVICEOUTPUT$ $LONGSERVICEOUTPUT$
Be sure to check out our Knowledgebase for helpful articles and solutions!