[icinga-checkins] icinga.org: icinga2/support/2.2: Fix last_hard_state missing in StatusDataWriter

git at icinga.org git at icinga.org
Sat Feb 7 19:46:00 CET 2015


Module: icinga2
Branch: support/2.2
Commit: e88cf90cbad7d3f680adfe43d262d11d26223d9d
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=e88cf90cbad7d3f680adfe43d262d11d26223d9d

Author: Michael Friedrich <michael.friedrich at gmail.com>
Date:   Sat Feb  7 19:37:12 2015 +0100

Fix last_hard_state missing in StatusDataWriter

fixes #8383

---

 lib/compat/statusdatawriter.cpp |   11 +++++++----
 lib/db_ido/dbevents.cpp         |    3 ++-
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/lib/compat/statusdatawriter.cpp b/lib/compat/statusdatawriter.cpp
index 8522dca..1967731 100644
--- a/lib/compat/statusdatawriter.cpp
+++ b/lib/compat/statusdatawriter.cpp
@@ -353,10 +353,13 @@ void StatusDataWriter::DumpCheckableStatusAttrs(std::ostream& fp, const Checkabl
 	Service::Ptr service;
 	tie(host, service) = GetHostService(checkable);
 
-	if (service)
-		fp << "\t" << "current_state=" << service->GetState() << "\n";
-	else
-		fp << "\t" << "current_state=" << (host->IsReachable() ? host->GetState() : 2) << "\n";
+	if (service) {
+		fp << "\t" << "current_state=" << service->GetState() << "\n"
+		   << "\t" << "last_hard_state=" << service->GetLastHardState() << "\n";
+	} else {
+		fp << "\t" << "current_state=" << (host->IsReachable() ? host->GetState() : 2) << "\n"
+		   << "\t" << "last_hard_state=" << host->GetLastHardState() << "\n";
+	}
 
 	fp << "\t" "state_type=" << checkable->GetStateType() << "\n"
 	      "\t" "plugin_output=" << CompatUtility::GetCheckResultOutput(cr) << "\n"
diff --git a/lib/db_ido/dbevents.cpp b/lib/db_ido/dbevents.cpp
index a20fa73..dc89ef1 100644
--- a/lib/db_ido/dbevents.cpp
+++ b/lib/db_ido/dbevents.cpp
@@ -494,7 +494,8 @@ void DbEvents::AddDowntimeInternal(const Checkable::Ptr& checkable, const Downti
 	    << "adding service downtime (id = " << downtime->GetLegacyId() << ") for '" << checkable->GetName() << "'";
 
 	/* add the downtime */
-	AddDowntimeByType(checkable, downtime, historical);}
+	AddDowntimeByType(checkable, downtime, historical);
+}
 
 void DbEvents::AddDowntimeByType(const Checkable::Ptr& checkable, const Downtime::Ptr& downtime, bool historical)
 {



More information about the icinga-checkins mailing list