From e9b8c679758bfc834085d2b878d2ac04c2122adf Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Wed, 1 Feb 2023 16:25:56 +0100 Subject: [PATCH] CheckerComponent#CheckThreadProc(): also propagate next check update to Icinga DB if caused by dependency or check period. Now as long as any of the above causes check skips next check and next update will be up-to-date in Icinga DB, so the checkable won't slide into false positive overdue. --- lib/checker/checkercomponent.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/checker/checkercomponent.cpp b/lib/checker/checkercomponent.cpp index aeaf2d1b2..5fa366554 100644 --- a/lib/checker/checkercomponent.cpp +++ b/lib/checker/checkercomponent.cpp @@ -134,12 +134,15 @@ void CheckerComponent::CheckThreadProc() bool forced = checkable->GetForceNextCheck(); bool check = true; + bool notifyNextCheck = false; if (!forced) { if (!checkable->IsReachable(DependencyCheckExecution)) { Log(LogNotice, "CheckerComponent") << "Skipping check for object '" << checkable->GetName() << "': Dependency failed."; + check = false; + notifyNextCheck = true; } Host::Ptr host; @@ -163,7 +166,9 @@ void CheckerComponent::CheckThreadProc() Log(LogNotice, "CheckerComponent") << "Skipping check for object '" << checkable->GetName() << "': not in check period '" << tp->GetName() << "'"; + check = false; + notifyNextCheck = true; } } @@ -177,6 +182,11 @@ void CheckerComponent::CheckThreadProc() checkable->UpdateNextCheck(); + if (notifyNextCheck) { + // Trigger update event for Icinga DB + Checkable::OnNextCheckUpdated(checkable); + } + lock.lock(); continue;