mirror of https://github.com/Icinga/icinga2.git
parent
8c4765c607
commit
bf2e3cb091
|
@ -304,9 +304,15 @@ void ExternalCommandProcessor::ProcessHostCheckResult(double time, const std::ve
|
|||
|
||||
int exitStatus = Convert::ToDouble(arguments[1]);
|
||||
CheckResult::Ptr result = make_shared<CheckResult>();
|
||||
std::pair<String, Value> co = PluginUtility::ParseCheckOutput(arguments[2]);
|
||||
std::pair<String, String> co = PluginUtility::ParseCheckOutput(arguments[2]);
|
||||
result->SetOutput(co.first);
|
||||
result->SetPerformanceData(co.second);
|
||||
|
||||
Value perfdata = co.second;
|
||||
|
||||
if (host->GetEnablePerfdata())
|
||||
perfdata = PluginUtility::ParsePerfdata(perfdata);
|
||||
|
||||
result->SetPerformanceData(perfdata);
|
||||
|
||||
ServiceState state;
|
||||
|
||||
|
@ -350,9 +356,15 @@ void ExternalCommandProcessor::ProcessServiceCheckResult(double time, const std:
|
|||
|
||||
int exitStatus = Convert::ToDouble(arguments[2]);
|
||||
CheckResult::Ptr result = make_shared<CheckResult>();
|
||||
std::pair<String, Value> co = PluginUtility::ParseCheckOutput(arguments[3]);
|
||||
std::pair<String, String> co = PluginUtility::ParseCheckOutput(arguments[3]);
|
||||
result->SetOutput(co.first);
|
||||
result->SetPerformanceData(co.second);
|
||||
|
||||
Value perfdata = co.second;
|
||||
|
||||
if (service->GetEnablePerfdata())
|
||||
perfdata = PluginUtility::ParsePerfdata(perfdata);
|
||||
|
||||
result->SetPerformanceData(perfdata);
|
||||
result->SetState(PluginUtility::ExitStatusToState(exitStatus));
|
||||
|
||||
result->SetScheduleStart(time);
|
||||
|
|
|
@ -189,7 +189,7 @@ ServiceState PluginUtility::ExitStatusToState(int exitStatus)
|
|||
}
|
||||
}
|
||||
|
||||
std::pair<String, Value> PluginUtility::ParseCheckOutput(const String& output)
|
||||
std::pair<String, String> PluginUtility::ParseCheckOutput(const String& output)
|
||||
{
|
||||
String text;
|
||||
String perfdata;
|
||||
|
@ -217,7 +217,7 @@ std::pair<String, Value> PluginUtility::ParseCheckOutput(const String& output)
|
|||
|
||||
boost::algorithm::trim(perfdata);
|
||||
|
||||
return std::make_pair(text, ParsePerfdata(perfdata));
|
||||
return std::make_pair(text, perfdata);
|
||||
}
|
||||
|
||||
Value PluginUtility::ParsePerfdata(const String& perfdata)
|
||||
|
|
|
@ -44,7 +44,7 @@ public:
|
|||
const boost::function<void(const Value& commandLine, const ProcessResult&)>& callback = boost::function<void(const Value& commandLine, const ProcessResult&)>());
|
||||
|
||||
static ServiceState ExitStatusToState(int exitStatus);
|
||||
static std::pair<String, Value> ParseCheckOutput(const String& output);
|
||||
static std::pair<String, String> ParseCheckOutput(const String& output);
|
||||
|
||||
static Value ParsePerfdata(const String& perfdata);
|
||||
static String FormatPerfdata(const Value& perfdata);
|
||||
|
|
|
@ -65,10 +65,16 @@ void PluginCheckTask::ProcessFinishedHandler(const Checkable::Ptr& checkable, co
|
|||
|
||||
String output = pr.Output;
|
||||
output.Trim();
|
||||
std::pair<String, Value> co = PluginUtility::ParseCheckOutput(output);
|
||||
std::pair<String, String> co = PluginUtility::ParseCheckOutput(output);
|
||||
cr->SetCommand(commandLine);
|
||||
cr->SetOutput(co.first);
|
||||
cr->SetPerformanceData(co.second);
|
||||
|
||||
Value perfdata = co.second;
|
||||
|
||||
if (checkable->GetEnablePerfdata())
|
||||
perfdata = PluginUtility::ParsePerfdata(perfdata);
|
||||
|
||||
cr->SetPerformanceData(perfdata);
|
||||
cr->SetState(PluginUtility::ExitStatusToState(pr.ExitStatus));
|
||||
cr->SetExitStatus(pr.ExitStatus);
|
||||
cr->SetExecutionStart(pr.ExecutionStart);
|
||||
|
|
Loading…
Reference in New Issue