[icinga-checkins] icinga.org: icinga2/master: DB IDO: Fixed downtime start does not update actual_start_time
git at icinga.org
git at icinga.org
Thu Aug 11 12:10:44 CEST 2016
Module: icinga2
Branch: master
Commit: 41094489b6033f10c149ce9446a00c09b5e6f9f1
URL: https://git.icinga.org/?p=icinga2.git;a=commit;h=41094489b6033f10c149ce9446a00c09b5e6f9f1
Author: Michael Friedrich <michael.friedrich at netways.de>
Date: Thu Aug 11 12:10:04 2016 +0200
DB IDO: Fixed downtime start does not update actual_start_time
fixes #12401
---
lib/db_ido/dbevents.cpp | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/lib/db_ido/dbevents.cpp b/lib/db_ido/dbevents.cpp
index b3444ed..37b8a17 100644
--- a/lib/db_ido/dbevents.cpp
+++ b/lib/db_ido/dbevents.cpp
@@ -503,7 +503,15 @@ void DbEvents::AddDowntimeInternal(std::vector<DbQuery>& queries, const Downtime
fields1->Set("duration", downtime->GetDuration());
fields1->Set("scheduled_start_time", DbValue::FromTimestamp(downtime->GetStartTime()));
fields1->Set("scheduled_end_time", DbValue::FromTimestamp(downtime->GetEndTime()));
- fields1->Set("was_started", ((downtime->GetStartTime() <= Utility::GetTime()) ? 1 : 0));
+
+ /* flexible downtimes are started at trigger time */
+ if (downtime->GetFixed()) {
+ std::pair<unsigned long, unsigned long> time_bag = CompatUtility::ConvertTimestamp(downtime->GetStartTime());
+ fields1->Set("actual_start_time", DbValue::FromTimestamp(time_bag.first));
+ fields1->Set("actual_start_time_usec", time_bag.second);
+ fields1->Set("was_started", ((downtime->GetStartTime() <= Utility::GetTime()) ? 1 : 0));
+ }
+
fields1->Set("is_in_effect", (downtime->IsInEffect() ? 1 : 0));
fields1->Set("trigger_time", DbValue::FromTimestamp(downtime->GetTriggerTime()));
fields1->Set("instance_id", 0); /* DbConnection class fills in real ID */
More information about the icinga-checkins
mailing list