]> granicus.if.org Git - icinga2/commitdiff
DB IDO: Fix status table scheduled_downtime_depth column not updated on downtime...
authorMichael Friedrich <michael.friedrich@netways.de>
Sat, 11 Apr 2015 09:40:14 +0000 (11:40 +0200)
committerMichael Friedrich <michael.friedrich@netways.de>
Sat, 11 Apr 2015 09:42:22 +0000 (11:42 +0200)
fixes #9017

lib/db_ido/dbevents.cpp

index 5e5da592aa0c356f72b523174b40fddc16fadc36..fe04c8a4349ae5d60a88419999d07f6188370276 100644 (file)
@@ -610,6 +610,37 @@ void DbEvents::RemoveDowntime(const Checkable::Ptr& checkable, const Downtime::P
        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 = DbQueryInsert | DbQueryUpdate;
+       query4.Category = DbCatState;
+       query4.StatusUpdate = true;
+       query4.Object = DbObject::GetOrCreateByObject(checkable);
+
+       Dictionary::Ptr fields4 = new Dictionary();
+       fields4->Set("scheduled_downtime_depth", checkable->GetDowntimeDepth());
+
+       query4.Fields = fields4;
+
+       query4.WhereCriteria = new 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);
 }
 
 void DbEvents::TriggerDowntime(const Checkable::Ptr& checkable, const Downtime::Ptr& downtime)