Others

Send HTML Alert Email

Description:

Send your Alert Mails using HTML formatted emails.. Requires less than 5 minutes to fully setup.. This is version 1 of the HTML Mail Alert… I have released a version 2 of the HTML Alert Mail which takes advantage of many MACROS.. It also looks nicer 🙂

Current Version

0.1

Last Release Date

2011-12-04

Compatible With

  • Nagios 1.x
  • Nagios 2.x
  • Nagios 3.x
  • Nagios XI

Owner

License

GPL


Project Files
Project Photos
Project Notes
Download the following .php files to the nagios/libexec/ folder and give them execution permission.. Open the .php files and check if the 1st line path/to/php and .ini files are correct, Also change the $from email variable to something more meaningful and real (Else your Email Server might Reject it)... Now rename both .php files so they dont have the .php extension (it looks better this way :-) ) Now edit the nagios/etc/objects/command.cfg and replace the [notify-service-by-email] block with the following Block... define command{ command_name notify-service-by-email command_line /usr/local/nagios/libexec/nagios_service_mail "$NOTIFICATIONTYPE$" "$HOSTNAME$" "$HOSTALIAS$" "$HOSTSTATE$" "$HOSTADDRESS$" "$SERVICEOUTPUT$" "$LONGDATETIME$" "$SERVICEDESC$" "$SERVICESTATE$" "$CONTACTEMAIL$" "$SERVICEDURATIONSEC$" "$SERVICEDOWNTIME$" "$TOTALSERVICESWARNING$" "$TOTALSERVICESCRITICAL$" "$TOTALSERVICESUNKNOWN$" } Also replace the [notify-host-by-email] code block with this block below... define command{ command_name notify-host-by-email command_line /usr/local/nagios/libexec/nagios_host_mail "$NOTIFICATIONTYPE$" "$HOSTNAME$" "$HOSTALIAS$" "$HOSTSTATE$" "$HOSTADDRESS$" "$HOSTOUTPUT$" "$LONGDATETIME$" "$SERVICEDESC$" "$SERVICESTATE$" "$CONTACTEMAIL$" "$TOTALHOSTSUP$" "$TOTALHOSTSDOWN$" } (Check if the nagios/libexec folder paths are accurate before restarting)... Save the command.cfg file and restart Nagios Service... The emails are sent using the PHP mail() function... [Optional Bonus]: If you have SimpleCMS installed, you can create a custom link which Network Staff can click and get the details of every single Service Type and Description... In order to do this, you will need to install the simplecms and create headings with Identical Names as the Service Name in Nagios.. For example: In Nagios/ Server DEPT005 has a service name cpu_load (which describes the CPU), create a CMS heading cpu_load and write a detailed description about it.. You may email me for further descriptions on CMS Manipulations...
Reviews (1) Add a Review
Good/Quick starting framework for PHP Mail
by jnash, January 31, 2012

Works well to get HTML Notifications out via a PHP Script and is certainly better than the default text output. Can be a good starting point for more advanced notifications such as querying a DB and including information such as impact of alert and recommended actions. -John



Add a Review

You must be logged in to submit a review.

Thank you for your review!

Your review has been submitted and is pending approval.

Recommend

To:


From:


Thank you for your recommendation!

Your recommendation has been sent.

Project Stats
Rating
3.7 (3)
Favorites
0
Views
91,162