From a891c68d86a9956f26821ec84e12f8f1a852c56b Mon Sep 17 00:00:00 2001 From: Jonas Gunz Date: Wed, 18 Nov 2020 14:28:59 +0100 Subject: check_mem deciaml places --- check_mem | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'check_mem') diff --git a/check_mem b/check_mem index c971ae9..09b4ba8 100755 --- a/check_mem +++ b/check_mem @@ -32,13 +32,14 @@ while read line; do break done <<< $(free | tail -n -2) -PERCENT_USED=$(echo "scale=2; $USED / $TOTAL * 100 / 1" | bc -l) -PERCENT_USED=${PERCENT_USED%.*} +PERCENT_USED=$(echo "scale=4; $USED / $TOTAL * 100 " | bc -l) +PERCENT_USED=${PERCENT_USED%00} +PERCENT_USED_INT=${PERCENT_USED%.*} -if [ $PERCENT_USED -ge $CRIT ]; then +if [ $PERCENT_USED_INT -ge $CRIT ]; then RET=2 echo -n "Memory CRITICAL: " -elif [ $PERCENT_USED -ge $WARN ]; then +elif [ $PERCENT_USED_INT -ge $WARN ]; then RET=1 echo -n "Memory WARNING: " else -- cgit v1.2.3