From: Michael Friedrich Date: Fri, 2 May 2014 22:37:47 +0000 (+0200) Subject: DB IDO: Update Host/Service state 'scheduled_downtime_depth' on DowntimeTriggered. X-Git-Tag: v0.0.11~96^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3d586b2b80607d52920f47e5e3c125b110e9b0e4;p=icinga2 DB IDO: Update Host/Service state 'scheduled_downtime_depth' on DowntimeTriggered. Refs #6051 --- diff --git a/lib/db_ido/dbevents.cpp b/lib/db_ido/dbevents.cpp index 2f30a8bb9..92b4ef3ab 100644 --- a/lib/db_ido/dbevents.cpp +++ b/lib/db_ido/dbevents.cpp @@ -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(); + fields4->Set("scheduled_downtime_depth", checkable->GetDowntimeDepth()); + + query4.Fields = fields4; + + query4.WhereCriteria = make_shared(); + 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 */