]> granicus.if.org Git - icinga2/commitdiff
Properly set the next check time for active and passive checks
authorMichael Friedrich <michael.friedrich@netways.de>
Fri, 22 Jan 2016 17:40:14 +0000 (18:40 +0100)
committerMichael Friedrich <michael.friedrich@netways.de>
Fri, 22 Jan 2016 17:40:14 +0000 (18:40 +0100)
fixes #7287
refs #11019

lib/compat/checkresultreader.cpp
lib/icinga/apiactions.cpp
lib/icinga/checkable-check.cpp
lib/icinga/externalcommandprocessor.cpp

index 4b1e4ad5394d82eaf8369d9f6821f1b84958b70b..58d35c94dbdced963a36d050b52bd7d963e601c8 100644 (file)
@@ -156,9 +156,4 @@ void CheckResultReader::ProcessCheckResultFile(const String& path) const
 
        Log(LogDebug, "CheckResultReader")
            << "Processed checkresult file for object '" << checkable->GetName() << "'";
-
-       /* Reschedule the next check. The side effect of this is that for as long
-        * as we receive check result files for a host/service we won't execute any
-        * active checks. */
-       checkable->SetNextCheck(Utility::GetTime() + checkable->GetCheckInterval());
 }
index 6bfaa41fb0d2c5b5ebded90b32b730e0ba013f58..c24ec908e99e45de133c4fb2ca33262565b83dce 100644 (file)
@@ -106,11 +106,6 @@ Dictionary::Ptr ApiActions::ProcessCheckResult(const ConfigObject::Ptr& object,
        cr->SetCommand(params->Get("check_command"));
        checkable->ProcessCheckResult(cr);
 
-       /* Reschedule the next check. The side effect of this is that for as long
-        * as we receive passive results for a service we won't execute any
-        * active checks. */
-       checkable->SetNextCheck(Utility::GetTime() + checkable->GetCheckInterval());
-
        return ApiActions::CreateResult(200, "Successfully processed check result for object '" + checkable->GetName() + "'.");
 }
 
index 3068c984707dede81cc0e1a103e3a57fdb74335c..5be258ff631aef02d6f37b19855a185adaddfc1a 100644 (file)
@@ -311,8 +311,16 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig
                UpdateFlappingStatus(stateChange);
        is_flapping = IsFlapping();
 
-       /* update next check time on possible state changes */
-       UpdateNextCheck();
+       /* update next check time for active and passive check results */
+       if (!GetEnableActiveChecks() && GetEnablePassiveChecks()) {
+               /* Reschedule the next passive check. The side effect of this is that for as long
+                * as we receive passive results for a service we won't execute any
+                * active checks. */
+               SetNextCheck(Utility::GetTime() + GetCheckInterval());
+       } else if (GetEnableActiveChecks()) {
+               /* update next check time based on state changes and types */
+               UpdateNextCheck();
+       }
 
        olock.Unlock();
 
index 2f79acf083739f99328b99162a6a5f41db41c14e..fa1ff7f0eabde90da2e0a0d5878b61eba39a11d0 100644 (file)
@@ -327,11 +327,6 @@ void ExternalCommandProcessor::ProcessHostCheckResult(double time, const std::ve
            << "Processing passive check result for host '" << arguments[0] << "'";
 
        host->ProcessCheckResult(result);
-
-       /* Reschedule the next check. The side effect of this is that for as long
-        * as we receive passive results for a service we won't execute any
-        * active checks. */
-       host->SetNextCheck(Utility::GetTime() + host->GetCheckInterval());
 }
 
 void ExternalCommandProcessor::ProcessServiceCheckResult(double time, const std::vector<String>& arguments)
@@ -362,11 +357,6 @@ void ExternalCommandProcessor::ProcessServiceCheckResult(double time, const std:
            << "Processing passive check result for service '" << arguments[1] << "'";
 
        service->ProcessCheckResult(result);
-
-       /* Reschedule the next check. The side effect of this is that for as long
-        * as we receive passive results for a service we won't execute any
-        * active checks. */
-       service->SetNextCheck(Utility::GetTime() + service->GetCheckInterval());
 }
 
 void ExternalCommandProcessor::ScheduleHostCheck(double, const std::vector<String>& arguments)