Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
Responsive HTML Email Notifications Templates for Nagios
2.1.1 (1011)
2017-08-17
- Nagios 3.x
- Nagios 4.x
- Nagios XI
- Nagios Fusion
18267
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!
Responsive HTML Email Notifications Templates for Nagios
Go to GitHub link above, to get the files.
Here are two php built scripts, one for sending Host Notifications and one for sending Service Notifications, as Responsive HTML email messages from your Nagios server.
Copyrights
Copyright (©) 2017 Heini Holm Andersen hhan@mail.fo
Installation:
* Copy the php-html-email folder to the Nagios plugins directory (usually named 'libexec') and make sure all files are owned by the user nagios uses and also that all files are made executable by the nagios user!
Then configure Nagios.
Nagios Configuration:
* For the host and services notification alerts, add these lines to your Nagios commands file (usually located in the Nagios configurations directory and named 'objects') as command definitions:
# 'notify-host-by-email-html' command definition
define command {
command_name notify-host-by-email-html
command_line $USER1$/php-html-email/nagios_host_mail "$NOTIFICATIONTYPE$" "$HOSTNAME$" "$HOSTALIAS$" "$HOSTSTATE$" "$HOSTADDRESS$" "$HOSTOUTPUT$" "$SHORTDATETIME$" "$CONTACTEMAIL$" "$TOTALHOSTSUP$" "$TOTALHOSTSDOWN$" "$NOTIFICATIONAUTHOR$" "$NOTIFICATIONCOMMENT$" "$LONGDATETIME$" "$HOSTDURATION$" "$HOSTDURATIONSEC$" "$LASTHOSTCHECK$" "$LASTHOSTSTATECHANGE$" "$NOTIFICATIONISESCALATED$" "$HOSTATTEMPT$" "$MAXHOSTATTEMPTS$"
}
# 'notify-service-by-email-html' command definition
define command {
command_name notify-service-by-email-html
command_line $USER1$/php-html-email/nagios_service_mail "$NOTIFICATIONTYPE$" "$HOSTNAME$" "$HOSTALIAS$" "$HOSTSTATE$" "$HOSTADDRESS$" "$SERVICEOUTPUT$" "$SHORTDATETIME$" "$SERVICEDESC$" "$SERVICESTATE$" "$CONTACTEMAIL$" "$SERVICEDURATIONSEC$" "$SERVICEEXECUTIONTIME$" "$TOTALSERVICESWARNING$" "$TOTALSERVICESCRITICAL$" "$TOTALSERVICESUNKNOWN$" "$LASTSERVICEOK$" "$LASTSERVICEWARNING$" "$SERVICENOTIFICATIONNUMBER$" "$LONGSERVICEOUTPUT$" "$NOTIFICATIONAUTHOR$" "$NOTIFICATIONCOMMENT$" "$SERVICEDURATION$" "$NOTIFICATIONISESCALATED$" "$SERVICEATTEMPT$" "$MAXSERVICEATTEMPTS$"
}
* Now that the command object has been configured, you must tell your contacts to use this new command. I have a generic-contact template that all of my individual contacts inherit from, thus I only have to update the template to use the new command, like seen here below:
define contact{
name generic-contact
register 0
service_notification_commands notify-service-by-email-html
host_notification_commands notify-host-by-email-html
Restart Nagios to pick up the changes.
Go to GitHub link above, to get the files.
Here are two php built scripts, one for sending Host Notifications and one for sending Service Notifications, as Responsive HTML email messages from your Nagios server.
Copyrights
Copyright (©) 2017 Heini Holm Andersen hhan@mail.fo
Installation:
* Copy the php-html-email folder to the Nagios plugins directory (usually named 'libexec') and make sure all files are owned by the user nagios uses and also that all files are made executable by the nagios user!
Then configure Nagios.
Nagios Configuration:
* For the host and services notification alerts, add these lines to your Nagios commands file (usually located in the Nagios configurations directory and named 'objects') as command definitions:
# 'notify-host-by-email-html' command definition
define command {
command_name notify-host-by-email-html
command_line $USER1$/php-html-email/nagios_host_mail "$NOTIFICATIONTYPE$" "$HOSTNAME$" "$HOSTALIAS$" "$HOSTSTATE$" "$HOSTADDRESS$" "$HOSTOUTPUT$" "$SHORTDATETIME$" "$CONTACTEMAIL$" "$TOTALHOSTSUP$" "$TOTALHOSTSDOWN$" "$NOTIFICATIONAUTHOR$" "$NOTIFICATIONCOMMENT$" "$LONGDATETIME$" "$HOSTDURATION$" "$HOSTDURATIONSEC$" "$LASTHOSTCHECK$" "$LASTHOSTSTATECHANGE$" "$NOTIFICATIONISESCALATED$" "$HOSTATTEMPT$" "$MAXHOSTATTEMPTS$"
}
# 'notify-service-by-email-html' command definition
define command {
command_name notify-service-by-email-html
command_line $USER1$/php-html-email/nagios_service_mail "$NOTIFICATIONTYPE$" "$HOSTNAME$" "$HOSTALIAS$" "$HOSTSTATE$" "$HOSTADDRESS$" "$SERVICEOUTPUT$" "$SHORTDATETIME$" "$SERVICEDESC$" "$SERVICESTATE$" "$CONTACTEMAIL$" "$SERVICEDURATIONSEC$" "$SERVICEEXECUTIONTIME$" "$TOTALSERVICESWARNING$" "$TOTALSERVICESCRITICAL$" "$TOTALSERVICESUNKNOWN$" "$LASTSERVICEOK$" "$LASTSERVICEWARNING$" "$SERVICENOTIFICATIONNUMBER$" "$LONGSERVICEOUTPUT$" "$NOTIFICATIONAUTHOR$" "$NOTIFICATIONCOMMENT$" "$SERVICEDURATION$" "$NOTIFICATIONISESCALATED$" "$SERVICEATTEMPT$" "$MAXSERVICEATTEMPTS$"
}
* Now that the command object has been configured, you must tell your contacts to use this new command. I have a generic-contact template that all of my individual contacts inherit from, thus I only have to update the template to use the new command, like seen here below:
define contact{
name generic-contact
register 0
service_notification_commands notify-service-by-email-html
host_notification_commands notify-host-by-email-html
Restart Nagios to pick up the changes.
Reviews (2)
bynishith, June 17, 2021
The said plugin is working properly. No need to make more efforts.
Just follow the instructions given & you're good to go.
Just follow the instructions given & you're good to go.
bySorianoTech, September 8, 2020
I just modify the path of my plugin in the definition commands.
$USER1$/php-html-email/nagios_host_mail
for this one...
command_line /opt/Custom-Nagios-Plugins/php-html-email/nagios_host_mail
Thanks
$USER1$/php-html-email/nagios_host_mail
for this one...
command_line /opt/Custom-Nagios-Plugins/php-html-email/nagios_host_mail
Thanks