[PATCH] Service escalations and negated service descriptions

Tim Wilde tim at krellis.org
Mon Oct 5 17:20:05 CEST 2009


Good morning everyone!

We have run into an interesting situation trying to set up some service
escalations, and I BELIEVE the attached patch is an appropriate general
fix, but would appreciate any comments or additional thoughts.  First,
an explanation of what I'm trying to do:

I would like to have service escalations defined for all services except
"NTP Time Offset" on all hosts not in the "gtpods" hostgroup.  To
accomplish this, I had defined my service escalation as follows:

define serviceescalation {
        host_name               *
        hostgroup_name          !gtpods
        service_description     *,!NTP Time Offset
        first_notification      1
        last_notification       5
        notification_interval   10
        contact_groups          admins,oncall
}

Under stock Nagios 3.2.0, this fails with the following error, because
not all hosts have an "NTP Time Offset" service defined:

Error: Could not find a service matching host name 'servXX' and
description 'NTP Time Offset' (config file
'/usr/local/nagios-3.2.0/etc/objects/escalations.cfg', starting on line 62)
Error: Could not expand services specified in service escalation (config
file '/usr/local/nagios-3.2.0/etc/objects/escalations.cfg', starting on
line 62)
   Error processing object config files!

As the code stands today, when expanding service escalations, if a
negated service is not attached to the host in question, it returns this
error.  But in my opinion, a negated service that would wind up on the
reject list can just be silently ignored when it doesn't exist on a
host, because the behavior is identical, and in fact more intuitive to
the configuration writer.

The attached patch simply adds a check of reject_item to two
conditionals within xodtemplate_expand_services, which I believe should
make this work in the way that I perceive as intuitive without
compromising any other configuration scenarios.  I have tested my
specific scenario and the configuration is built as I would expect and
intend.  I'm happy to receive any feedback, thoughts on better ways to
accomplish this, etc!

Thanks,
Tim Wilde
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: xodtemplate.c.patch
URL: <https://www.monitoring-lists.org/archive/developers/attachments/20091005/5a6bc2ca/attachment.ksh>
-------------- next part --------------
------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
-------------- next part --------------
_______________________________________________
Nagios-devel mailing list
Nagios-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-devel


More information about the Developers mailing list