From 51cd7e7b0bd131737b3a67f568ee77a377cee373 Mon Sep 17 00:00:00 2001 From: Julian Brost Date: Tue, 19 Apr 2022 15:54:51 +0200 Subject: [PATCH] Take host state into account when sending suppressed notifications Checkable::FireSuppressedNotifications() compares the time of the current checkable with the last recovery time of parents to avoid notification right after a parent recovered and before the current checkable was checked. This commit makes this check also include to host if the checkable is a service. This makes the behavior consistent with the documentation that states there is an implicit dependency on the host (which isn't realized as implicitly generating a Dependency object unfortunately). --- lib/icinga/checkable-notification.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/icinga/checkable-notification.cpp b/lib/icinga/checkable-notification.cpp index 21bcc399f52..779ed4b7b0e 100644 --- a/lib/icinga/checkable-notification.cpp +++ b/lib/icinga/checkable-notification.cpp @@ -155,6 +155,17 @@ void Checkable::FireSuppressedNotifications() } auto threshold (cr->GetExecutionStart()); + Host::Ptr host; + Service::Ptr service; + tie(host, service) = GetHostService(this); + + if (service) { + ObjectLock oLock (host); + + if (!host->GetProblem() && host->GetLastStateChange() >= threshold) { + return true; + } + } for (auto& dep : GetDependencies()) { auto parent (dep->GetParent());