]> granicus.if.org Git - icinga2/commitdiff
Make sure that event handlers are run for hard recoveries
authorGunnar Beutner <gunnar.beutner@netways.de>
Tue, 22 Jul 2014 12:13:21 +0000 (14:13 +0200)
committerGunnar Beutner <gunnar.beutner@netways.de>
Tue, 22 Jul 2014 12:16:22 +0000 (14:16 +0200)
fixes #6686

lib/icinga/checkable-check.cpp

index 4efc0faa69b66eb8a77c87bfbdaf3f84269791dc..7ec2393c0efc03c6653358cab5ce47f72a196f66 100644 (file)
@@ -250,7 +250,7 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig
        ServiceState old_state = GetStateRaw();
        StateType old_stateType = GetStateType();
        long old_attempt = GetCheckAttempt();
-       bool recovery;
+       bool recovery = false;
 
        if (old_cr && cr->GetExecutionStart() < old_cr->GetExecutionStart())
                return;
@@ -264,7 +264,6 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig
        long attempt = 1;
 
        if (!old_cr) {
-               recovery = false;
                SetStateType(StateTypeHard);
        } else if (cr->GetState() == ServiceOK) {
                if (old_state == ServiceOK && old_stateType == StateTypeSoft) {
@@ -272,6 +271,9 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig
                        recovery = true;
                }
 
+               if (old_state != ServiceOK)
+                       recovery = true; // NOT OK -> SOFT/HARD OK
+
                ResetNotificationNumbers();
                SetLastStateOK(Utility::GetTime());
        } else {
@@ -284,8 +286,6 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig
                        attempt = old_attempt;
                }
 
-               recovery = false;
-
                switch (cr->GetState()) {
                        case ServiceOK:
                                /* Nothing to do here. */