From: Gunnar Beutner Date: Tue, 28 Jan 2014 13:44:06 +0000 (+0100) Subject: Fix: PROCESS_HOST_CHECK_RESULT misinterprets the given status code. X-Git-Tag: v0.0.7~26 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=95559cb329fef610f4ea5497c82b9e9c591c9bc5;p=icinga2 Fix: PROCESS_HOST_CHECK_RESULT misinterprets the given status code. Fixes #5462 --- diff --git a/lib/icinga/externalcommandprocessor.cpp b/lib/icinga/externalcommandprocessor.cpp index 0b206b94f..ae309989d 100644 --- a/lib/icinga/externalcommandprocessor.cpp +++ b/lib/icinga/externalcommandprocessor.cpp @@ -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);