System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

Memory Utilization on various HP UX flavors

muthu13_hpux
Occasional Visitor

Memory Utilization on various HP UX flavors

Hi,
My environment has a mix of UX 11.11,11.23 and 11.31 servers. I am trying to monitor the real Memory Utilization in them using swapinfo. Would like to know how close is swapinfo in finding real memory usage. Tried lot of other commands too that I've listed below.

1.Tried combination of vmstat free column and echo "selclass qualifier memory;info;wait;infolog" | cstm . But cstm package is not available in all boxes.
2.RAM size found from syslogs along with vmstat free column. Bad, my syslogs got rotated soon and I couldn't rely on that too.
3.Tried
T=`perl -e 'local($PSTAT,$PSTAT_STATIC,$mem_info,$PSTAT_STRUCT)=(239,2,"\0"x120,"LI4L");syscall($PSTAT,$PSTAT_STATIC,$mem_info,length($mem_info),1,0);
print int((unpack($PSTAT_STRUCT,$mem_info))[4]*((unpack($PSTAT_STRUCT,$mem_info))[5])/(1024*1024))."\n";'`;F=`vmstat 1 3|awk -v c=0 '{for (i=0;i<=NF;i++) if ($i=="free") c=i;} {print $c}'|tail -1`;echo "scale=3; ((($T-($F*4/1024))/$T)*100)"|bc

But this command wont work on Itanium based versions ie over HP UX 11.20 :(

For versions over 11.20 had to rely on machinfo and vmstat which goes like this

T=`machinfo|awk '/Memory/'|awk -v c=0 '{for (i=0;i
Swapinfo wont report even total memory available and used. It reports things in swap memory perspective. But swapinfo seems to be the only command that comes close to my purpose which is one command to find how my boxes' memory is doing.

Help please.

Muthu
4 REPLIES
Dennis Handly
Acclaimed Contributor

Re: Memory Utilization on various HP UX flavors

>swapinfo wont report even total memory available and used. It reports things in swap memory perspective.

Right, swapinfo report pseudo-swap usage and the definition of that changes on different HP-UX versions.
Any reason you need this accurate info?
Note with the buffer or file cache, you can get all of real memory used pretty easily.
muthu13_hpux
Occasional Visitor

Re: Memory Utilization on various HP UX flavors

Thanks Dennis for that info. But I couldn't quite understand how to get that buffer or file cache. Using swapinfo? I just need the real memory usage, ie memory consumed by processes in RAM. In fact, its possible to get the same info in most of the UNIX flavors but in HP UX. Even IBM has come up with few changes in svmon command in its latest versions to achieve this.
The commands listed in 3rd point of my post are good enough IMO but I am looking for a command that could be a panacea for Memory calculations across all UX flavors ;)
Dennis Handly
Acclaimed Contributor

Re: Memory Utilization on various HP UX flavors

>I couldn't quite understand how to get that buffer or file cache. Using swapinfo?

I was trying to say that the kernel will use free memory, between the bounds of the min and max of the buffer/file cache kernel parms.

Do you care about that memory usage?
likid0
Honored Contributor

Re: Memory Utilization on various HP UX flavors

I would suggest using the contrib tool kmeminfo, really easy to read out that you can script with no problems, and the output is the same for all the versions.

for example:
/usr/contrib/Q4/bin/kmeminfo | grep "Used.*="|cut -d= -f2|awk '{print $1*4/1024 " Mb"}'
Windows?, no thanks