Operating System - HP-UX
1832856 Members
3048 Online
110047 Solutions
New Discussion

Retrieving # of CPU and speed

 
PatRoy
Regular Advisor

Retrieving # of CPU and speed

Hi.

I'm looking for a way to retrieve the number of CPUs and Speed on a given server using command line. Needs to be able to script this and on both, HP-UX 11.11 and HP-UX 11.23.

Anyways knows how? I can't find a proper way.

Cheers. Patrick
6 REPLIES 6
Paul Sperry
Honored Contributor

Re: Retrieving # of CPU and speed

man ch_rc
Pete Randall
Outstanding Contributor

Re: Retrieving # of CPU and speed

Lots of ways actually. Here's my canned response:


If you have Ignite installed, you can use the print_manifest command.

You can also use SAM to display system properties (Sam -> Performance
Monitors -> System Properties).

There are also utilities like "cfg2html" ( http://come.to/cfg2html ),
"nickel" ( ftp://ftp.hp.com/pub/catia/Utils/nickel.shar ) and "sysinfo"
( http://hpux.cs.utah.edu/hppd/hpux/Sysadmin/sysinfo-3.3.1/ ).

You can also obtain this information from the command line with a
series of little scripts like these:

CPU

HPUX=/stand/vmunix

MODEL=$(grep -i $(model | tr "/" " " \
| awk '{print $NF}') \
/usr/sam/lib/mo/sched.models \
| awk '{print $NF}')

#Note: for 11.23 RISC, use
MHZ=$(echo itick_per_tick/D \ # echo "itick_per_usec/d" \
| adb -k $HPUX /dev/kmem \ # | adb $HPUX /dev/kmem
| tail -1 \ #For Itanium, use machinfo
| awk '{print $2/10000}')
echo `hostname` has `ioscan -k |grep -n processor \
|wc -l` $MODEL $MHZ "Mhz processor(s)"


Number of CPUs

ioscan -k |grep -n processor |wc -l


Support Tools Manager (STM) CPU info:

echo "selclass qualifier cpu;info;wait;infolog" | cstm




RAM

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


Support Tools Manager (STM) RAM info:

echo "selclass qualifier memory;info;wait;infolog" | cstm




You can obtain CPU speed and RAM without CSTM or root access as described by Tom
Ferony (under Nancy Rippey's login) here:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=851889


Pete

Pete
PatRoy
Regular Advisor

Re: Retrieving # of CPU and speed

How can I tell what are the available parameters??

It gives out examples of VALUE, VARIABLE and ZZZ[x] param, but how am I to guess what are the proper ones for CPU, etc. ?
Paul Sperry
Honored Contributor

Re: Retrieving # of CPU and speed

On Itanium there is the machinfo command.



/usr/contrib/bin/machinfo
Tim Nelson
Honored Contributor

Re: Retrieving # of CPU and speed

A very popular topic.

#/usr/bin/ksh

OUTFILE=/tmp/get_sysinfo.csv
HOST_NAME=`hostname`
if [[ `uname -m` = "ia64" ]]
then
PROC_SPEED=`machinfo|awk '/Clock speed/ {print $4}'`
NU_PROC=` machinfo|awk '/Number of CPUs/ {print $5}'`
MODEL=`model|awk '{print $4}'`
MEM_MB=` machinfo|awk '/Memory/ {print $3}'`
else
PROC_SPEED=`echo itick_per_usec/D | adb -k /stand/vmunix /dev/kmem |awk -F: 'NR>1 {print $2}'`
NU_PROC=`echo "runningprocs/D" | adb -k /stand/vmunix /dev/kmem |awk -F: 'NR>1 {print $2}'`
MODEL=`model|awk -F/ '{print $3}'`
MEM=`echo "phys_mem_pages/D"| adb -k /stand/vmunix /dev/kmem |awk -F: 'NR>1 {print$2}'`
if [[ -z $MEM ]]
then
MEM=`echo "physmem/D"| adb -k /stand/vmunix /dev/kmem |awk -F: 'NR>1 {print$2}'`
fi
MEM_MB=`echo "$MEM * 4 / 1000"|bc`
fi
printf "%s,%s,%s,%s,%s\n" hostname model nu_proc proc_speed mem_mb>$OUTFILE
printf "%s,%s,%s,%s,%s\n" $HOST_NAME $MODEL $NU_PROC $PROC_SPEED $MEM_MB >>$OUTFILE
Paul Sperry
Honored Contributor

Re: Retrieving # of CPU and speed

number of processors:

ioscan -fnkC processor


Processor speed:

echo itick_per_usec/D | adb -k /stand/vmunix /dev/mem