Re: [Nagios-devel] RFC: Proposal for a new patch before releasing of v2.0 (to be included)
Posted: Wed Nov 05, 2003 10:15 pm
It would seem wiser to simply pass the host name and service
description macros as arguments to a notification script. The script
could then url encode them before sending them out in an email
message.
On 5 Nov 2003 at 10:23, Stefano Coletta wrote:
> 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$ href=\"/cgi-bin/avail.cgi?host=$ENCODEDHOSTNAME$&show_log_entries\"> mg src=\"/images/trends.gif\" border=\"0\" alt=\"Command\"> Show
> availability report href=\"/cgi-bin/extinfo.cgi?type=2&host=$ENCODEDHOSTNAME$&service=$ENC
> ODEDSERVICEDESC$\"> alt=\"Command\"> Show service details href=\"/cgi-bin/statusmap.cgi?layout=1&host=$ENCODEDHOSTNAME$\"> src=\"/images/status3.gif\" border=\"0\" alt=\"Command\"> Locate on
> Map src=\"/images/status2.gif\" border=\"0\" alt=\"Command\"> 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$ href=\"/cgi-bin/avail.cgi?host=$ENCODEDHOSTNAME$&show_log_entries\"> mg src=\"/images/trends.gif\" border=\"0\" alt=\"Command\"> Show
> availability report href=\"/cgi-bin/extinfo.cgi?type=1&host=$ENCODEDHOSTNAME$\"> src=\"/images/status2.gif\" border=\"0\" alt=\"Command\"> Show host
> details href=\"/cgi-bin/statusmap.cgi?layout=1&host=$ENCODEDHOSTNAME$\"> src=\"/images/status3.gif\" border=\"0\" alt=\"Command\"> Locate on
> Map src=\"/images/status2.gif\" border=\"0\" alt=\"Command\"> 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
>
>
Ethan Galstad,
Nagios Developer
---
Email: [email protected]
Website: http://www.nagios.org
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
description macros as arguments to a notification script. The script
could then url encode them before sending them out in an email
message.
On 5 Nov 2003 at 10:23, Stefano Coletta wrote:
> 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$ href=\"/cgi-bin/avail.cgi?host=$ENCODEDHOSTNAME$&show_log_entries\"> mg src=\"/images/trends.gif\" border=\"0\" alt=\"Command\"> Show
> availability report href=\"/cgi-bin/extinfo.cgi?type=2&host=$ENCODEDHOSTNAME$&service=$ENC
> ODEDSERVICEDESC$\"> alt=\"Command\"> Show service details href=\"/cgi-bin/statusmap.cgi?layout=1&host=$ENCODEDHOSTNAME$\"> src=\"/images/status3.gif\" border=\"0\" alt=\"Command\"> Locate on
> Map src=\"/images/status2.gif\" border=\"0\" alt=\"Command\"> 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$ href=\"/cgi-bin/avail.cgi?host=$ENCODEDHOSTNAME$&show_log_entries\"> mg src=\"/images/trends.gif\" border=\"0\" alt=\"Command\"> Show
> availability report href=\"/cgi-bin/extinfo.cgi?type=1&host=$ENCODEDHOSTNAME$\"> src=\"/images/status2.gif\" border=\"0\" alt=\"Command\"> Show host
> details href=\"/cgi-bin/statusmap.cgi?layout=1&host=$ENCODEDHOSTNAME$\"> src=\"/images/status3.gif\" border=\"0\" alt=\"Command\"> Locate on
> Map src=\"/images/status2.gif\" border=\"0\" alt=\"Command\"> 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
>
>
Ethan Galstad,
Nagios Developer
---
Email: [email protected]
Website: http://www.nagios.org
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]