Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have Nagios checking service status and sending SMS messages about service status.

Some problems are not important at night and prefer to not send them at night.

define timeperiod{
    timeperiod_name non_work
    alias       Non work hours
    sunday      00:00-24:00
    monday      00:00-09:00,18:00-24:00
    tuesday     00:00-09:00,18:00-24:00
    wednesday   00:00-09:00,18:00-24:00
    thursday    00:00-09:00,18:00-24:00
    friday      00:00-09:00,18:00-24:00
    saturday    00:00-24:00
}

However, in the morning I would like that all the problems, not just new would be sent. How can I configure that?

Or nagios do not have this functions?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

Some problems are not important at night

As you suggest, Nagios lets you configure time periods which you can then apply to the checks, the notifications, the notifcation groups and individual users. Of course if you specify that the checks are to take place but no notification sent, then you won't see the problem in your email but you can look at the complete alert history at any time in the Nagios web pages. Why not schedule a cron job to email you the overnight alerts first thing in the morning? e.g.

0 8 * * * wget -O /tmp/nagios.html -i /home/user/nagioslist; mail user@example.com </tmp/nagios.html

Where /home/user/nagioslist contains something like:

http://example.com/nagios/cgi-bin/summary.cgi?report=1&displaytype=1
   &timeperiod=last24hours&hostgroup=all&servicegroup=all&host=all&alerttypes=3
   &statetypes=2&hoststates=7&servicestates=120&limit=1000

(this would display up to 1000 hard states detected in the last24hours)

OTOH you could set up a different notification script to run for the notifications you want to defer and simply place them in a queue to be sent later (e.g. using 'at').

Or you could set up the MTA to process its outgoing mailq only at specific intervals - combined with different email addresses / different subjects then you can effectively prioritise/defer mail based on the recipient / subject / time of day.

share|improve this answer

I am not sure if nagios doesn't do this per default. You would just need to reverse your notification timeperiod so it just includes working hours instead of non-working hours.

It's easy to test this: Just define yourself a check that fails per default, an accordingly set notification time period, beginning a few minutes after the current time and see if you get messages only when in this period.

Should this not work, you could try to toy around with escalation schemes, sending out mails in the night and sms during your working hours period, with the help of the escalation_period statement.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.