Patch: send html notification with dynamic hyperlinks to Nagios pages

Creator creator at mindcreations.com
Wed Nov 5 23:21:31 CET 2003


Overview
--------

Add to Nagios notify commands the capability to send HTML email messages
with url encoded hostnames and servicedescs.

This patch makes possible to send HTML notifications with clickable dynamic
links to quickly access the pages with details about the problem Nagios is
reporting. 
Very useful for large installations or smart help desks :)

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.


Patch it
--------

To make all of this working you have to:

1) Apply the patch
 
cd <your nagios source dir>/base
patch utils.c <your patch path>/htmlmail.diff
make;strip nagios;cp nagios <your nagios installed dir>/bin
 
Now set <your nagios installed dir>/bin/nagios permissions as those of the
other files in that dir and you have finished.

2) Replace the commands in the attached misccommands.cfg with the same
commands in your misccommands.cfg and replace the http://nagiosbox string
with the one identifying your Nagios server. I've used sendmail to send
emails but you can replace the "/usr/sbin/sendmail -t" command with your
favorite mailer.

Note for NAGAT users: the edit textarea to change misccommands.cfg entries
is stripping "\" characters. Beware of this and edit this file by hand
rather than with Nagat or you will not receive any email. I'm not aware of
problems with other web interfaces because I've not tested them. I suggest
you to edit this file by hand.

You'll note that there are two new fields that Nagios does not provide:
$ENCODEDHOSTNAME$ and $ENCODEDSERVICEDESC$.
The patch code adds the two new fields to those available in Nagios.

3) Restart Nagios by issuing a STOP and a START command (not RELOAD).
Wait for the next emails and enjoy :)

Nagios it (for Ethan)
---------------------

I think this would be a good cosmetic feature for notifications in Nagios
v2.0.
I'm sorry but I had no time to implement it against v2.0 CVS, I hope this is
not a problem to merge this code into 2.0.

 
FINAL NOTE: The only annoying thing to care about is that images are not
displayed properly if you have implemented secure access to Nagios site and
you are not logged in before reading the email. If you don't care about this
I suggest you to strip images from the email code.

------------

Stefano Coletta
http://www.mindcreations.com 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: htmlmail.diff
Type: application/octet-stream
Size: 2626 bytes
Desc: not available
URL: <https://www.monitoring-lists.org/archive/developers/attachments/20031105/cb952996/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: misccommands.cfg
Type: application/octet-stream
Size: 2289 bytes
Desc: not available
URL: <https://www.monitoring-lists.org/archive/developers/attachments/20031105/cb952996/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: htmlmail.gif
Type: image/gif
Size: 48545 bytes
Desc: not available
URL: <https://www.monitoring-lists.org/archive/developers/attachments/20031105/cb952996/attachment.gif>


More information about the Developers mailing list