mirror of https://github.com/Icinga/icinga2.git
Checker: don't report missed checks after restarting Icinga
Fixes #3253
This commit is contained in:
parent
1be64b9290
commit
e334f126c8
|
@ -90,12 +90,14 @@ void CheckerComponent::CheckTimerHandler(void)
|
||||||
double lastCheck = cr->Get("execution_end");
|
double lastCheck = cr->Get("execution_end");
|
||||||
int missed = (Utility::GetTime() - lastCheck) / service->GetCheckInterval() - 1;
|
int missed = (Utility::GetTime() - lastCheck) / service->GetCheckInterval() - 1;
|
||||||
|
|
||||||
if (missed > 0) {
|
if (missed > 0 && !service->GetFirstCheck()) {
|
||||||
missedChecks += missed;
|
missedChecks += missed;
|
||||||
missedServices++;
|
missedServices++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
service->SetFirstCheck(false);
|
||||||
|
|
||||||
Logger::Write(LogDebug, "checker", "Executing service check for '" + service->GetName() + "'");
|
Logger::Write(LogDebug, "checker", "Executing service check for '" + service->GetName() + "'");
|
||||||
|
|
||||||
m_PendingServices.insert(service);
|
m_PendingServices.insert(service);
|
||||||
|
|
|
@ -34,6 +34,7 @@ static AttributeDescription serviceAttributes[] = {
|
||||||
{ "checkers", Attribute_Config },
|
{ "checkers", Attribute_Config },
|
||||||
|
|
||||||
{ "scheduling_offset", Attribute_Transient },
|
{ "scheduling_offset", Attribute_Transient },
|
||||||
|
{ "first_check", Attribute_Transient },
|
||||||
{ "next_check", Attribute_Replicated },
|
{ "next_check", Attribute_Replicated },
|
||||||
{ "checker", Attribute_Replicated },
|
{ "checker", Attribute_Replicated },
|
||||||
{ "check_attempt", Attribute_Replicated },
|
{ "check_attempt", Attribute_Replicated },
|
||||||
|
@ -225,6 +226,22 @@ long Service::GetSchedulingOffset(void)
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Service::SetFirstCheck(bool first)
|
||||||
|
{
|
||||||
|
Set("first_check", first ? 1 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Service::GetFirstCheck(void) const
|
||||||
|
{
|
||||||
|
Value value = Get("first_check");
|
||||||
|
|
||||||
|
if (value.IsEmpty())
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return static_cast<long>(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Service::SetNextCheck(double nextCheck)
|
void Service::SetNextCheck(double nextCheck)
|
||||||
{
|
{
|
||||||
Set("next_check", nextCheck);
|
Set("next_check", nextCheck);
|
||||||
|
|
|
@ -101,6 +101,9 @@ public:
|
||||||
long GetSchedulingOffset(void);
|
long GetSchedulingOffset(void);
|
||||||
void SetSchedulingOffset(long offset);
|
void SetSchedulingOffset(long offset);
|
||||||
|
|
||||||
|
void SetFirstCheck(bool first);
|
||||||
|
bool GetFirstCheck(void) const;
|
||||||
|
|
||||||
void SetNextCheck(double nextCheck);
|
void SetNextCheck(double nextCheck);
|
||||||
double GetNextCheck(void);
|
double GetNextCheck(void);
|
||||||
void UpdateNextCheck(void);
|
void UpdateNextCheck(void);
|
||||||
|
|
Loading…
Reference in New Issue