Memory Calculation Script!

Taking care of your Linux box.
refra
Naik
Posts: 69
Joined: Wed Dec 06, 2006 3:51 pm

Memory Calculation Script!

Postby refra » Sat Jul 25, 2009 9:33 am

AOA,

I need a script that calculate Free, Virtual Memory in percentage(%).

lambda
Major General
Posts: 3452
Joined: Tue May 27, 2003 7:04 pm
Location: Lahore
Contact:

Postby lambda » Sat Jul 25, 2009 11:38 am

learn awk.
Watch out for the Manners Taliban!
Isn't it amazing how so many people can type "linuxpakistan.net" into their browsers but not "google.com"?

mfaisalkh
Havaldaar
Posts: 124
Joined: Wed Mar 17, 2004 4:05 pm
Location: Karachi

Postby mfaisalkh » Wed Aug 05, 2009 1:46 pm

AOA,

Try this:

SIZE=`free -m | grep Mem | cut -d " " -f11`
USED=`free -m | grep Mem | cut -d " " -f13-18`
PUSED=`echo 100 \* $USED / $SIZE | bc `

echo
echo "Total Physical Memory Physical Memory Used Memory Used (%)"
echo " $SIZE MB $USED MB $PUSED%"

lambda
Major General
Posts: 3452
Joined: Tue May 27, 2003 7:04 pm
Location: Lahore
Contact:

Postby lambda » Wed Aug 05, 2009 2:27 pm

he didn't ask for physical memory stats.
Watch out for the Manners Taliban!
Isn't it amazing how so many people can type "linuxpakistan.net" into their browsers but not "google.com"?

nomankhn
Colonel
Posts: 714
Joined: Wed Aug 07, 2002 8:00 pm

Re: Memory Calculation Script!

Postby nomankhn » Fri Aug 07, 2009 11:54 pm

refra wrote:AOA,

I need a script that calculate Free, Virtual Memory in percentage(%).



FYI

http://serverfault.com/questions/38065/ ... ith-vmstat

Thanks,
Noman


Return to “Administration”

Who is online

Users browsing this forum: No registered users and 1 guest