1
0
mirror of https://github.com/opinkerfi/nagios-plugins.git synced 2024-11-23 10:53:44 +01:00

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 :-)
This commit is contained in:
Florian Heigl 2016-10-02 20:25:42 +02:00 committed by GitHub
parent 7dc3b57582
commit ee5adc2363

View File

@ -74,17 +74,17 @@ OUTPUT=`$CHECK_COMMAND`
RESULT=$? RESULT=$?
if [ $RESULT -gt 0 ]; then if [ $RESULT -gt 0 ]; then
echo "Error - Could not run command $CHECK_COMMAND" echo "UNKNOWN - Could not run command $CHECK_COMMAND"
echo "Error was: $OUTPUT" echo "Error was: $OUTPUT"
exit 3 exit 3
fi fi
# Parse the output from the command # Parse the output from the command
if [ "$OUTPUT" == "$STATUS" ]; then if [ "$OUTPUT" == "$STATUS" ]; then
echo "ok, selinux status is $OUTPUT" echo "OK - SELinux status is $OUTPUT"
exit 0 exit 0
else else
echo "warning, selinux status is $OUTPUT (supposed to be $STATUS)" echo "WARNING - SELinux status is $OUTPUT (supposed to be $STATUS)"
exit 1 exit 1
fi fi