aboutsummaryrefslogtreecommitdiff
path: root/check_mem
diff options
context:
space:
mode:
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