]> granicus.if.org Git - icinga2/commitdiff
Fix hostcheck state conversion of the statusdatawriter
authorJohannes Meyer <johannes.meyer@netways.de>
Wed, 15 Jan 2014 13:50:58 +0000 (14:50 +0100)
committerJohannes Meyer <johannes.meyer@netways.de>
Wed, 15 Jan 2014 13:50:58 +0000 (14:50 +0100)
fixes #5449

components/compat/statusdatawriter.cpp

index 4524a38dd3b0f73a5a16c5cf7bf63f3c119db7dc..315d4b9ac25144f8636733d6fa478480236aa2a8 100644 (file)
@@ -338,8 +338,13 @@ void StatusDataWriter::DumpServiceStatusAttrs(std::ostream& fp, const Service::P
                 "\t" "check_latency=" << Convert::ToString(Service::CalculateLatency(cr)) << "\n";
        }
 
-       fp << "\t" << "current_state=" << CompatUtility::GetServiceCurrentState(service) << "\n"
-             "\t" "state_type=" << service->GetStateType() << "\n"
+       if (type == CompatTypeHost && service->IsHostCheck()) {
+               fp << "\t" << "current_state=" << service->GetHost()->GetState() << "\n";
+       } else {
+               fp << "\t" << "current_state=" << CompatUtility::GetServiceCurrentState(service) << "\n";
+       }
+
+       fp << "\t" "state_type=" << service->GetStateType() << "\n"
              "\t" "plugin_output=" << CompatUtility::GetCheckResultOutput(cr) << "\n"
              "\t" "long_plugin_output=" << CompatUtility::GetCheckResultLongOutput(cr) << "\n"
              "\t" "performance_data=" << CompatUtility::GetCheckResultPerfdata(cr) << "\n";