Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
Send HTML Alert Email v3
Version 3
2016-11-22
- Nagios 2.x
- Nagios 3.x
- Nagios 4.x
- Nagios XI
GPL
9958
File | Description |
---|---|
graph_auth.php | Graph Generating php file |
nagios_service_mail.php | Nagios Service eMail Generator |
nagios_host_mail.php | Nagios Host eMail Generator |
a_11.png | Thumbnail Icon |
template1.png | template1.png |
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!
Contains Useful Features Like ---
1) Performance Graphs
2) Total Downtime of the Service upon Recovery
3) 4 Colour Coordinated Alerts
4) Group & Email Information.
5) Low bandwidth usage when downloading hundreds/thousands of Alerts Emails.
6) Takes less than 10 minutes to setup.
Requires less than 10 minutes to fully setup. (Some Apache knowledge is required to set up the graph_auth.php)
Download the three .php files to the nagios/libexec/ folder and give them execution permission..
Open the three php files and check if the 1st line path/to/php and .ini files are correct
1) In the three .php files, change the $from email variable to a real name(Else your Email Server might Reject it / or SPAM it).
2) In the three .php files, change the $f_domain to your nagios webserver domain name.
3) In the "graph_auth.php", change the $login, $password, $f_domain to your nagios username & password. Also change the domain name to suit your nagios pnp4nagios path.
4) Copy the two png's and graph_auth.php to the "/var/www/html". The /graph_auth.php should be now accessible from the browser.. If its accessible with http://nagios.company.net/graph_auth.php?host=AWS-APP01&srv=UpTime, then your on the right path.
[Note: Do not put the graph_auth.php or a_11.png in the /usr/local/nagios/share/ as this folder requires the username/passwd when viewing]
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.php "$NOTIFICATIONTYPE$" "$HOSTNAME$" "$HOSTALIAS$" "$HOSTSTATE$" "$HOSTADDRESS$" "$SERVICEOUTPUT$" "$SHORTDATETIME$" "$SERVICEDESC$" "$SERVICESTATE$" "$CONTACTEMAIL$" "$SERVICEDURATIONSEC$" "$SERVICEEXECUTIONTIME$" "$TOTALSERVICESWARNING$" "$TOTALSERVICESCRITICAL$" "$TOTALSERVICESUNKNOWN$" "$NOTIFICATIONRECIPIENTS$" "$TOTALSERVICESOK$" "$SERVICENOTIFICATIONNUMBER$" "$SERVICEACKCOMMENT$" "$HOSTGROUPNAME$" "$SERVICEPERFDATA$"
}
Also replace the [notify-host-by-email] code block with the following block.
define command{
command_name notify-host-by-email
command_line /usr/local/nagios/libexec/nagios_host_mail.php "$NOTIFICATIONTYPE$" "$HOSTNAME$" "$HOSTALIAS$" "$HOSTSTATE$" "$HOSTADDRESS$" "$HOSTOUTPUT$" "$SHORTDATETIME$" "$SERVICEDESC$" "$SERVICESTATE$" "$CONTACTEMAIL$" "$TOTALHOSTSUP$" "$TOTALHOSTSDOWN$" "$HOSTGROUPNAME$" "$SERVICEPERFDATA$"
}
Check your nagios/libexec folder paths are accurate and save the "command.cfg" file.
In order to get the graph to render, we need to configure the Apache "httpd.conf" file. Go ahead and open the "/etc/httpd/conf/httpd.conf" and add an extra VirtualHost as follows. This is where we access the graph_auth.php. The graph_auth.php requests the /pnp4nagios/ graph with authorization, and renders it as a simple png.
ServerAdmin operations@mycompany.com
ServerName cmsnagios.company.com
ServerAlias cmsnagios.company.com
DocumentRoot "/var/www/html"
ErrorLog logs/nagios-error_log
The emails are sent using the PHP mail() function. A set of temporary files are written to the root level /tmp folder in order to determine the Total Downtime upon Service Recovery. Many MACROS are used in order to boost the Usable Data, hence I am not sure if it will work on Older Nagios v2.0.
---------------------------------------------------------------------------------
[Optional Bonus]: If you have CMSimple "Content Management" 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 CMSimple and create headings with Identical Names as the Service Name in Nagios. The dummy domain cmsnagios.company.com was used as the Nagios WebSite. The CMSimple was used to compliment the New Network Staff.
For example: In Nagios/ Server Win32 DOG7 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.
Let me know if you have any queries regarding the Email plugins.. Would love to hear from you..
Download the three .php files to the nagios/libexec/ folder and give them execution permission..
Open the three php files and check if the 1st line path/to/php and .ini files are correct
1) In the three .php files, change the $from email variable to a real name(Else your Email Server might Reject it / or SPAM it).
2) In the three .php files, change the $f_domain to your nagios webserver domain name.
3) In the "graph_auth.php", change the $login, $password, $f_domain to your nagios username & password. Also change the domain name to suit your nagios pnp4nagios path.
4) Copy the two png's and graph_auth.php to the "/var/www/html". The /graph_auth.php should be now accessible from the browser.. If its accessible with http://nagios.company.net/graph_auth.php?host=AWS-APP01&srv=UpTime, then your on the right path.
[Note: Do not put the graph_auth.php or a_11.png in the /usr/local/nagios/share/ as this folder requires the username/passwd when viewing]
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.php "$NOTIFICATIONTYPE$" "$HOSTNAME$" "$HOSTALIAS$" "$HOSTSTATE$" "$HOSTADDRESS$" "$SERVICEOUTPUT$" "$SHORTDATETIME$" "$SERVICEDESC$" "$SERVICESTATE$" "$CONTACTEMAIL$" "$SERVICEDURATIONSEC$" "$SERVICEEXECUTIONTIME$" "$TOTALSERVICESWARNING$" "$TOTALSERVICESCRITICAL$" "$TOTALSERVICESUNKNOWN$" "$NOTIFICATIONRECIPIENTS$" "$TOTALSERVICESOK$" "$SERVICENOTIFICATIONNUMBER$" "$SERVICEACKCOMMENT$" "$HOSTGROUPNAME$" "$SERVICEPERFDATA$"
}
Also replace the [notify-host-by-email] code block with the following block.
define command{
command_name notify-host-by-email
command_line /usr/local/nagios/libexec/nagios_host_mail.php "$NOTIFICATIONTYPE$" "$HOSTNAME$" "$HOSTALIAS$" "$HOSTSTATE$" "$HOSTADDRESS$" "$HOSTOUTPUT$" "$SHORTDATETIME$" "$SERVICEDESC$" "$SERVICESTATE$" "$CONTACTEMAIL$" "$TOTALHOSTSUP$" "$TOTALHOSTSDOWN$" "$HOSTGROUPNAME$" "$SERVICEPERFDATA$"
}
Check your nagios/libexec folder paths are accurate and save the "command.cfg" file.
In order to get the graph to render, we need to configure the Apache "httpd.conf" file. Go ahead and open the "/etc/httpd/conf/httpd.conf" and add an extra VirtualHost as follows. This is where we access the graph_auth.php. The graph_auth.php requests the /pnp4nagios/ graph with authorization, and renders it as a simple png.
ServerAdmin operations@mycompany.com
ServerName cmsnagios.company.com
ServerAlias cmsnagios.company.com
DocumentRoot "/var/www/html"
ErrorLog logs/nagios-error_log
The emails are sent using the PHP mail() function. A set of temporary files are written to the root level /tmp folder in order to determine the Total Downtime upon Service Recovery. Many MACROS are used in order to boost the Usable Data, hence I am not sure if it will work on Older Nagios v2.0.
---------------------------------------------------------------------------------
[Optional Bonus]: If you have CMSimple "Content Management" 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 CMSimple and create headings with Identical Names as the Service Name in Nagios. The dummy domain cmsnagios.company.com was used as the Nagios WebSite. The CMSimple was used to compliment the New Network Staff.
For example: In Nagios/ Server Win32 DOG7 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.
Let me know if you have any queries regarding the Email plugins.. Would love to hear from you..
Reviews (0)
Be the first to review this listing!