From 214c01032461469b2508fe56efc0abfb3c64a82d Mon Sep 17 00:00:00 2001 From: pgraziano Date: Wed, 10 Oct 2018 15:55:38 +0000 Subject: [PATCH] swap warning/critical block ordering in if statment --- sensu/plugins/check-apt-cache.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sensu/plugins/check-apt-cache.sh b/sensu/plugins/check-apt-cache.sh index 60baca9..3187e2c 100755 --- a/sensu/plugins/check-apt-cache.sh +++ b/sensu/plugins/check-apt-cache.sh @@ -23,12 +23,12 @@ fi HOURS_SINCE_UPDATE=`echo $(( ($(date +%s) - $(date +%s -r "$FILE"))/60/60))` MINUTES_SINCE_UPDATE=`echo $(( ($(date +%s) - $(date +%s -r "$FILE"))/60))` -if [[ $HOURS_SINCE_UPDATE -gt $WARNING_HOURS ]]; then - echo "WARNING: stale apt cache, $HOURS_SINCE_UPDATE hours old." - exit 1 -elif [[ $HOURS_SINCE_UPDATE -gt $CRITICAL_HOURS ]]; then +if [[ $HOURS_SINCE_UPDATE -gt $CRITICAL_HOURS ]]; then echo "CRITICAL: stale apt cache, $HOURS_SINCE_UPDATE hours old." exit 2 +elif [[ $HOURS_SINCE_UPDATE -gt $WARNING_HOURS ]]; then + echo "WARNING: stale apt cache, $HOURS_SINCE_UPDATE hours old." + exit 1 fi echo "OK: last apt cache update was ${HOURS_SINCE_UPDATE}h (${MINUTES_SINCE_UPDATE}m) ago"