email notification problem

Arno Lehmann al at its-lehmann.de
Fri Jan 27 10:02:07 CET 2006


Hello,

On 1/27/2006 3:44 AM, test 123king wrote:
> I have set up nagios nagios-1.3-14.fc4 in my FC4 server, the only 
> problem now is the email notification can't be send out.
> The original notify-by-email in misccommands.cfg file is like below:
> # 'notify-by-email' command definition
> define command{
> command_name notify-by-email
> command_line /usr/bin/printf "%b" "***** Nagios *****nnNotification 
> Type: $NOTIFICATIONTYPE$nnService: $SERVIC
> EDESC$nHost: $HOSTALIAS$nAddress: $HOSTADDRESS$nState: 
> $SERVICESTATE$nnDate/Time: $DATETIME$nnAdditional Info:n
> n$OUTPUT$" | -s "** $NOTIFICATIONTYPE$ alert - $HOSTALIAS$/$SERVICEDESC$ 
> is $SERVICESTATE$ **" $CONTACTEMAIL$
> }
> 
> I changed it to :
> # 'notify-by-email' command definition
> define command{
> command_name notify-by-email
> command_line /bin/mail "%b" "***** Nagios *****nnNotification Type: 
> $NOTIFICATIONTYPE$nnService: $SERVIC
> EDESC$nHost: $HOSTALIAS$nAddress: $HOSTADDRESS$nState: 
> $SERVICESTATE$nnDate/Time: $DATETIME$nnAddi tional Info:n
> n$OUTPUT$" | -s "** $NOTIFICATIONTYPE$ alert - $HOSTALIAS$/$SERVICEDESC$ 
> is $SERVICESTATE$ **" $CONTACTEMAIL$
> }
> 
> Basically I replaced /usr/bin/printf with /bin/mail.

And you don't have a valid command line left: after the pipe, there 
should be a program to read the output from mail. And your invocation of 
mail looks a little... non-standard to me.

> In the /var/log/messages log I see the following error:
> 
> 
> Warning: Attempting to execute the command "/bin/mail "%b" "***** Nagios 
> *****nnNotification Type: RECOVERYnHost: Server-1nState: UPnAddress: 
> 10.100.1.79nInfo: PING OK - Packet loss = 0%, RTA = 0.76 msnnDate/Time: 
> Thu Jan 26 17:48:21 EST 2006n" | -s "Host UP alert for Server-OTM!" 
> sysadmin at www.com <mailto:sysadmin at www.com>" resulted in a return code of 
> 127. Make sure the scri//pt or binary you are trying to execute actually 
> exists...

It's all there: the output from mail is piped to '-s' which, most 
probably, is not installed on your system as an executable program in 
the path.

> 
> Any kind help is highly appreciated!!
> 

Why don't you try the original notification script and simply insert 
your mail command between pipe and '-s'? The reason why it's missing, by 
the way, is probably that configure couldn't identify your mailer.

Arno

-- 
IT-Service Lehmann                    al at its-lehmann.de
Arno Lehmann                  http://www.its-lehmann.de


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
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