Home Directory Plugins Others Send HTML Alert Email

Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

Directory Tree

Send HTML Alert Email

Rating
3 votes
Favoured:
0
Current Version
0.1
Last Release Date
2011-12-04
Compatible With
  • Nagios 1.x
  • Nagios 2.x
  • Nagios 3.x
  • Nagios XI
License
GPL
Hits
91277
Files:
FileDescription
nagios_service_mail.phpThis php file sends HTML Service Related Alerts
nagios_host_mail.phpThis php file sends HTML Host Related Alerts
Nagios CSP

Meet The New Nagios Core Services Platform

Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.

Monitoring Made Magically Better

  • Nagios Core on Overdrive
  • Powerful Monitoring Dashboards
  • Time-Saving Configuration Wizards
  • Open Source Powered Monitoring On Steroids
  • And So Much More!
Send HTML Alert Email
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 :)
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)
byjnash, January 15, 2012
1 of 1 people found this review helpful
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