Skip to content

Commit

Permalink
made output be standard nagios output and added option for warning ou…
Browse files Browse the repository at this point in the history
…tput
  • Loading branch information
Jesse Eichar committed Jun 22, 2012
1 parent 97e0ab5 commit e8d6bf9
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions monitoring/nagios/healthcheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ rm -f $COOKIE_FILE

RESPONSE="Health checks pass"
EXIT=$STATE_OK
STATUS="OK"
if [ "x$CODE" != "x200" ]; then
# Add line to file so that last line is processed by while loop
echo "" >> $OUT
Expand All @@ -43,9 +44,16 @@ if [ "x$CODE" != "x200" ]; then
fi
done < $OUT
ISWARNING=`grep -q "/warninghealthcheck" <<< $CHECK`
if [ "x$ISWARNING" != "x" ]; then
STATUS="WARNING"
EXIT=$STATE_WARNING
else
STATUS="CRITICAL"
EXIT=$STATE_CRITICAL
fi
RESPONSE=$FAILURE
EXIT=$STATE_CRITICAL
fi

echo $RESPONSE
echo "$STATUS: $RESPONSE"
exit $EXIT

0 comments on commit e8d6bf9

Please sign in to comment.