Nagios: Trying to get scheduled downtime to send email

I had a problem today that is very typical with new software. I configured the email commands perfectly, so everyone was being provided with the proper information. The exception was when we placed a service in scheduled down time.

For those who are not familiar with Nagios, you can perform many tasks in relation to hosts and services. One of those tasks is scheduled downtime for a host or service. Scheduled downtime is great for several reasons:

  1. Scheduled downtime does not have to be completed at the time of maintenance. Say your organization has a weekly Change Management meeting and times are set for system outages. Well, immediately after the meeting you can schedule all the future, planned maintenance for the entire week.
  2. Scheduled downtime elliminates the need to actively re-initiate monitoring, because once the maintenance time has elapsed Nagios will actively start monitoring the host and service again.
  3. If the schedule maintence is shorter than the allocated time or is cancelled all together you can click on the “Downtime” menu item and delete the entry.

Now, to complete the package you need to enable email notifications so the host and service contacts are able to receive and notification when the scheduled downtime begins and ends.  If you already have contacts and the email notification command set up you can accomplish this with three easy steps:

  1. In addition to the other notifications under the contact section you want to add the “s” option. This enables the contact to receive email notification (or any other notification you have set up).
  2. Within the subject line of the email you want to add: “$NOTIFICATIONTYPE$” and “$SERVICEDOWNTIME$” to enable the scheduled maintenance macro.
  3. Reload Nagios. /etc/init.d/nagios reload.

To test the notification you want to schedule a 5 minute downtime for a services that you are a contact. I usually used a “fixed” time and change the time in the date-time fields. Add a comment, maybe “test” and press commit. When the service goes into maintenance you should receive an email with DOWNTIMESTART and when the 5 minutes has completed you should see another email with DOWNTIMEEND in the subject.

I hope that helps,

Mike Kniaziewicz, MIS

Comments are closed.