Skip to content

Commit

Permalink
swap warning/critical block ordering in if statment
Browse files Browse the repository at this point in the history
  • Loading branch information
pgraziano committed Oct 10, 2018
1 parent c147142 commit 214c010
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions sensu/plugins/check-apt-cache.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 214c010

Please sign in to comment.