Add more debug logging for check scheduling

This commit is contained in:
Michael Friedrich 2018-07-02 16:17:33 +02:00
parent c89f92e352
commit 601c54e44e
2 changed files with 21 additions and 2 deletions

View File

@ -174,6 +174,9 @@ void CheckerComponent::CheckThreadProc()
m_IdleCheckables.insert(GetCheckableScheduleInfo(checkable));
lock.unlock();
Log(LogDebug, "CheckerComponent")
<< "Checks for checkable '" << checkable->GetName() << "' are disabled. Rescheduling check.";
checkable->UpdateNextCheck();
lock.lock();
@ -181,7 +184,16 @@ void CheckerComponent::CheckThreadProc()
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();

View File

@ -81,7 +81,14 @@ void Checkable::UpdateNextCheck(const MessageOrigin::Ptr& origin)
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