From fb72633c5eb081e3356046b922ce4f35246614dd Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" <alexander.klimov@icinga.com> Date: Mon, 28 Jan 2019 18:29:57 +0100 Subject: [PATCH] Downtime::AddDowntime(): place Downtimes in the same zone as the origin ScheduledDowntimes (cherry picked from commit ce847324bc8abe4f36071633b999fa88ba2213f3) --- lib/icinga/downtime.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/icinga/downtime.cpp b/lib/icinga/downtime.cpp index 9f0adf708..0f0a74ceb 100644 --- a/lib/icinga/downtime.cpp +++ b/lib/icinga/downtime.cpp @@ -267,7 +267,23 @@ String Downtime::AddDowntime(const Checkable::Ptr& checkable, const String& auth if (service) attrs->Set("service_name", service->GetShortName()); - String zone = checkable->GetZoneName(); + String zone; + + if (!scheduledDowntime.IsEmpty()) { + auto sdt (ScheduledDowntime::GetByName(scheduledDowntime)); + + if (sdt) { + auto sdtZone (sdt->GetZone()); + + if (sdtZone) { + zone = sdtZone->GetName(); + } + } + } + + if (zone.IsEmpty()) { + zone = checkable->GetZoneName(); + } if (!zone.IsEmpty()) attrs->Set("zone", zone);