From 43c4feb6457ab6b056adf04bc8842d6fc62b7536 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Tue, 18 Apr 2023 16:55:32 +0200 Subject: [PATCH] Downtime#Start(): trigger flexible downtimes not earlier than fixed ones the last state change could be a long time ago. If it's longer than the new downtime's duration, the downtime expires immediately. trigger time + duration < now --- lib/icinga/downtime.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/icinga/downtime.cpp b/lib/icinga/downtime.cpp index f19698e64..0452a3c7d 100644 --- a/lib/icinga/downtime.cpp +++ b/lib/icinga/downtime.cpp @@ -132,7 +132,8 @@ void Downtime::Start(bool runtimeCreated) Log(LogNotice, "Downtime") << "Checkable '" << checkable->GetName() << "' already in a NOT-OK state." << " Triggering downtime now."; - TriggerDowntime(checkable->GetLastStateChange()); + + TriggerDowntime(std::fmax(std::fmax(GetStartTime(), GetEntryTime()), checkable->GetLastStateChange())); } if (GetFixed() && CanBeTriggered()) {