From 8937daac74ddf31c63eed274d69c88573a071bdf Mon Sep 17 00:00:00 2001 From: Julian Brost Date: Tue, 14 Dec 2021 11:02:40 +0100 Subject: [PATCH] Don't trigger a fixed downtime like a flexible one When creating a fixed downtime that starts immediately while the checkable is in a non-OK state, previously the code path for flexible downtimes was used to trigger this downtime. This is fixed by this commit which resolves two issued: 1. Missing downtime start notification: notifications work differently for fixed and flexible downtimes. This resulted in missing downtime start notifications under the conditions described above. 2. Incorrect downtime trigger time: this code path would incorrectly assume the timestamp of the last checkable as the trigger time which is incorrect for fixed downtimes. --- lib/icinga/downtime.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/icinga/downtime.cpp b/lib/icinga/downtime.cpp index 086435236..139cbfb8b 100644 --- a/lib/icinga/downtime.cpp +++ b/lib/icinga/downtime.cpp @@ -126,7 +126,7 @@ void Downtime::Start(bool runtimeCreated) * this downtime now *after* it has been added (important * for DB IDO, etc.) */ - if (!checkable->IsStateOK(checkable->GetStateRaw())) { + if (!GetFixed() && !checkable->IsStateOK(checkable->GetStateRaw())) { Log(LogNotice, "Downtime") << "Checkable '" << checkable->GetName() << "' already in a NOT-OK state." << " Triggering downtime now.";