]> granicus.if.org Git - icinga2/commitdiff
Downtime::AddDowntime(): place Downtimes in the same zone as the origin ScheduledDown... 6920/head
authorAlexander A. Klimov <alexander.klimov@icinga.com>
Mon, 28 Jan 2019 17:29:57 +0000 (18:29 +0100)
committerAlexander A. Klimov <alexander.klimov@icinga.com>
Mon, 28 Jan 2019 17:29:57 +0000 (18:29 +0100)
lib/icinga/downtime.cpp

index 9f0adf7082a0220de23bb1816b090ec8e8427697..0f0a74ceb0ac6238a60e78200d61e390a8519e18 100644 (file)
@@ -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);