mirror of https://github.com/Icinga/icinga2.git
Merge pull request #6423 from Icinga/fix/scheduler-checks-too-often
Fix missing next check update causing the scheduler to execute checks too often
This commit is contained in:
commit
418ba7602b
|
@ -174,6 +174,9 @@ void CheckerComponent::CheckThreadProc()
|
||||||
m_IdleCheckables.insert(GetCheckableScheduleInfo(checkable));
|
m_IdleCheckables.insert(GetCheckableScheduleInfo(checkable));
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
|
|
||||||
|
Log(LogDebug, "CheckerComponent")
|
||||||
|
<< "Checks for checkable '" << checkable->GetName() << "' are disabled. Rescheduling check.";
|
||||||
|
|
||||||
checkable->UpdateNextCheck();
|
checkable->UpdateNextCheck();
|
||||||
|
|
||||||
lock.lock();
|
lock.lock();
|
||||||
|
@ -181,7 +184,16 @@ void CheckerComponent::CheckThreadProc()
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_PendingCheckables.insert(GetCheckableScheduleInfo(checkable));
|
|
||||||
|
csi = GetCheckableScheduleInfo(checkable);
|
||||||
|
|
||||||
|
Log(LogDebug, "CheckerComponent")
|
||||||
|
<< "Scheduling info for checkable '" << checkable->GetName() << "' ("
|
||||||
|
<< Utility::FormatDateTime("%Y-%m-%d %H:%M:%S %z", checkable->GetNextCheck()) << "): Object '"
|
||||||
|
<< csi.Object->GetName() << "', Next Check: "
|
||||||
|
<< Utility::FormatDateTime("%Y-%m-%d %H:%M:%S %z", csi.NextCheck) << "(" << csi.NextCheck << ").";
|
||||||
|
|
||||||
|
m_PendingCheckables.insert(csi);
|
||||||
|
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,14 @@ void Checkable::UpdateNextCheck(const MessageOrigin::Ptr& origin)
|
||||||
|
|
||||||
adj = std::min(0.5 + fmod(GetSchedulingOffset(), interval * 5) / 100.0, adj);
|
adj = std::min(0.5 + fmod(GetSchedulingOffset(), interval * 5) / 100.0, adj);
|
||||||
|
|
||||||
SetNextCheck(now - adj + interval, false, origin);
|
double nextCheck = now - adj + interval;
|
||||||
|
|
||||||
|
Log(LogDebug, "Checkable")
|
||||||
|
<< "Update checkable '" << GetName() << "' with check interval '" << GetCheckInterval()
|
||||||
|
<< "' from last check time at " << Utility::FormatDateTime("%Y-%m-%d %H:%M:%S %z", GetLastCheck())
|
||||||
|
<< " (" << GetLastCheck() << ") to next check time at " << Utility::FormatDateTime("%Y-%m-%d %H:%M:%S %z", nextCheck) << "(" << nextCheck << ").";
|
||||||
|
|
||||||
|
SetNextCheck(nextCheck, false, origin);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Checkable::HasBeenChecked() const
|
bool Checkable::HasBeenChecked() const
|
||||||
|
@ -431,6 +438,12 @@ void Checkable::ExecuteCheck()
|
||||||
double scheduled_start = GetNextCheck();
|
double scheduled_start = GetNextCheck();
|
||||||
double before_check = Utility::GetTime();
|
double before_check = Utility::GetTime();
|
||||||
|
|
||||||
|
/* This calls SetNextCheck() which updates the CheckerComponent's idle/pending
|
||||||
|
* queues and ensures that checks are not fired multiple times. ProcessCheckResult()
|
||||||
|
* is called too late. See #6421.
|
||||||
|
*/
|
||||||
|
UpdateNextCheck();
|
||||||
|
|
||||||
bool reachable = IsReachable();
|
bool reachable = IsReachable();
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue