Fix last_hard_state missing in StatusDataWriter

fixes #8383
This commit is contained in:
Michael Friedrich 2015-02-07 19:37:12 +01:00
parent 706de78634
commit bb2338631f
2 changed files with 9 additions and 5 deletions

View File

@ -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"

View File

@ -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)
{