Merge pull request #9679 from Icinga/9596-213

CheckerComponent#CheckThreadProc(): also propagate next check update …
This commit is contained in:
Alexander Aleksandrovič Klimov 2023-02-15 16:32:21 +01:00 committed by GitHub
commit 58c4ba4177
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -134,12 +134,15 @@ void CheckerComponent::CheckThreadProc()
bool forced = checkable->GetForceNextCheck(); bool forced = checkable->GetForceNextCheck();
bool check = true; bool check = true;
bool notifyNextCheck = false;
if (!forced) { if (!forced) {
if (!checkable->IsReachable(DependencyCheckExecution)) { if (!checkable->IsReachable(DependencyCheckExecution)) {
Log(LogNotice, "CheckerComponent") Log(LogNotice, "CheckerComponent")
<< "Skipping check for object '" << checkable->GetName() << "': Dependency failed."; << "Skipping check for object '" << checkable->GetName() << "': Dependency failed.";
check = false; check = false;
notifyNextCheck = true;
} }
Host::Ptr host; Host::Ptr host;
@ -163,7 +166,9 @@ void CheckerComponent::CheckThreadProc()
Log(LogNotice, "CheckerComponent") Log(LogNotice, "CheckerComponent")
<< "Skipping check for object '" << checkable->GetName() << "Skipping check for object '" << checkable->GetName()
<< "': not in check period '" << tp->GetName() << "'"; << "': not in check period '" << tp->GetName() << "'";
check = false; check = false;
notifyNextCheck = true;
} }
} }
@ -177,6 +182,11 @@ void CheckerComponent::CheckThreadProc()
checkable->UpdateNextCheck(); checkable->UpdateNextCheck();
if (notifyNextCheck) {
// Trigger update event for Icinga DB
Checkable::OnNextCheckUpdated(checkable);
}
lock.lock(); lock.lock();
continue; continue;