]> granicus.if.org Git - icinga2/commitdiff
Revert "Properly set the next check time for active and passive checks"
authorMichael Friedrich <michael.friedrich@netways.de>
Sat, 5 Mar 2016 16:48:06 +0000 (17:48 +0100)
committerMichael Friedrich <michael.friedrich@netways.de>
Sat, 5 Mar 2016 17:15:03 +0000 (18:15 +0100)
This reverts commit 2a11b27972e4325bf80e9abc9017eab7dd03e712.

This patch does not properly work and breaks the check_interval setting
for passive checks. Requires a proper patch.

refs #11248
refs #11257
refs #11273

(the old issue)
refs #7287

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

index 58d35c94dbdced963a36d050b52bd7d963e601c8..4b1e4ad5394d82eaf8369d9f6821f1b84958b70b 100644 (file)
@@ -156,4 +156,9 @@ 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 b4283813bbf63ce6c6070209f6e0efcd07640c0e..9faa0304c123dfb9fd567f3207d15b43aac7fbbb 100644 (file)
@@ -106,6 +106,11 @@ 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 ebec1550199994e3047fa6b866fb2e8b9346aff8..9916093de41e1c4d85a9ba9c79cb5a2987ab8264 100644 (file)
@@ -302,16 +302,8 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig
                UpdateFlappingStatus(stateChange);
        is_flapping = IsFlapping();
 
-       /* 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();
-       }
+       /* update next check time on possible state changes */
+       UpdateNextCheck();
 
        olock.Unlock();
 
index 226044e5e58658393828d7db39e7c47f8a3f26e5..d5eff10a4aa1df126eefdeca74d227f27fe6ab26 100644 (file)
@@ -365,6 +365,11 @@ 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)
@@ -395,6 +400,11 @@ 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)