From bb2338631f6054e2a4319743ad722a89973a464f Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Sat, 7 Feb 2015 19:37:12 +0100 Subject: [PATCH] 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 b2283918e..4fd5170e5 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 a20fa73e5..dc89ef1f9 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) {