1833883 Members
1474 Online
110063 Solutions
New Discussion

Reporting free memory

 
SOLVED
Go to solution
Gavin Stewart
Advisor

Reporting free memory

Hi,

I need to report on memory usuage over a monthly period, say every 30mins.

As Sar does not provide this can anyone recommend an easy way to do this? Does someone have a script that maybe uses vmstat to get these statistics? Ideally it needs to show used memory as a percentage.

Any advice apreciated.

Thanks.
5 REPLIES 5
Steven E. Protter
Exalted Contributor

Re: Reporting free memory

lots of ways.

swapinfo -tam

The memory portion of the sar script set I'm attaching can also be quite useful.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Sridhar Bhaskarla
Honored Contributor
Solution

Re: Reporting free memory

Hi Gavin,

From vmstat, you get 'free pages'. Multiply it with '4' to get it in KB. You would already know memory size of the system. Or use the following script.

#!/usr/bin/ksh

FREE=$(vmstat 2 1 |awk '{print $5}'|tail -1)
TOTMEM=$(echo "phys_mem_pages/D" |adb -k /stand/vmunix /dev/mem|tail -1|awk '{FS=":";print $2}')
(( PERCENT = $FREE * 100 / $TOTMEM ))
echo "Free memory is $PERCENT %"

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Alzhy
Honored Contributor

Re: Reporting free memory

If your environment is HP-UX Enterprise (ie your running a SuperDome or any of the Cell-Partionables).. you already have Measureware (now named HP OVPA). In its default config .. it's been gathering stats for you. TO get to the reports.. simply type "extract" -- and everything should be self explanatory.


Your other options.. glance -m, swapinfo and vmstat as others have already pointed out.
Hakuna Matata.
Steve Steel
Honored Contributor

Re: Reporting free memory

Hi


Look at

ftp://eh:spear9@hprc.external.hp.com/memory.htm



Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
Geoff Wild
Honored Contributor

Re: Reporting free memory

I get it from measureware:

# cat zgbltemplate
REPORT "MWA Export on !SYSTEM_ID"
FORMAT ASCII
HEADINGS ON
SEPARATOR="|"
SUMMARY=60
MISSING=0
DATA TYPE GLOBAL
YEAR
DATE
TIME
GBL_CPU_TOTAL_UTIL
GBL_MEM_UTIL
GBL_SWAP_SPACE_UTIL
GBL_MEM_CACHE_HIT_PCT
GBL_DISK_UTIL_PEAK
GBL_FS_SPACE_UTIL_PEAK


crontab -l
55 23 * * 1-5 /opt/perf/bin/extract -xp -r /home/gwild/zgbltemplate -g -b today 7:00 -e today 18:00 -f stdout | /bin/mailx -s 'svr1000 performance report' gwild@mydomain.com >/dev/null 2>&1

Output like:

MWA Export on svr1000
| | | |Memory| |Cache | Peak | Pk FS |
Year| Date |Time |CPU % | % |Swap %|Hit % |Disk %| Sp % |
2004|11/05/04|07:00| 46.14| 99.66| 48.00| 88.17| 45.97| 99.64|
2004|11/05/04|07:05| 12.71| 98.52| 48.00| 96.07| 5.79| 99.64|
2004|11/05/04|07:10| 11.02| 98.63| 48.00| 99.09| 5.65| 99.64|
2004|11/05/04|07:15| 13.83| 98.89| 48.00| 95.49| 11.78| 99.64|
2004|11/05/04|07:20| 29.16| 97.74| 48.00| 89.26| 25.27| 99.64|
2004|11/05/04|07:25| 9.52| 97.83| 48.00| 97.76| 5.07| 99.64|
2004|11/05/04|07:30| 12.87| 97.96| 48.00| 97.96| 6.68| 99.64|

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.