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() + "'.");
}
return m_SchedulingOffset;
}
-void Checkable::UpdateNextCheck(void)
+void Checkable::UpdateNextCheck(const MessageOrigin::Ptr& origin)
{
double interval;
if (interval > 1)
adj = fmod(now * 100 + GetSchedulingOffset(), interval * 100) / 100.0;
- SetNextCheck(now - adj + interval);
+ SetNextCheck(now - adj + interval, false, origin);
}
bool Checkable::HasBeenChecked(void) const
} else if (IsStateOK(old_state)) {
SetStateType(StateTypeSoft);
attempt = 1; // OK -> NOT-OK transition, reset the counter
-
- /* If there was a OK -> NOT-OK state change for actively scheduled checks,
- * update the next check time using the retry_interval.
- * Important: Add the cluster message origin.
- */
- if (cr->GetActive())
- SetNextCheck(Utility::GetTime() + GetRetryInterval(), false, origin);
} else {
attempt = old_attempt;
}
is_flapping = IsFlapping();
+ if (cr->GetActive()) {
+ /* If there was a OK -> NOT-OK state change for actively scheduled checks,
+ * update the next check time using the retry_interval.
+ * Important: Add the cluster message origin. */
+ UpdateNextCheck(origin);
+ } else {
+ /* Reschedule the next check for passive check results. 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(), false, origin);
+ }
+
olock.Unlock();
// Log(LogDebug, "Checkable")
long GetSchedulingOffset(void);
void SetSchedulingOffset(long offset);
- void UpdateNextCheck(void);
+ void UpdateNextCheck(const MessageOrigin::Ptr& origin = MessageOrigin::Ptr());
bool HasBeenChecked(void) const;
virtual bool IsStateOK(ServiceState state) = 0;
<< "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)
<< "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)