From ee5adc2363a236cc39afcf70f96261d93a4b199d Mon Sep 17 00:00:00 2001 From: Florian Heigl Date: Sun, 2 Oct 2016 20:25:42 +0200 Subject: [PATCH] make the output compliant with Nagios First, use the proper keywords OK/WARN/UNKNOWN so the check follows the plugin guidelines Second, to not confuse things, the UNKNOWN case would give multiline output. The first bit goes to the status line, the second to the extended status info. I tried to not mess around, but I also made SELinux caps :-) --- check_selinux/check_selinux | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/check_selinux/check_selinux b/check_selinux/check_selinux index 196ec78..0fdb76c 100644 --- a/check_selinux/check_selinux +++ b/check_selinux/check_selinux @@ -74,17 +74,17 @@ OUTPUT=`$CHECK_COMMAND` RESULT=$? if [ $RESULT -gt 0 ]; then - echo "Error - Could not run command $CHECK_COMMAND" - echo "Error was: $OUTPUT" + echo "UNKNOWN - Could not run command $CHECK_COMMAND" + echo "Error was: $OUTPUT" exit 3 fi # Parse the output from the command if [ "$OUTPUT" == "$STATUS" ]; then - echo "ok, selinux status is $OUTPUT" + echo "OK - SELinux status is $OUTPUT" exit 0 else - echo "warning, selinux status is $OUTPUT (supposed to be $STATUS)" + echo "WARNING - SELinux status is $OUTPUT (supposed to be $STATUS)" exit 1 fi