ADSM-L

CPU information Gatherer

2002-09-23 21:52:29
Subject: CPU information Gatherer
From: Steve Harris <Steve_Harris AT HEALTH.QLD.GOV DOT AU>
To: ADSM-L AT VM.MARIST DOT EDU
Date: Tue, 24 Sep 2002 11:50:21 +1000
Hi All,

With the new CPU based pricing there comes the task of definitively determining 
how many CPUs are installed on each machine.
To ease this pain, I've developed the following ksh script which starts to 
solve that problem.
It works for me on those unix servers to which I have SSH access.
It returns correct results for Solaris 6 and 7 on Netra, E3500 and E450 
machines, and AIX 4.3.3 on E30, R50 and F50 (or at least their SP equivalents)

Perhaps we could develop this further as a group to include other Unix flavours.

More importantly, can some of the windows guys amongst you advise how to do 
something similar for NT4 and Win2K? Preferably without having any special 
services running and without having any reskits installed.

#!/usr/bin/ksh

tmpfile="/tmp/prtdiag.$$"
# get processor info 
server="xxiu001 xxiu002 xxiu003 xxiu004 xxiu005 xxiu006 xxiu007 xxiu008 xxiu009 
xxsu002 xxsu003 xxsu004 xxsu005 xxsu006 xxsu007 xxsu008 xxsu009 xxsu010 xxsu012 
xxsu013 xxsu014"
for i in $server
do 

    os=$(ssh -x $i uname -a | awk '{print $1}')
    if [[ $os = "SunOS" ]]; then 
        PLATFORM=$(ssh $i /usr/bin/uname -i 2> /dev/null)
                (ssh $i /usr/platform/$PLATFORM/sbin/prtdiag) > $tmpfile
                cpucount=$(awk '/ CPUs /, / (Memory|IO Cards) /' $tmpfile | awk 
'$2 ~/[0-9]/' | wc -l)
        rm $tmpfile
    fi
    if [[ $os = "AIX" ]]; then
               cpucount=$(ssh -x $i lsdev -C | grep "^proc[0-9]" | wc -l)
    fi
    print "$i\t$os\t$cpucount"
done
                


In my environment, this produces the result

> ksh cpuinfo.ksh
xxiu001 AIX            1
xxiu002 AIX            8
xxiu003 AIX            8
xxiu004 AIX            8
xxiu005 AIX            8
xxiu006 AIX            8
xxiu007 AIX            8
xxiu008 AIX            2
xxiu009 AIX            2
xxsu002 SunOS          2
xxsu003 SunOS          4
xxsu004 SunOS          2
xxsu005 SunOS          4
xxsu006 SunOS          4
xxsu007 SunOS          2
xxsu008 SunOS          2
xxsu009 SunOS          1
xxsu010 SunOS          1
xxsu012 SunOS          1
xxsu013 SunOS          1
xxsu014 SunOS          4
> 



Steve Harris
AIX and TSM Admin
Queensland Health, Brisbane Australia



**********************************************************************
This e-mail, including any attachments sent with it, is confidential 
and for the sole use of the intended recipient(s). This confidentiality 
is not waived or lost if you receive it and you are not the intended 
recipient(s), or if it is transmitted/ received in error.  

Any unauthorised use, alteration, disclosure, distribution or review 
of this e-mail is prohibited.  It may be subject to a statutory duty of 
confidentiality if it relates to health service matters.

If you are not the intended recipient(s), or if you have received this 
e-mail in error, you are asked to immediately notify the sender by 
telephone or by return e-mail.  You should also delete this e-mail 
message and destroy any hard copies produced.
**********************************************************************

<Prev in Thread] Current Thread [Next in Thread>