Service Notifications not sending email

Marc Powell marc at ena.com
Thu Jun 28 00:47:50 CEST 2007



> -----Original Message-----
> From: nagios-users-bounces at lists.sourceforge.net [mailto:nagios-users-
> bounces at lists.sourceforge.net] On Behalf Of Rob Groome
> Sent: Wednesday, June 27, 2007 5:10 PM
> To: Nagios-users at lists.sourceforge.net
> Subject: [Nagios-users] Service Notifications not sending email
> 

Lots of good stuff removed...
 
> When set to the above I get the following in /var/log/messages:
> Jun 27 10:44:46 alpha nagios: SERVICE NOTIFICATION: it;system1;Disk -
> D:;CRITICAL;notify-by-email;d:\ - total: 213.20 Gb - used: 12.10 Gb
> (6%) - free 201.11 Gb (94%)

This is good. Nagios tried to send a notification. That means the
problem is with the notification command forward.
 
> notify-by-email command definition:
> # 'notify-by-email' command definition
> define command{
>          command_name    notify-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: $DATE$ $TIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n
> $SERVICEPERFDATA$\n$SERVICEACKCOMMENT\n" | /bin/mail -s "**
> $NOTIFICATIONTYPE$ alert - $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE
> $ **" $CONTACTEMAIL$
>          }
> 
> 
> Nothing in the mail.log file about email being sent - or trying to be
> sent out.
> 
> Any help is appreciated!  I realize that this is probably a simple
> fix as I said before - but it is alluding me at the moment.

In cases like this, it's often very useful to try to manually run the
command that nagios is running to see if it errors out. Have you tried
running the command above as the nagios user? It'll look something like
the following if I've done my substitutions correctly, guessing at some
--

/usr/bin/printf "%b" "***** Nagios  *****\n\nNotification Type:
CRITICAL\n\nService: Disk - D:\nHost: system1\nAddress: 1.1.1.1\nState:
DOWN\n\nDate/Time: Tue Jun 26 23:09:27 CDT 2007\n\nAdditional
Info:\n\nd:\ - total: 213.20 Gb - used: 12.10 Gb (6%) - free 201.11 Gb
(94%)\n  /=2132MB;7844;7854;89;7874\n\n" | /bin/mail -s "** CRITICAL
alert - system1/Disk - D: is CRITICAL **" it at xxx.com

I also prefer to use /bin/echo -e instead of /usr/bin/printf "%b"
myself. It seems to have less problems with things like d:\ in plugin
output.

--
Marc

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list