Operating System - HP-UX
1834267 Members
83393 Online
110066 Solutions
New Discussion

Memory usage monitoring ?

 
SOLVED
Go to solution
Binu Raj_1
Occasional Contributor

Memory usage monitoring ?


Hello,

I have a requirement to collect the memory usage of an HPUX system over a period of time (samples every 10 minutes for one full day). Can somebody out there please suggest a standard script, which allows to:

1) Give total physical memory on the system?
2) Memory used by the kernel (system)?
3) Memory used by user processes?
4) Free memory?
5) Total VM?
6) Used VM?

Vmstat does give the number of free memory pages. Couple of things I am concerned about is:

The dynamic nature of buffer cache.
Memory paging when it is enabled.

Can someone out there please help me how to develop a script if there is no standard script? What would be the right approach if I have to develop a simple but useful script, which gathers all the above information?

Thanks in advance

Regards

Binu
7 REPLIES 7
Geoff Wild
Honored Contributor

Re: Memory usage monitoring ?

Here's a C program called memdetail - output like:

# memdetail
Memory Stat total used avail %used
physical 10080.0 9838.1 241.9 98%
active virtual 10642.0 3042.1 7599.9 29%
active real 7259.4 1945.1 5314.4 27%
memory swap 7693.6 1725.8 5967.7 22%
device swap 26528.0 10254.2 16273.8 39%

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: Memory usage monitoring ?

Here's a shell script called usermem:

# usermem gwild

Memory claimed by gwild: 1516 Kbytes.

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.
Anupam Anshu_1
Valued Contributor

Re: Memory usage monitoring ?

Hi Binu,

Most of these outputs would be displayed using top(1).

Regards,

Anshu
SIJU JOSE
Frequent Advisor

Re: Memory usage monitoring ?

Hi Binu

I found this from one of the forum`s script sites.But the following command gives a lot of info.

/usr/contrib/Q4/bin/kmeminfo

HTH

Siju Jose
Sundar_7
Honored Contributor

Re: Memory usage monitoring ?

1) echo "phys_mem_pages/D" | adb -k /stand/vmunix /dev/kmem | tail -1

the output is in pages (4 KB)

2) & 3) Download the attache kmeminfo and run.

4) echo "freemem/D" | adb -k /stand/vmunix /dev/kmem | tail -1

the output is in pages (4 KB)

5) you can use glance

Thanks,

Sundar
Learn What to do ,How to do and more importantly When to do ?
iminus
Frequent Advisor

Re: Memory usage monitoring ?

Do a top command, there should be a line state your memory size, it should be sth like:

"Memory: xxxK (xxxK) real, xxxK (xxxK) virtual, xxxK free"
hope it helps
Bill Hassell
Honored Contributor
Solution

Re: Memory usage monitoring ?

The buffer cachye is only of many complex memory usagge stats. You left out shared memory, shared libraries, memory mapped files, etc. Classic Unix tools like top and vmstat are too crude to give you a true picture of memory usage. Glance has been mentioned and it (along with Measureware) is the only accurate solution to you requirement. And to properly describe all the details, you'll need to look at the proc_mgmt and mem_mgmt white papers to get an idea how all of this goes together.


Bill Hassell, sysadmin