Fix: PROCESS_HOST_CHECK_RESULT misinterprets the given status code.

Fixes #5462
This commit is contained in:
Gunnar Beutner 2014-01-28 14:44:06 +01:00
parent f9e8e204f9
commit 95559cb329
1 changed files with 11 additions and 1 deletions

View File

@ -235,7 +235,17 @@ void ExternalCommandProcessor::ProcessHostCheckResult(double time, const std::ve
int exitStatus = Convert::ToDouble(arguments[1]);
CheckResult::Ptr result = PluginUtility::ParseCheckOutput(arguments[2]);
result->SetState(PluginUtility::ExitStatusToState(exitStatus));
ServiceState state;
if (exitStatus == 0)
state = StateOK;
else if (exitStatus == 1)
state = StateCritical;
else
BOOST_THROW_EXCEPTION(std::invalid_argument("Invalid status code: " + arguments[2]));
result->SetState(state);
result->SetScheduleStart(time);
result->SetScheduleEnd(time);