aboutsummaryrefslogtreecommitdiff
path: root/check_mem
diff options
context:
space:
mode:
authorGravatar Jonas Gunz <himself@jonasgunz.de> 2020-11-18 14:28:59 +0100
committerGravatar Jonas Gunz <himself@jonasgunz.de> 2020-11-18 14:28:59 +0100
commita891c68d86a9956f26821ec84e12f8f1a852c56b (patch)
tree6bec801cfd975ee56020e54680971bb331aa3f7d /check_mem
parent38c0a899844e16483b21d96973f6bf21436dc4a2 (diff)
downloadmonitoring_custom-a891c68d86a9956f26821ec84e12f8f1a852c56b.tar.gz
check_mem deciaml places
Diffstat (limited to 'check_mem')
-rwxr-xr-xcheck_mem9
1 files changed, 5 insertions, 4 deletions
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