R: R: R: email notification problem

Nicola Agnelli nicola.agnelli at spiderwall.com
Fri Jan 27 11:45:02 CET 2006


Thank you very mach,

so for “notify-by-email” I sould add

 

|  /usr/bin/mail -s "Service $HOSTALIAS$ alert for $SERVICEDESC$!"
$CONTACTEMAIL$

 

Right ?

 

Tnx

 

 

  _____  

Da: Toto Capuccino [mailto:shoktai at gmail.com] 
Inviato: venerdì 27 gennaio 2006 11.23
A: Nicola Agnelli
Cc: Arno Lehmann; nagios-users at lists.sourceforge.net
Oggetto: Re: R: R: [Nagios-users] email notification problem

 

You should use the variables to get more info :
# 'host-notify-by-email' command definition
define command{
        command_name    host-notify-by-email
        command_line    /usr/bin/printf "%b" "***** Nagios
*****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState:
$HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $OUTPUT$\n\nDate/Time:
$DATETIME$\n" | /usr/bin/mail -s "Host $HOSTSTATE$ alert for $HOSTNAME$!"
$CONTACTEMAIL$
        }



2006/1/27, Nicola Agnelli < nicola.agnelli at spiderwall.com
<mailto:nicola.agnelli at spiderwall.com> >:

Thank you for answer,
so the correct command should be: 

define command{
>         command_name    notify-by-email
>         command_line    /usr/bin/printf "%b" "***** Nagios
> *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService:
> $SERVICEDESC$\nHost: $HOSTALIAS$\nAdd$ | mail -s Notification
>         }

And

define command{
>         command_name    host-notify-by-email
>         command_line    /usr/bin/printf "%b" "***** Nagios 
> *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState:
> $HOSTSTATE$\nAddress: $$ | mail -s Notification
>         }


?

Sorry for my questions but I'm new to nagios .. 

Nicola


-----Messaggio originale-----
Da: nagios-users-admin at lists.sourceforge.net
[mailto: <mailto:nagios-users-admin at lists.sourceforge.net>
nagios-users-admin at lists.sourceforge.net] Per conto di Arno Lehmann
Inviato: venerdì 27 gennaio 2006 10.50
A: nagios-users at lists.sourceforge.net
Oggetto: Re: R: [Nagios-users] email notification problem 

Hello,

On 1/27/2006 10:23 AM, Nicola Agnelli wrote:
> Hello all,
> i've the same problem, i've installed nagios 2.0 and all works good, but
the
> email notifications can't be send..

The first step could be to modify your command_line to actually send a
message. Usually, you use printf to create and format the output AND
THEN pipe that output to your mail program.

Like 'printf "somethning" | mail -s Notification ... 

Arno

> my command is the default command:
>
> define command{
>         command_name    notify-by-email
>         command_line    /usr/bin/printf "%b" "***** Nagios 
> *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService:
> $SERVICEDESC$\nHost: $HOSTALIAS$\nAdd$
>         }
> And:
> define command{
>         command_name    host-notify-by-email 
>         command_line    /usr/bin/printf "%b" "***** Nagios
> *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState:
> $HOSTSTATE$\nAddress: $$
>         }
> 
> But I can't receive notifications mails..
> Here are the nagios.log:
>
> ....
> [1138352948] HOST ALERT: w2k3-server;DOWN;SOFT;9;CRITICAL - Host
Unreachable
> ( 10.0.0.222 <http://10.0.0.222> )
> [1138352951] HOST ALERT: w2k3-server;DOWN;HARD;10;CRITICAL - Host
> Unreachable (10.0.0.222)
> [1138352951] HOST NOTIFICATION:
> nagios-admin;w2k3-server;DOWN;host-notify-by-email;CRITICAL - Host 
> Unreachable (10.0.0.222)
> ....
>
> How can I resolve ?
>
> Tnx all
>
> nicola
>
>
> -----Messaggio originale-----
> Da: nagios-users-admin at lists.sourceforge.net
> [mailto:nagios-users-admin at lists.sourceforge.net ] Per conto di Arno
Lehmann
> Inviato: venerdì 27 gennaio 2006 10.02
> A: nagios-users at lists.sourceforge.net
> Oggetto: Re: [Nagios-users] email notification problem 
>
> 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>  <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
<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
<http://sel.as-us.falkag.net/sel?cmd=lnk&kid%103432&bid#0486&dat1642>
&kid3432&bid#0486&dat1642 
_______________________________________________
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 

__________ NOD32 1.1382 (20060127) Information __________

This message was checked by NOD32 antivirus system.
http://www.eset.com




------------------------------------------------------- 
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?cmdlnk
<http://sel.as-us.falkag.net/sel?cmdlnk&kid%103432&bid#0486&dat1642>
&kid3432&bid#0486&dat1642
_______________________________________________ 
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

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20060127/e64ccf7f/attachment.html>


More information about the Users mailing list