Not Receiving Notifications

Marc Powell marc at ena.com
Wed May 28 16:11:44 CEST 2008


On May 28, 2008, at 8:58 AM, Tim Van Caeyzeele wrote:

> Thanks for the feedback,
>
> I executed the line I found in the commands.cfg
> No errors received, but no mail received neither L
>
> root at sv0007:/usr/local/nagios/etc/objects# /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$" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$  
> Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **"  
> $CONTACTEMAIL$
> root at sv0007:/usr/local/nagios/etc/objects#
>

If you take a moment to read and understand the command, it's sending  
the output of a printf statement (basically fancy echo) to the  
command /usr/bin/mail, which specifies a subject (-s) of "**  
$NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is  
$SERVICESTATE$ **" to the e-mail address $CONTACTEMAIL$. The shell has  
no understanding of what the $MACROS$ are so they evaluate to <null>$.  
Because of this you just sent an e-mail to the e-mail address '$' --

[logs]$ echo $CONTACTEMAIL$
$
[logs]$

Nagios substitutes appropriate values for the $MACROS$ _before_  
running the command.

If you're going to test like this --

1) Test as the nagios user, not root. Nagios doesn't run as root and  
doesn't execute this command as root.
2) Substitute reasonable values for all the $MACROS$ above when testing.

As for your general problem, verify that nagios is logging  
notifications in nagios.log. Verify that your SMTP server logs running  
on localhost show receipt from nagios and delivery to destination. If  
you do not see the former, your notification configuration for your  
host/service/or contact is incorrect. If you see receipt of the  
message from nagios in your SMTP server logs but no delivery, the logs  
should detail why.

--
Marc

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
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