KS-Soft. Network Management Solutions
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister    ProfileProfile    Log inLog in 

Relative MEM free script:

 
Post new topic   Reply to topic    KS-Soft Forum Index -> Library
View previous topic :: View next topic  
Author Message
mos-eisley



Joined: 21 Mar 2007
Posts: 76
Location: Klarup (AAlborg), Demark

PostPosted: Fri Jun 29, 2007 12:23 am    Post subject: Relative MEM free script: Reply with quote

We have made an alternative script (for Linux), showing how much memory are free ( in %):

# Test for the 2 arguments
if [ ! $# -eq 2 ]
then
echo "ScriptRes:Unknown:Missing Parameter(s)"
exit
fi

CRITICAL=$1
WARNING=$2

USED=`free -lm | awk 'NR < 3 && NR > 1 {printf("%.0f", (($7 '+' $4) '/' $2) '*' 100)}'`
FREE=`echo $USED | awk '{print (100 '-' $1)}'`

if [ $USED -gt $CRITICAL ]
then
echo "ScriptRes:Bad:$FREE% Free "
exit
else
if [ $USED -gt $WARNING ]
then
echo "ScriptRes:Warning:$FREE% Free"
exit
else
echo "ScriptRes:Ok:$FREE% Free"
fi
fi
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    KS-Soft Forum Index -> Library All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

KS-Soft Forum Index