[PATCH] - 3.0.3: only send out a service recovery escalation if a service is recovering from a non-OK state listed in the escalation or only 'r' is specified as an escalation option

Max perldork at webwizarddesign.com
Sun Jul 19 14:13:14 CEST 2009


Hi,

We make heavy use of escalations in our Nagios installation; a
behavior of Nagios that was annoying some of our users was that if
they specified 'r' in an escalation they would receive recovery
notifications for services recovering from states that were not
mentioned in the escalation definition (escalation_options field).

Example:

define serviceescalation {
    hostgroup_name          nagios_hosts
    contact_groups          admins
    first_notification      1     ; notify right away (1st notification)
    last_notification       0     ; notify until service changes state
    notification_interval   240   ; default to 4 hour re-notify
    escalation_period       24x7
   service_description     .*
    escalation_options      c,r
    register                0
}

In this case we would receive recovery service escalations for
services returning to OK from WARNING when we never were sent a
WARNING escalation notification because it is not a state listed in
escalation_options.  With the patch a recovery is only sent if the
previous state of the service was CRITICAL and an escalation
notification had been sent out because the escalation rule had
previously matched on CRITICAL.

I have added code to

int is_valid_escalation_for_service_notification(service *svc,
serviceescalation *se, int options)

in notifications.c to add this logic:

If escalation is of type recovery:
* If the escalation rule does not specify recovery, return FALSE
(original logic)
* If the escalation rule specifies one or more problem states
** If this is the first hit on this escalation rule, return FALSE as
no escalation was sent previously for a problem with this rule
** If the previous problem state of the service matching the
escalation is NOT listed in the escalation, return FALSE as we did not
previously send out an problem escalation for the state this service
is recovering from

This also allows the user to specify JUST 'r' in the
escalation_options field and have the escalation rule work as expected
.. recovery notifications will be sent as they match the rule
irregardless of any previous problem states.

Our users have found this to be a very useful patch and have liked the
reduced number of recovery escalation notifications being sent out at
2 AM :p for services they never received a problem escalation
notification alert for.

Patched against Nagios 3.0.3.

I have done my best to have the style of the code conform to the
coding style used in the rest of the file; my apologies if I did not
get the style right.

- Max
-------------- next part --------------
A non-text attachment was scrubbed...
Name: notifications.c.patch
Type: application/octet-stream
Size: 1851 bytes
Desc: not available
URL: <https://www.monitoring-lists.org/archive/developers/attachments/20090719/fd3c6e2a/attachment.obj>
-------------- next part --------------
------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
-------------- 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