Operating System - HP-UX
1844523 Members
3433 Online
110233 Solutions
New Discussion

How to get the "Mem Util" %, without using glance ?

 
SOLVED
Go to solution
yyghp
Super Advisor

How to get the "Mem Util" %, without using glance ?

Does anyone know how to get the % of "Mem Util" without using glance ?

e.g.:
Mem Util S SU UB B | 94% 95% 95%

We don't have the license for glance, but want to monitor this value ...

Thanks!
7 REPLIES 7
John Carr_2
Honored Contributor

Re: How to get the "Mem Util" %, without using glance ?

Hi

why not use the HP workload manager you can have a 60 day trial for free

http://www.software.hp.com/portal/swdepot/displayProductInfo.do?productNumber=B8843CATRY

:-) John.
Geoff Wild
Honored Contributor
Solution

Re: How to get the "Mem Util" %, without using glance ?

This C program outputs like:

# memdetail
Memory Stat total used avail %used
physical 10080.0 10016.8 63.2 99%
active virtual 11428.6 4639.0 6789.6 41%
active real 7461.4 2939.8 4521.5 39%
memory swap 7697.1 1715.1 5981.9 22%
device swap 26528.0 11041.0 15487.0 42%

You can also get some info with vmstat and swapinfo.

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Juergen Tappe
Valued Contributor

Re: How to get the "Mem Util" %, without using glance ?

You can use "top".
You will see something similar to :
Memory: 109172K (39624K) real, 113228K (46160K) virtual, 81524K free

no % but good enough I hope.

You can try "vmstat" as well.
vmstat 5 2 will show you i.e. :
procs memory page faults cpu
r b w avm free re at pi po fr de sr in sy cs us sy id
0 0 0 9352 21066 50 25 0 0 25 0 0 1127 2256 137 6 9 85
0 0 0 10486 21021 28 2 0 0 2 0 0 1591 1209 85 5 6 90

The values are in Pages, and 1 page = 4KB as far as I know.
Working together
yyghp
Super Advisor

Re: How to get the "Mem Util" %, without using glance ?

Hi John, I just don't want to use the trial one, if not, i can't use glance...


Hi Geoff, do you know how to use vmstat and swapinfo to get that "mem util" %, exactly the same value ?



Lorenzo Facello
Valued Contributor

Re: How to get the "Mem Util" %, without using glance ?

Geoff Wild
Honored Contributor

Re: How to get the "Mem Util" %, without using glance ?

Another option - is top:

top -f /tmp/top.out
grep Memory /tmp/top.out

To see free memory with vmstat:

vmstat 1 2 | tail -1 | awk '{printf "%d%s\n", ($5*4)/1024, "MB" }'


But I thinkg the memdetail program is the best...

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Geoff Wild
Honored Contributor

Re: How to get the "Mem Util" %, without using glance ?

Here's a script I just wrote:

#!/bin/sh
typeset -i free used total percent
free=`vmstat 1 2 | tail -1 | awk '{print ($5*4)/1024}'`
total=`echo 'phys_mem_pages/D'|adb /stand/vmunix /dev/kmem|grep pages | tail -1 | awk '{print $2*4/1024}'`
((used=$total-$free))
((percent=$used *100 / $total ))
print "used memory: $percent%"

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.