You should use the variables to get more info :<br># 'host-notify-by-email' command definition<br>define command{<br>        command_name    host-notify-by-email<br>        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 
<span style="font-weight: bold;">"Host $HOSTSTATE$ alert for $HOSTNAME$!" $CONTACTEMAIL$</span><br>        }<br><br><br><div><span class="gmail_quote">2006/1/27, Nicola Agnelli <<a href="mailto:nicola.agnelli@spiderwall.com">
nicola.agnelli@spiderwall.com</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Thank you for answer,<br>so the correct command should be:
<br><br>define command{<br>>         command_name    notify-by-email<br>>         command_line    /usr/bin/printf "%b" "***** Nagios<br>> *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService:<br>
> $SERVICEDESC$\nHost: $HOSTALIAS$\nAdd$ | mail -s Notification<br>>         }<br><br>And<br><br>define command{<br>>         command_name    host-notify-by-email<br>>         command_line    /usr/bin/printf "%b" "***** Nagios
<br>> *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState:<br>> $HOSTSTATE$\nAddress: $$ | mail -s Notification<br>>         }<br><br><br>?<br><br>Sorry for my questions but I'm new to nagios ..
<br><br>Nicola<br><br><br>-----Messaggio originale-----<br>Da: <a href="mailto:nagios-users-admin@lists.sourceforge.net">nagios-users-admin@lists.sourceforge.net</a><br>[mailto:<a href="mailto:nagios-users-admin@lists.sourceforge.net">
nagios-users-admin@lists.sourceforge.net</a>] Per conto di Arno Lehmann<br>Inviato: venerd́ 27 gennaio 2006 10.50<br>A: <a href="mailto:nagios-users@lists.sourceforge.net">nagios-users@lists.sourceforge.net</a><br>Oggetto: Re: R: [Nagios-users] email notification problem
<br><br>Hello,<br><br>On 1/27/2006 10:23 AM, Nicola Agnelli wrote:<br>> Hello all,<br>> i've the same problem, i've installed nagios 2.0 and all works good, but<br>the<br>> email notifications can't be send..<br>
<br>The first step could be to modify your command_line to actually send a<br>message. Usually, you use printf to create and format the output AND<br>THEN pipe that output to your mail program.<br><br>Like 'printf "somethning" | mail -s Notification ...
<br><br>Arno<br><br>> my command is the default command:<br>><br>> define command{<br>>         command_name    notify-by-email<br>>         command_line    /usr/bin/printf "%b" "***** Nagios
<br>> *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService:<br>> $SERVICEDESC$\nHost: $HOSTALIAS$\nAdd$<br>>         }<br>> And:<br>> define command{<br>>         command_name    host-notify-by-email
<br>>         command_line    /usr/bin/printf "%b" "***** Nagios<br>> *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState:<br>> $HOSTSTATE$\nAddress: $$<br>>         }<br>>
<br>> But I can't receive notifications mails..<br>> Here are the nagios.log:<br>><br>> ....<br>> [1138352948] HOST ALERT: w2k3-server;DOWN;SOFT;9;CRITICAL - Host<br>Unreachable<br>> (<a href="http://10.0.0.222">
10.0.0.222</a>)<br>> [1138352951] HOST ALERT: w2k3-server;DOWN;HARD;10;CRITICAL - Host<br>> Unreachable (<a href="http://10.0.0.222">10.0.0.222</a>)<br>> [1138352951] HOST NOTIFICATION:<br>> nagios-admin;w2k3-server;DOWN;host-notify-by-email;CRITICAL - Host
<br>> Unreachable (<a href="http://10.0.0.222">10.0.0.222</a>)<br>> ....<br>><br>> How can I resolve ?<br>><br>> Tnx all<br>><br>> nicola<br>><br>><br>> -----Messaggio originale-----<br>> Da: 
<a href="mailto:nagios-users-admin@lists.sourceforge.net">nagios-users-admin@lists.sourceforge.net</a><br>> [mailto:<a href="mailto:nagios-users-admin@lists.sourceforge.net">nagios-users-admin@lists.sourceforge.net</a>
] Per conto di Arno<br>Lehmann<br>> Inviato: venerd́ 27 gennaio 2006 10.02<br>> A: <a href="mailto:nagios-users@lists.sourceforge.net">nagios-users@lists.sourceforge.net</a><br>> Oggetto: Re: [Nagios-users] email notification problem
<br>><br>> Hello,<br>><br>> On 1/27/2006 3:44 AM, test 123king wrote:<br>><br>>>I have set up nagios nagios-1.3-14.fc4 in my FC4 server, the only<br>>>problem now is the email notification can't be send out.
<br>>>The original notify-by-email in misccommands.cfg file is like below:<br>>># 'notify-by-email' command definition<br>>>define command{<br>>>command_name notify-by-email<br>>>command_line /usr/bin/printf "%b" "***** Nagios *****nnNotification
<br>>>Type: $NOTIFICATIONTYPE$nnService: $SERVIC<br>>>EDESC$nHost: $HOSTALIAS$nAddress: $HOSTADDRESS$nState:<br>>>$SERVICESTATE$nnDate/Time: $DATETIME$nnAdditional Info:n<br>>>n$OUTPUT$" | -s "** $NOTIFICATIONTYPE$ alert - $HOSTALIAS$/$SERVICEDESC$
<br>>>is $SERVICESTATE$ **" $CONTACTEMAIL$<br>>>}<br>>><br>>>I changed it to :<br>>># 'notify-by-email' command definition<br>>>define command{<br>>>command_name notify-by-email
<br>>>command_line /bin/mail "%b" "***** Nagios *****nnNotification Type:<br>>>$NOTIFICATIONTYPE$nnService: $SERVIC<br>>>EDESC$nHost: $HOSTALIAS$nAddress: $HOSTADDRESS$nState:<br>>>$SERVICESTATE$nnDate/Time: $DATETIME$nnAddi tional Info:n
<br>>>n$OUTPUT$" | -s "** $NOTIFICATIONTYPE$ alert - $HOSTALIAS$/$SERVICEDESC$<br>>>is $SERVICESTATE$ **" $CONTACTEMAIL$<br>>>}<br>>><br>>>Basically I replaced /usr/bin/printf with /bin/mail.
<br>><br>><br>> And you don't have a valid command line left: after the pipe, there<br>> should be a program to read the output from mail. And your invocation of<br>> mail looks a little... non-standard to me.
<br>><br>><br>>>In the /var/log/messages log I see the following error:<br>>><br>>><br>>>Warning: Attempting to execute the command "/bin/mail "%b" "***** Nagios<br>>>*****nnNotification Type: RECOVERYnHost: Server-1nState: UPnAddress:
<br>>>10.100.1.79nInfo: PING OK - Packet loss = 0%, RTA = 0.76 msnnDate/Time:<br>>>Thu Jan 26 17:48:21 EST 2006n" | -s "Host UP alert for Server-OTM!"<br>>><a href="mailto:sysadmin@www.com">
sysadmin@www.com</a> <mailto:<a href="mailto:sysadmin@www.com">sysadmin@www.com</a>>" resulted in a return code of<br>>>127. Make sure the scri//pt or binary you are trying to execute actually<br>>>exists...
<br>><br>><br>> It's all there: the output from mail is piped to '-s' which, most<br>> probably, is not installed on your system as an executable program in<br>> the path.<br>><br>><br>>>Any kind help is highly appreciated!!
<br>>><br>><br>><br>> Why don't you try the original notification script and simply insert<br>> your mail command between pipe and '-s'? The reason why it's missing, by<br>> the way, is probably that configure couldn't identify your mailer.
<br>><br>> Arno<br>><br><br>--<br>IT-Service Lehmann                    <a href="mailto:al@its-lehmann.de">al@its-lehmann.de</a><br>Arno Lehmann                  <a href="http://www.its-lehmann.de">http://www.its-lehmann.de
</a><br><br><br><br>-------------------------------------------------------<br>This SF.net email is sponsored by: Splunk Inc. Do you grep through log files<br>for problems?  Stop!  Download the new AJAX search engine that makes
<br>searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!<br><a href="http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642">http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642
</a><br>_______________________________________________<br>Nagios-users mailing list<br><a href="mailto:Nagios-users@lists.sourceforge.net">Nagios-users@lists.sourceforge.net</a><br><a href="https://lists.sourceforge.net/lists/listinfo/nagios-users">
https://lists.sourceforge.net/lists/listinfo/nagios-users</a><br>::: Please include Nagios version, plugin version (-v) and OS when reporting<br>any issue.<br>::: Messages without supporting info will risk being sent to /dev/null
<br><br>__________ NOD32 1.1382 (20060127) Information __________<br><br>This message was checked by NOD32 antivirus system.<br><a href="http://www.eset.com">http://www.eset.com</a><br><br><br><br><br>-------------------------------------------------------
<br>This SF.net email is sponsored by: Splunk Inc. Do you grep through log files<br>for problems?  Stop!  Download the new AJAX search engine that makes<br>searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
<br><a href="http://sel.as-us.falkag.net/sel?cmdlnk&kid3432&bid#0486&dat1642">http://sel.as-us.falkag.net/sel?cmdlnk&kid3432&bid#0486&dat1642</a><br>_______________________________________________
<br>Nagios-users mailing list<br><a href="mailto:Nagios-users@lists.sourceforge.net">Nagios-users@lists.sourceforge.net</a><br><a href="https://lists.sourceforge.net/lists/listinfo/nagios-users">https://lists.sourceforge.net/lists/listinfo/nagios-users
</a><br>::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.<br>::: Messages without supporting info will risk being sent to /dev/null<br></blockquote></div><br>