I have a super simple plugin that executes a command on a remote windows server and checks that the output contains "Ja"
It looks like this:
Code: Select all
#!/bin/bash
RESULT=$(/usr/lib/nagios/plugins/check_nrpe -H $1 -c checksnap)
CROP=$(echo $RESULT | grep Status | cut -d' ' -f2)
POS=$(echo "Ja")
if [ ! -n "$1" ]
then
echo "Du måste specifisera HOST"
exit 3
fi
if [ $CROP=$POS ]; then
SC="OK"
EX=0
else
SC="CRITICAL"
EX=2
fi
echo "$SC $RESULT"
exit $EX
where SC=OK and RESULT=OK Status: Ja 00:00:00.0781250OK Status: Ja 00:00:00.0781250
But the variable RESULT never shows up as Status Information in Nagios!
If I create the variable like RESULT=$(echo "Status: Ja 00:00:00.0781250"), it obviously works.
Why does this happen?
Thanks
//Oscar