]> granicus.if.org Git - icinga2/commitdiff
DB IDO: Update Host/Service state 'scheduled_downtime_depth' on DowntimeTriggered.
authorMichael Friedrich <Michael.Friedrich@netways.de>
Fri, 2 May 2014 22:37:47 +0000 (00:37 +0200)
committerMichael Friedrich <Michael.Friedrich@netways.de>
Fri, 2 May 2014 22:38:56 +0000 (00:38 +0200)
Refs #6051

lib/db_ido/dbevents.cpp

index 2f30a8bb98ec7949b802f181af5f81c0cc791986..92b4ef3abf92f8248ddb07bcd8dee5eff3236471 100644 (file)
@@ -521,6 +521,34 @@ void DbEvents::TriggerDowntime(const Checkable::Ptr& checkable, const Downtime::
        query3.WhereCriteria->Set("instance_id", 0); /* DbConnection class fills in real ID */
 
        DbObject::OnQuery(query3);
+
+       /* host/service status */
+       Host::Ptr host;
+       Service::Ptr service;
+       tie(host, service) = GetHostService(checkable);
+
+       DbQuery query4;
+       if (service)
+               query4.Table = "servicestatus";
+       else
+               query4.Table = "hoststatus";
+
+       query4.Type = DbQueryUpdate;
+
+       Dictionary::Ptr fields4 = make_shared<Dictionary>();
+       fields4->Set("scheduled_downtime_depth", checkable->GetDowntimeDepth());
+
+       query4.Fields = fields4;
+
+       query4.WhereCriteria = make_shared<Dictionary>();
+       if (service)
+               query4.WhereCriteria->Set("service_object_id", service);
+       else
+               query4.WhereCriteria->Set("host_object_id", host);
+
+       query4.WhereCriteria->Set("instance_id", 0); /* DbConnection class fills in real ID */
+
+       DbObject::OnQuery(query4);
 }
 
 /* acknowledgements */