]> granicus.if.org Git - icinga2/commitdiff
Fix: Volatile check results for OK->OK transitions are logged into DB IDO statehistory
authorMichael Friedrich <michael.friedrich@netways.de>
Sat, 21 May 2016 11:41:43 +0000 (13:41 +0200)
committerMichael Friedrich <michael.friedrich@netways.de>
Sat, 21 May 2016 11:41:43 +0000 (13:41 +0200)
fixes #11823

lib/icinga/checkable-check.cpp

index 165fd56f7334a0e7649d76d22b388c81a7a4362f..d4cad9052ef9e579b41f129b693171ee3ee88aae 100644 (file)
@@ -355,7 +355,8 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig
        String old_state_str = (service ? Service::StateToString(old_state) : Host::StateToString(Host::CalculateState(old_state)));
        String new_state_str = (service ? Service::StateToString(new_state) : Host::StateToString(Host::CalculateState(new_state)));
 
-       if (hardChange || is_volatile) {
+       /* Whether a hard state change or a volatile state change except OK -> OK happened. */
+       if (hardChange || is_volatile && !(IsStateOK(old_state) && IsStateOK(new_state))) {
                OnStateChange(this, cr, StateTypeHard, origin);
                Log(LogNotice, "Checkable")
                    << "State Change: Checkable " << GetName() << " hard state change from " << old_state_str << " to " << new_state_str << " detected." << (is_volatile ? " Checkable is volatile." : "");
@@ -365,7 +366,8 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig
                    << "State Change: Checkable " << GetName() << " soft state change from " << old_state_str << " to " << new_state_str << " detected.";
        }
 
-       if (GetStateType() == StateTypeSoft || hardChange || recovery || is_volatile)
+       if (GetStateType() == StateTypeSoft || hardChange || recovery ||
+           is_volatile && !(IsStateOK(old_state) && IsStateOK(new_state)))
                ExecuteEventHandler();
 
        if (send_downtime_notification)