mirror of https://github.com/Icinga/icinga2.git
Log missed checks.
This commit is contained in:
parent
569245a976
commit
4f39e10a05
|
@ -58,6 +58,8 @@ void CheckerComponent::CheckTimerHandler(void)
|
|||
double now = Utility::GetTime();
|
||||
long tasks = 0;
|
||||
|
||||
int missedServices = 0, missedChecks = 0;
|
||||
|
||||
while (!m_IdleServices.empty()) {
|
||||
typedef nth_index<ServiceSet, 1>::type CheckTimeView;
|
||||
CheckTimeView& idx = boost::get<1>(m_IdleServices);
|
||||
|
@ -70,6 +72,18 @@ void CheckerComponent::CheckTimerHandler(void)
|
|||
|
||||
idx.erase(it);
|
||||
|
||||
Dictionary::Ptr cr = service->GetLastCheckResult();
|
||||
|
||||
if (cr) {
|
||||
double lastCheck = cr->Get("execution_end");
|
||||
int missed = (Utility::GetTime() - lastCheck) / service->GetCheckInterval();
|
||||
|
||||
if (missed > 0) {
|
||||
missedChecks += missed;
|
||||
missedServices++;
|
||||
}
|
||||
}
|
||||
|
||||
Logger::Write(LogDebug, "checker", "Executing service check for '" + service->GetName() + "'");
|
||||
|
||||
m_PendingServices.insert(service);
|
||||
|
@ -87,6 +101,12 @@ void CheckerComponent::CheckTimerHandler(void)
|
|||
|
||||
Logger::Write(LogDebug, "checker", "CheckTimerHandler: past loop.");
|
||||
|
||||
if (missedServices > 0) {
|
||||
stringstream msgbuf;
|
||||
msgbuf << "Missed " << missedChecks << " checks for " << missedServices << " services";;
|
||||
Logger::Write(LogWarning, "checker", msgbuf.str());
|
||||
}
|
||||
|
||||
stringstream msgbuf;
|
||||
msgbuf << "CheckTimerHandler: created " << tasks << " tasks";
|
||||
Logger::Write(LogInformation, "checker", msgbuf.str());
|
||||
|
|
Loading…
Reference in New Issue