Nagios Mail from field

Thomas Stocking tstocking at insynccom.com
Sat Apr 19 00:10:38 CEST 2003


Check the misccommands.cfg. In there you will see an entry like this:
command_line	/usr/bin/printf "%b" "***** Nagios 1.0b6 *****\n\nNotification
Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress:
$HOSTADDRESS$\nInfo: $OUTPUT$\n\nDate/Time: $DATETIME$\n" | /bin/mail -s
"Host $HOSTSTATE$ alert for $HOSTNAME$!" $CONTACTEMAIL$

The printf output is being piped to /bin/mail. In my world, I do not use
/bin/mail for this. A much more flexible (and also free) program called
sendEmail (http://caspian.dotconf.net/menu/Software/SendEmail/) allows this
sort of thing on the command line, e.g. for a service failure:

	command_line	/usr/local/nagios/libexec/sendEmail -f
nagioshost at mydomain.com -t $CONTACTEMAIL$ -u "Alert - $HOSTALIAS$
$SERVICESTATE$ $NOTIFICATIONTYPE$" -m "ATTENTION REQUIRED: Service:
$SERVICEDESC$ Host: $HOSTALIAS$ Address: $HOSTADDRESS$ State: $SERVICESTATE$
Date/Time: $DATETIME$ Additional Info: $OUTPUT$"
	}

So you see you can get as fancy as you want....

Thomas Stocking, GCIA, GCIH
Captech Partners
thomas at captech.com
http://www.captech.com
(415) 507-9267



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
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