Build precise queries to find exactly what you need
Press ESC to close
Your review has been submitted and is pending approval.
Reliable and flexible way to do notifications to e-mail (via php-mail) without setup sendmail or postfix. You can turn off sendmail or postfix.
Current Version
1.0
Last Release Date
2016-09-14
Owner
Yury
Compatible With
PHP scripts and README.
Reliable and flexible way to do notifications to e-mail (via php-mail) without setup sendmail or postfix. 1. You can use different mailboxes and mail servers to notify different recipients. Just specify it in nagios templates (see below in Setup part). 2. You need only one script (nagios_mail2) to send messages as for hosts and for services. 3. Embeded links to nagios GUI for hosts and services (see screenshot). 4. Embeded field with Service or Host Notes (Visible if not empty). 5. Embeded pnp4nagios graph (Visible if exist for given service). 6. Successful and failed attempts log in /usr/local/nagios/var.
Setup: 1. Download attached zip. It contains 3 files: class.phpmailer.php, class.smtp.php and nagios_mail2.
2. Extract archive and put these files to /usr/local/nagios/sbin (or where you want).
3. Give execute rights to nagios_mail2: # chmod +x /usr/local/nagios/sbin/nagios_mail2 # chown nagios:nagios /usr/local/nagios/sbin/nagios_mail2
4. Go to your commands.cfg and define command as I did: define command{ command_name notify-service-by-email-bs command_line /usr/local/nagios/sbin/nagios_mail2 "SERVICE" "nagios.mydomain.by:80" "[email protected]" "smtp.mydomain.by" "587" "mailpw" "tls" "Nagios" "$NOTIFICATIONTYPE$" "$HOSTNAME$" "$HOSTALIAS$" "$HOSTSTATE$" "$HOSTADDRESS$" "$SERVICEOUTPUT$" "$SHORTDATETIME$" "$SERVICEDESC$" "$SERVICESTATE$" "$SERVICENOTES$" "$NOTIFICATIONRECIPIENTS$" "$SERVICEACTIONURL$" "$CONTACTEMAIL$" }
define command{ command_name notify-host-by-email-bs command_line /usr/local/nagios/sbin/nagios_mail2 "HOST" "nagios.mydomain.by:80" "[email protected]" "smtp.mydomain.by" "587" "mailpw" "tls" "Nagios" "$NOTIFICATIONTYPE$" "$HOSTNAME$" "$HOSTALIAS$" "$HOSTSTATE$" "$HOSTADDRESS$" "$HOSTOUTPUT$" "$SHORTDATETIME$" "$HOSTNOTES$" "$NOTIFICATIONRECIPIENTS$" "$CONTACTEMAIL$" }
------------------------- Arguments description: "HOST"/"SERVICE" - mark for script nagios_mail2 to recognize which section use when building the message. "nagios.mydomain.by:80" - URL to nagios GUI. "[email protected]" - From address. "smtp.mydomain.by" - SMTP server. "587" - SMTP port. "mailpw" - specify your mail password here. "tls"/"notls" - mark for script nagios_mail2 to recognize whether to use TLS or not. "Nagios" - Name of sender (see screenshot). -------------------------
5. Go to your templates.cfg and specify configured above commands to needed contact-template. Example: define contact{ name generic-contact-bs use generic-contact service_notification_commands notify-service-by-email-bs host_notification_commands notify-host-by-email-bs register 0 }
6. Finally specify the contact template for needed contact in contacts.cfg. Example: define contact{ contact_name nagiosadmin use generic-contact-bs alias Nagios Admin email [email protected] }
Check and Apply new configuration. Now try to send notification (CUSTOM for example) and see under /usr/local/nagios/log for log messages.
Hope it will be usefull for somebody.
You must be logged in to submit a review.
To:
From: