nagios: Fix check_rdns return codes
authorStefan Huber <shuber@sthu.org>
Sat, 18 Mar 2017 09:07:02 +0000 (10:07 +0100)
committerStefan Huber <shuber@sthu.org>
Sat, 18 Mar 2017 09:07:02 +0000 (10:07 +0100)
Instead of STATE_* variables mistyped counterparts STATUS_* were
returned as exit codes.

Reported-by: Ralph Oesker <ralph@oesker.com>
nagios/plugins/check_rdns

index 90a8ce6abe9e2dc6db6a4288618fa34f4d643f59..f99792b10d2c58f33cfa4b6df6d841c534a1790d 100755 (executable)
@@ -104,14 +104,14 @@ DIGSTATUS=$?
 
 if [ $DIGSTATUS != "0" ]; then
     echo "DNS failed: dig exit code $DIGSTATUS |"
 
 if [ $DIGSTATUS != "0" ]; then
     echo "DNS failed: dig exit code $DIGSTATUS |"
-    exit $STATUS_CRITICAL
+    exit $STATE_CRITICAL
 fi
 
 # Get the actual result
 HOST=$(echo "$RESULT" | grep -m 1 -o "[[:space:]]IN[[:space:]]*PTR[[:space:]].*\.$" | awk '{ print $3 }' )
 if [ -z "$HOST" ]; then
     echo "DNS failed: reverse DNS gave no answer. |"
 fi
 
 # Get the actual result
 HOST=$(echo "$RESULT" | grep -m 1 -o "[[:space:]]IN[[:space:]]*PTR[[:space:]].*\.$" | awk '{ print $3 }' )
 if [ -z "$HOST" ]; then
     echo "DNS failed: reverse DNS gave no answer. |"
-    exit $STATUS_CRITICAL
+    exit $STATE_CRITICAL
 fi
 
 
 fi
 
 
@@ -123,7 +123,7 @@ MATCHED=
 if [ -n "$EXPECT" ]; then
     if [ "$EXPECT" != "$HOST" ]; then
         echo "DNS critical - query result \"$HOST\" != \"$EXPECT\", query time: $QUERYTIME msec |"
 if [ -n "$EXPECT" ]; then
     if [ "$EXPECT" != "$HOST" ]; then
         echo "DNS critical - query result \"$HOST\" != \"$EXPECT\", query time: $QUERYTIME msec |"
-        exit $STATUS_CRITICAL
+        exit $STATE_CRITICAL
     else
         MATCHED=" (match ok)"
     fi
     else
         MATCHED=" (match ok)"
     fi
@@ -131,14 +131,14 @@ fi
 
 if [ -n "$CRITICAL" ] && [ "$QUERYTIME" -gt "$CRITICAL" ]; then
     echo "DNS critical - query time $QUERYTIME msec too large ($CRITICAL msec), query result: \"$HOST\"$MATCHED |"
 
 if [ -n "$CRITICAL" ] && [ "$QUERYTIME" -gt "$CRITICAL" ]; then
     echo "DNS critical - query time $QUERYTIME msec too large ($CRITICAL msec), query result: \"$HOST\"$MATCHED |"
-    exit $STATUS_CRITICAL
+    exit $STATE_CRITICAL
 fi
 
 if [ -n "$WARNING" ] && [ "$QUERYTIME" -gt "$WARNING" ]; then
     echo "DNS warning - query time $QUERYTIME msec too large ($WARNING msec), query result: \"$HOST\"$MATCHED |"
 fi
 
 if [ -n "$WARNING" ] && [ "$QUERYTIME" -gt "$WARNING" ]; then
     echo "DNS warning - query time $QUERYTIME msec too large ($WARNING msec), query result: \"$HOST\"$MATCHED |"
-    exit $STATUS_WARNING
+    exit $STATE_WARNING
 fi
 
 echo "DNS OK - query time $QUERYTIME msec, query result: \"$HOST\"$MATCHED |"
 fi
 
 echo "DNS OK - query time $QUERYTIME msec, query result: \"$HOST\"$MATCHED |"
-exit $STATUS_OK
+exit $STATE_OK