Operating System - HP-UX
1833758 Members
2122 Online
110063 Solutions
New Discussion

Mem and Swap info in HP-UX

 
Nham Nhi
New Member

Mem and Swap info in HP-UX

Does anyone know how to get the Memory and Swap (used, free, total) like sar -r in Linux and Sun produce??? I don't think sar in HP has -r option (none of my servers does)....

Any help would be greatly appreciated.

thanks in advance
10 REPLIES 10
Sridhar Bhaskarla
Honored Contributor

Re: Mem and Swap info in HP-UX

Hi,

You can get swap information using the command

swapinfo -mt

Use vmstat to get the memory stats. Multiply the freelist (free column) with 4k and you will get free memory.

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

Re: Mem and Swap info in HP-UX

SAM
Preformance Monitors
System Properties
Memory


Nham Nhi
New Member

Re: Mem and Swap info in HP-UX

Thanks for all inputs.

Sridhar, Why do the number have to be multiple with 4?? Is this the only way we can get this info??? I guess that answered my question that no -r for sar in HP-UX...

Paul, I want to script this, so it has to be on command line....thanks though...

thanks
Sridhar Bhaskarla
Honored Contributor

Re: Mem and Swap info in HP-UX

Hi,

The number you get in vmstat under free is in pages. Each page is 4k. So for you to get the free memory in KB, you will need to multiply with 4k.

If you have Measureware installed, you can get historical information on both swap and memory as well as numerous other performance related stats. It's worth considering.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Nham Nhi
New Member

Re: Mem and Swap info in HP-UX

Thanks Sridhar, I have one more question. Is there any command out there (for HP-UX) to report the number of total and/or used memory on a server???

thanks
Mladen Despic
Honored Contributor

Re: Mem and Swap info in HP-UX

Check this out:

http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xa56442308663d611abdb0090277a778c,00.html

If you have Glance or Measureware, you can try the adviser syntax as posted at the link above. For swap space utilization, one of the metrics you can use is:

GBL_SWAP_SPACE_UTIL
Sridhar Bhaskarla
Honored Contributor

Re: Mem and Swap info in HP-UX

Hi,

You know how to get the free pages using vmstat

Use the following command to find the memory on the system.

echo 'phys_mem_pages/D'| adb -k /stand/vmunix /dev/kmem

Multiply above with 4k to get total memory in kb.

If you take the difference between the above two, you will get used memory.

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

Re: Mem and Swap info in HP-UX

Hi (Again),

You can use cstm or syslog.log to get the total memory. But they are not very consistent if you want to script them.

So get the free memory using vmstat statement and total memory using the adb command as I mentioned. Both are in pages so multiply them with 4k.

If you have Measureware installed, you dont' need to worry about scripting. They have these metrics readily available and you can get the information anytime you want.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Nham Nhi
New Member

Re: Mem and Swap info in HP-UX

I did look at that thread, but we're not using glance or measureware, plus the Mem info line from top in HP doesn't seem to report right.

When I added the numbers with many senarios, the total kept changing. This tells me somehow these numbers are not representing everything unless I do my calculation wrong.


I did the followings with many times for each senario.

Real + Active real (inside parentheses) + free

and

Real + Virtual + free

and

Real + Active real + Virtual + Active virtual + free

and

etc...

thinking if any of these is the total, then the number should stay fixed, but it did not....
Bill Hassell
Honored Contributor

Re: Mem and Swap info in HP-UX

top has never reported meaningful memory usage values. Part of the problem is defining what you mean by memory usage. Is it just the program space (data, text, stack) or do you need shared memory items such as shared libraries, memory mapped files and shared memory segments. Then there's the buffer cache which is shared by all programs, and memory used by the kernel.


Bill Hassell, sysadmin