[icinga-checkins] icinga.org: icinga2/master: Bugfix: look up legacy_id for triggered_by downtimes.

git at icinga.org git at icinga.org
Wed Jan 30 11:11:05 CET 2013


Module: icinga2
Branch: master
Commit: 20958d0ba8ebdd407439f75258064c3fa4a0744e
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=20958d0ba8ebdd407439f75258064c3fa4a0744e

Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date:   Wed Jan 30 11:10:47 2013 +0100

Bugfix: look up legacy_id for triggered_by downtimes.

---

 components/compat/compatcomponent.cpp |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/components/compat/compatcomponent.cpp b/components/compat/compatcomponent.cpp
index f4e6033..4af6b84 100644
--- a/components/compat/compatcomponent.cpp
+++ b/components/compat/compatcomponent.cpp
@@ -239,12 +239,20 @@ void CompatComponent::DumpDowntimes(ofstream& fp, const DynamicObject::Ptr& owne
 			fp << "servicedowntime {" << "\n"
 			   << "\t" << "service_description=" << service->GetAlias() << "\n";
 
+		String triggeredBy = downtime->Get("triggered_by");
+		int triggeredByLegacy = 0;
+		if (!triggeredBy.IsEmpty()) {
+			Dictionary::Ptr triggeredByObj = DowntimeProcessor::GetDowntimeByID(triggeredBy);
+			if (triggeredByObj->Contains("legacy_id"))
+				triggeredByLegacy = triggeredByObj->Get("legacy_id");
+		}
+
 		fp << "\t" << "host_name=" << host->GetName() << "\n"
 		   << "\t" << "downtime_id=" << static_cast<String>(downtime->Get("legacy_id")) << "\n"
 		   << "\t" << "entry_time=" << static_cast<double>(downtime->Get("entry_time")) << "\n"
 		   << "\t" << "start_time=" << static_cast<double>(downtime->Get("start_time")) << "\n"
 		   << "\t" << "end_time=" << static_cast<double>(downtime->Get("end_time")) << "\n"
-		   << "\t" << "triggered_by=" << static_cast<long>(downtime->Get("triggered_by")) << "\n"
+		   << "\t" << "triggered_by=" << triggeredByLegacy << "\n"
 		   << "\t" << "fixed=" << static_cast<long>(downtime->Get("fixed")) << "\n"
 		   << "\t" << "duration=" << static_cast<long>(downtime->Get("duration")) << "\n"
 		   << "\t" << "is_in_effect=" << (DowntimeProcessor::IsDowntimeActive(downtime) ? 1 : 0) << "\n"





More information about the icinga-checkins mailing list