Operating System - HP-UX
1832171 Members
2978 Online
110038 Solutions
New Discussion

Determining amount of installed memory

 
Karsten Radke_1
Advisor

Determining amount of installed memory

Hi fellows,

does anybody know how to find out the amount of installed memory on a HP-UX box via command line?

I would like to obtain this information from a large number of servers ranging from R-Class to IA-64 Superdome with 11.00, 11.11 and 11.23.

On 95% of these systems, the following one-liner does the job:

echo "selclass qualifier memory;info;wait;infolog" | /usr/sbin/cstm | grep "Total Configured Memory" | uniq

The remaining 5% are my problem. I did not find out why this one-liner does not work there. There aren't any differences to the machines on which this script is working (e.g. L-Class with UX11.0 vs. L-Class with same OS).

Therefore i would like to know if there might be another way to get this info.

Thanks in advance,
Karsten
9 REPLIES 9
Pete Randall
Outstanding Contributor

Re: Determining amount of installed memory

Karsten,

This little script should do the job:


HPUX=/stand/vmunix
MAJORREV=$(uname -r | cut -f2 -d .)
if [ $MAJORREV -ge "11.0" ]
then
MYSYMBOL="phys_mem_pages"
else
MYSYMBOL="physmem"
fi

MYMEM=$(echo "${MYSYMBOL}/D" \
| adb $HPUX /dev/kmem \
| grep "${MYSYMBOL}: *." \
| awk '{printf "%.0f MB\n",$2/256}')
echo $MYMEM


Pete

Pete
RAC_1
Honored Contributor

Re: Determining amount of installed memory

Thay command line will work, if you have STM(support tool manager) installed on your machine.

Instead try grep -i physical /var/adm/syslog/syslog.log

echo "memory_installed_in_machine/D"|adb -k /stand/vmunix /dev/kmem.

The value is in bufpages. A bufpage is 4096k

Anil
There is no substitute to HARDWORK
Victor BERRIDGE
Honored Contributor

Re: Determining amount of installed memory

Hi,
Would this work?
# dmesg|grep Phys
Physical: 4194304 Kbytes, lockable: 3790920 Kbytes, available: 3593184 Kbytes



All the best
Victor
twang
Honored Contributor

Re: Determining amount of installed memory

How much memory:
# echo "selclass qualifier memory;info;wait;infolog" | cstm | grep 'Total Configured'
# echo 'memory_installed_in_machine/D' | adb -k /stand/vmunix /dev/mem | perl -nle'/(\d+)/&&print$1*4,"k"'
Jeff_Traigle
Honored Contributor

Re: Determining amount of installed memory

Victor, typically the dmesg method will work and it's the way I tell people to check just because it's pretty easy for me (and them) to remember. However, I have had occasions in the past when error messages have accumulated so that the initial boot messages that dmesg typically display, which includes the physical memory installed, were pushed out of "buffer".
--
Jeff Traigle
Geoff Wild
Honored Contributor

Re: Determining amount of installed memory

Here a little script called hpmem - need root access:

# hpmem
HP-UX pc0003 B.11.11 U 9000/800 2504392627 unlimited-user license
CPU Count: 6
CPU Speed: 750 MHz
CPU HW Support: 64-bit
Kernel Support: 64-bit
RAM Size: 10080 MB
bufpages: 806 MB
maxuprc: 800
maxvgs: 128
maxfiles: 2048
max_thread_proc: 256
nfile: 189100
nflock: 1200
nproc: 2560
ninode: 16384
shmmax: 1073741824
shmmni: 256
dbc_max_pct: 8

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.
Kyri Pilavakis
Frequent Advisor

Re: Determining amount of installed memory

Try /usr/sbin/dmesg | grep -i Physical =for memory [small p for page size]
OR

grep Physical /var/adm/syslog/syslog.log
Bosses don't undestand..HP does
Karsten Radke_1
Advisor

Re: Determining amount of installed memory

Thanks to everyone for the feedback!

I will summarize what i've found out so far using the above suggestions:

All approaches using adb work nice, but this niceness is limited to machines with PA processors, because the adb syntax has changed in the IA-64 release (UX 11.23). I've tested all of them on an Itanium2 Superdome Partition, but the scripts returned an error complaining about the "/D" in the string being piped to adb, and the adb itself didn't accept the "-k" option (deprecated option according to the man page). The tests on three selected PA machines (R390, L2000 and RP8400) were successful.
To twang: the perl phrase does not seem to produce any output. I'm not really a perl expert, so i could not verify this :-)
To Geoff: i will test your script if i'm back in office next week, but i fear that it also will only work properly on PA systems.

The dmesg and syslog can possibly contain information of the physical memory, but this cannot be guaranteed, because dmesg is a ring buffer, as stated correctly by Jeff, and on our systems, the syslog file will be processed by logrotate regularly, so grepping after a "memory" string might fail.

Greetings,
Karsten
Peter Marais
Frequent Advisor

Re: Determining amount of installed memory

Hi Karsten
Found using adb -o option in Itanium systems for backword compatibility works.