From e8d6bf95229af7076cf279619eed101d4482de7e Mon Sep 17 00:00:00 2001 From: Jesse Eichar Date: Fri, 22 Jun 2012 13:27:03 +0200 Subject: [PATCH] made output be standard nagios output and added option for warning output --- monitoring/nagios/healthcheck.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/monitoring/nagios/healthcheck.sh b/monitoring/nagios/healthcheck.sh index 060a47ea608..f56702f229f 100755 --- a/monitoring/nagios/healthcheck.sh +++ b/monitoring/nagios/healthcheck.sh @@ -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 @@ -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 \ No newline at end of file