]> granicus.if.org Git - icinga2/commitdiff
Don't increment check attempt counter on OK->NOT-OK transition
authorMichael Friedrich <michael.friedrich@gmail.com>
Fri, 20 Feb 2015 20:30:14 +0000 (21:30 +0100)
committerMichael Friedrich <michael.friedrich@netways.de>
Wed, 11 Mar 2015 15:33:36 +0000 (16:33 +0100)
refs #7287

Signed-off-by: Michael Friedrich <michael.friedrich@netways.de>
lib/icinga/checkable-check.cpp

index a4da0c31dadfd7f96a21987634bb94f079f75b42..0688e93fbaac48bd5800f07b926c8ef11c070556 100644 (file)
@@ -338,9 +338,12 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig
        } else {
                if (old_attempt >= GetMaxCheckAttempts()) {
                        SetStateType(StateTypeHard);
-               } else if (old_stateType == StateTypeSoft || old_state == ServiceOK) {
+               } else if (old_stateType == StateTypeSoft && old_state != ServiceOK) {
                        SetStateType(StateTypeSoft);
-                       attempt = old_attempt + 1;
+                       attempt = old_attempt + 1; //NOT-OK -> NOT-OK counter
+               } else if (old_state == ServiceOK) {
+                       SetStateType(StateTypeSoft);
+                       attempt = 1; //OK -> NOT-OK transition, reset the counter
                } else {
                        attempt = old_attempt;
                }