This is a multi-part message in MIME format.
--------------080707000302010707080500
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Hello,
I've patched Nagios to add support for HTML email with urlencoded
parameters.
You can find a screenshot as attachment where it is shown the final
result from user point of view. The four links in the screenshot will
point to the appropriate pages.
Here are the new commands to send emails:
define command {
command_name notify-by-email
command_line /usr/bin/printf "%b" "To:
$CONTACTEMAIL$\r\nMime-Version: 1.0\r\nContent-Type:
text/html\r\nContent-Base: http://nagiosbox\r\nSubject: $SERVICESTATE$
alert for $HOSTALIAS$/$SERVICEDESC$\x21\r\n\r\n***** Nagios 1.1
*****Notification Type: $NOTIFICATIONTYPE$Host:
$HOSTNAME$Service: $SERVICEDESC$State:
$SERVICESTATE$Address: $HOSTADDRESS$Info:
$OUTPUT$Date/Time: $DATETIME$ Show
availability report Show service
details Locate on
Map Show
services" | /usr/sbin/sendmail -t
}
define command {
command_name host-notify-by-email
command_line /usr/bin/printf "%b" "To:
$CONTACTEMAIL$\r\nMime-Version: 1.0\r\nContent-Type:
text/html\r\nContent-Base: http://nagiosbox\r\nSubject: Host $HOSTSTATE$
alert for $HOSTNAME$\x21\r\n\r\n***** Nagios 1.1
*****Notification Type: $NOTIFICATIONTYPE$Host:
$HOSTNAME$State: $HOSTSTATE$Address: $HOSTADDRESS$Info:
$OUTPUT$Date/Time: $DATETIME$ Show
availability report Show host
details Locate on
Map Show
services" | /usr/sbin/sendmail -t
}
As you can note there are two new fields that Nagios does not provide:
$ENCODEDHOSTNAME$ and $ENCODEDSERVICEDESC$.
To make it work for your installation you have to replace the
http://nagiosbox string with the one identifying your Nagios server.
I've also used sendmail to send emails but you can replace the
"/usr/sbin/sendmail -t" command with your favorite mailer.
The patch adds the two new fields to those available in Nagios.
I'll send the diff code shortly.
--
Stefano Coletta
http://www.mindcreations.com
--------------080707000302010707080500
Content-Type: image/gif;
name="htmlmail.gif"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename="htmlmail.gif"
R0lGODlhAAQAA4cAAAAAAAMOHxQNBhkRCBgXFgAAJAkSJRMbJhUeNRsiLhckOBsyPCAYDyQc
FCggFzAnHyIlLSUrNiw0OTIqIjozKzo4NhEUSAUSeRInTg00dSoqVSw4Rio8UzI2QiU/dSBC
AStBIjZkIxRAbCxCTTpBTjdFVTxTXi5IZyVMdzNHZDlMdDJSeEI7NHElEWcpKUlEIEhCPEBp
H1N3L3xuHExHQkhOXE5SWlJMRVhRS1pXVEFOYkxbaEdccVNdZFxhbmNdV2ljXWRnamNueWhx
enJsZ3ZxbHd1cwkXhAAZtAsyjAUzsSk1kyc/owAczgAA7gA40AE56hJOlBBIth5gpC1ZhzhD
mjVZhDVOrTNgizlkliNlqjloqj1tsT51tAFFzwBW6AZh3wJn+idbziNc4TJp1jN2wDJ60S5v
8kZUpUFjlFhvjl9wgkBvskd1qkR2uVdgqVZms1V/qmN1hmR9lnh9gW92sUNu0U19wkR63FRx
xEZ69WN9yQCAAAD/AGiWPmq5GhuC/zuAyzqF2jSP/1CDt2iHimqBmHmBi3iIlnuVm26HoHaN
pXqTq36XsH+qqkSDzESI1lSExVKA3UGH5keD90qU6UGY/1CL71aF9lKb
...[email truncated]...
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]