+

Fixed UOM in bytes finaly for performance data

root [2011-01-17 16:16:51]
Fixed UOM in bytes finaly for performance data
Filename
check_mem
diff --git a/check_mem b/check_mem
index 3dc3431..3ed6691 100755
--- a/check_mem
+++ b/check_mem
@@ -25,8 +25,8 @@ CS=`echo $4|cut -d',' -f2`
 RET=0
 MSG=""

-MT=`free|grep Mem|awk '{print $2}'`
-MU=`free|grep Mem|awk '{print $3-$7}'`
+MT=`free -b|grep Mem|awk '{print $2}'`
+MU=`free -b|grep Mem|awk '{print $3-$7}'`
 if [ "$MT" == "0" -o "$MT" == "" ]
 then
 	echo "CRITICAL - Can't read memory informations"
@@ -46,8 +46,8 @@ MSG="Mem : $MR% used"

 if [ $SWAP -eq 1 ]
 then
-	ST=`free|grep Swap|awk '{print $2}'`
-	SU=`free|grep Swap|awk '{print $3}'`
+	ST=`free -b|grep Swap|awk '{print $2}'`
+	SU=`free -b|grep Swap|awk '{print $3}'`
 	if [ "$ST" == "0" -o "$ST" == "" ]
 	then
 	        echo "CRITICAL - Can't read memory informations"
@@ -70,7 +70,7 @@ let MWV=MT*WM/100
 let MCV=MT*CM/100
 let SWV=ST*WS/100
 let SCV=ST*CS/100
-MSG="$MSG | mem=${MU}KB;$MWV;$MCV;0;$MT swap=${SU}KB;$SWV;$SCV;0;$ST"
+MSG="$MSG | mem=${MU}B;$MWV;$MCV;0;$MT swap=${SU}B;$SWV;$SCV;0;$ST"

 [ $RET -eq 2 ] && echo "CRITICAL - $MSG" && exit 2
 [ $RET -eq 1 ] && echo "WARNING - $MSG" && exit 1
ViewGit