Email Notification

Marc Powell marc at ena.com
Wed Sep 19 17:01:38 CEST 2007



> -----Original Message-----
> From: nagios-users-bounces at lists.sourceforge.net [mailto:nagios-users-
> bounces at lists.sourceforge.net] On Behalf Of Antonio Pereira
> Sent: Wednesday, September 19, 2007 8:59 AM
> To: nagios-users at lists.sourceforge.net
> Subject: [Nagios-users] Email Notification
> 
> Hello,
> 


> Commands
> # 'notify-by-email' command definition
> define command{
> 	command_name	notify-by-email
> 	command_line	/usr/bin/printf "%b" "***** Nagios @VERSION@
> *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService:
> $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState:
> $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:
> \n\n$SERVICEOUTPUT$" | @MAIL_PROG@ -s "** $NOTIFICATIONTYPE$ alert -
> $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
> 	}
> # 'host-notify-by-email' command definition
> define command{
> 	command_name	host-notify-by-email
> 	command_line	/usr/bin/printf "%b" "***** Nagios @VERSION@
> *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost:
$HOSTNAME$\nState:
> 
> $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time:
> $LONGDATETIME$\n" | @MAIL_PROG@ -s "Host $HOSTSTATE$ alert for
> $HOSTNAME$!"
> $CONTACTEMAIL$
> 	}

Where did you pull these from? The command_line from your
notify-by-email command definition is something that nagios will run
from the shell, substituting appropriate $MACRO$ values. Note that you
have @VERSION@ and more importantly @MAIL_PROG@ values. Those are not
substituted by nagios at runtime and they make no sense to a shell (they
appear to be make variables). Try running '/usr/bin/printf "hello" |
@MAIL_PROG@ -s "test" you at address.com' to see.

@VERSION@ should be your nagios version and @MAIL_PROG@ should be the
full path to your mail executable (/bin/mail for example). The sample
config files will have automagically performed the substitutions for you
if you ran 'make install-config'.

--
marc

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
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