different escalation intervals possible?

Paul M. Dubuc work at paul.dubuc.org
Mon Jul 18 19:49:05 CEST 2011


Michael Barrett wrote:
> Hi - I am trying to get alerts for my services to work like this:
>
> - all alerts (warning, critical, unknown, and recovery) go to the
> 'email-ops' contact every 2 hours - on some services (the ones deemed
> critical) in addition I want them to send an email to the 'primary-pager'
> contact every 15 minutes
>
> I thought I had the configuration setup appropriately for this, but now I'm
> not sure it's possible without a better understanding of how escalations
> work (and it may not even be possible then) since I read this about
> overlapping escalations:
>
> "Since it is possible to have overlapping escalation definitions for a
> particular hostgroup or service, and the fact that a host can be a member
> of multiple hostgroups, Nagios has to make a decision on what to do as far
> as the notification interval is concerned when escalation definitions
> overlap. In any case where there are multiple valid escalation definitions
> for a particular notification, Nagios will choose the smallest notification
> interval."
>
> Anyway, is there anyway to make that work?  The way its working now is that
> it seems to email the email-ops list every 15 minutes on critical services,
> and for email we'd like to get less alerts.
>
> Thanks in advance!
>

I don't think this can be done with escalations.  If Assaf has a way to do it, 
I'd be very interested.  Like the documentation says, any notification that 
matches multiple escalations can only have one notification interval and it 
chooses the smallest.  The way we get around the problem is to put a wrapper 
around the email notification command so that it only sends the first 
notification of a state change.  This is what it looks like:

define command{
         command_name    notify-host-by-email
         command_line    \
             if [ $HOSTNOTIFICATIONNUMBER$ -le 1 -o $HOSTSTATEID$ -ne 
$LASTHOSTSTATEID$ ]$USER9$ then \
                 /usr/bin/printf "%b\n\n--" \
                     "***** Nagios *****\n\n\
Notification Type: $NOTIFICATIONTYPE$  Number: $HOSTNOTIFICATIONNUMBER$\n\n\
host=$HOSTNAME$\n\n\
Host: $HOSTNAME$\n\
Address: $HOSTADDRESS$\n\
State: $HOSTSTATE$\n\
Last State: $LASTHOSTSTATE$\n\
Info: $HOSTOUTPUT$\n\n\
$LONGHOSTOUTPUT$\n\n\
Date/Time: $LONGDATETIME$\n\n\
Comment: $NOTIFICATIONCOMMENT$" \
                 | /usr/bin/mail -r nagios -s \
                     "** Nagios $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is 
$HOSTSTATE$ **" $CONTACTEMAIL$ \
             $USER9$\
             fi
         }

The $USER9$ macro is defined as a semicolon ';' to keep it from being 
interpreted as the start of a comment. The command for service e-mail 
notifications looks similar.  So, for e-mail notifications, it doesn't matter 
what the interval is.  Only one e-mail will actually be sent per state change.

------------------------------------------------------------------------------
AppSumo Presents a FREE Video for the SourceForge Community by Eric 
Ries, the creator of the Lean Startup Methodology on "Lean Startup 
Secrets Revealed." This video shows you how to validate your ideas, 
optimize your ideas and identify your business strategy.
http://p.sf.net/sfu/appsumosfdev2dev
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list