]> granicus.if.org Git - icinga2/commitdiff
Fix: PROCESS_HOST_CHECK_RESULT misinterprets the given status code.
authorGunnar Beutner <gunnar.beutner@netways.de>
Tue, 28 Jan 2014 13:44:06 +0000 (14:44 +0100)
committerGunnar Beutner <gunnar.beutner@netways.de>
Tue, 28 Jan 2014 13:44:06 +0000 (14:44 +0100)
Fixes #5462

lib/icinga/externalcommandprocessor.cpp

index 0b206b94fc14173d827d2a026a0d03b68f676054..ae309989d9968fa0f837e9dd2435683db4892fdf 100644 (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);