]> granicus.if.org Git - icinga2/commitdiff
Improve handling for missing start_time and finish_time values
authorGunnar Beutner <gunnar.beutner@icinga.com>
Wed, 15 Mar 2017 09:41:08 +0000 (10:41 +0100)
committerGunnar Beutner <gunnar.beutner@icinga.com>
Wed, 15 Mar 2017 09:41:08 +0000 (10:41 +0100)
fixes #5062

lib/compat/checkresultreader.cpp

index af374da9fee75f7027a60506e72336f437fc3bd8..1ac8546e58ec1318dd7f21b5934147a1023556a8 100644 (file)
@@ -165,8 +165,16 @@ void CheckResultReader::ProcessCheckResultFile(const String& path) const
        result->SetOutput(co.first);
        result->SetPerformanceData(PluginUtility::SplitPerfdata(co.second));
        result->SetState(PluginUtility::ExitStatusToState(Convert::ToLong(attrs["return_code"])));
-       result->SetExecutionStart(Convert::ToDouble(attrs["start_time"]));
-       result->SetExecutionEnd(Convert::ToDouble(attrs["finish_time"]));
+
+       if (attrs.find("start_time") != attrs.end())
+               result->SetExecutionStart(Convert::ToDouble(attrs["start_time"]));
+       else
+               result->SetExecutionStart(Utility::GetTime());
+
+       if (attrs.find("finish_time") != attrs.end())
+               result->SetExecutionEnd(Convert::ToDouble(attrs["finish_time"]));
+       else
+               result->SetExecutionEnd(result->GetExecutionStart());
 
        checkable->ProcessCheckResult(result);