Solved

solaris system information

Posted on 2011-09-27
10
463 Views
Last Modified: 2012-05-12
Hi,

I am writing a shell script in solaris that will capture the system information like below

echo "$HOSTNAME"
echo "----------------------------------"
echo "Hostname                          
echo "Host IP address(es)             
echo "Main Memory (MB)            
echo "Physical CPUs on Machine       
echo "Number of Cores per CPU           
echo "Total Number of CPUs/ Virtual CPU        
echo "CPU Type                    
echo "OS Name                                    
echo "OS Release                       
echo "OS Architecture (32/64)         
echo "Kernel Version                    
echo "Hardware Manufacturer         
echo "Hardware Make/Model                     

The above script I had it for Linux and works good. Since the linux commands wont work on Solaris i need another sets of commands..

Please help
0
Comment
Question by:luser9999
10 Comments
 

Author Comment

by:luser9999
ID: 36708628
so far I found,

HOSTNAME=`hostname`
IP_ADDRS=`/sbin/ifconfig -a | grep 'inet' | grep -v '127.0.0.1' | cut -f2 -d ' '`
IP_ADDRS=`echo $IP_ADDRS | sed 's/\n//g'`

MEMORY=`/usr/sbin/prtconf | grep 'Memory' | cut -f2 -d ":"`
0
 

Author Comment

by:luser9999
ID: 36708754
can any one please respond .. kind of urgent

thanks
0
 
LVL 7

Expert Comment

by:Jacobfw
ID: 36708838
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 7

Expert Comment

by:Jacobfw
ID: 36708845
prtdiag may have additional information that you want
0
 
LVL 7

Expert Comment

by:Jacobfw
ID: 36708847
/usr/platform/`uname -i`/sbin/prtdiag -v

/usr/sbin/prtconf
0
 

Author Comment

by:luser9999
ID: 36708944
I am running on a vm based x86 solaris instance and above commands does not much of help..

I finally need the following, if you can give me a command that would be great...
Physical CPUS :
Number of cores per CPU
Total number of CPU/ virtual CPU
CPU MHz
OS Architecture
OS Kernel
Hardware model/ vendor

thanks
0
 

Author Comment

by:luser9999
ID: 36709018
can some one tell me if these are correct

NPROC=`(/usr/bin/kstat -m cpu_info | grep chip_id | sort -u | wc -l | tr -d ' ')`
VPROC=`(/usr/bin/kstat -m cpu_info | grep 'module: cpu_info' | sort -u | wc -l | tr -d ' ')`
NCORE=`(/usr/bin/kstat -m cpu_info | grep core_id | awk '{ print $2 }'| sort -u | wc -l | tr -d ' ')`
CORES=$(($VPROC/$NCORE))

NPROC= number of physical processor
VPROC virtual processors
NCORE- number of cores
CORES cores per cpu
0
 
LVL 77

Expert Comment

by:arnold
ID: 36710207
uname -a has information that will indicate which platform it is on Sparc or the alternative.
more /etc/release
0
 
LVL 1

Accepted Solution

by:
asmodeus66 earned 500 total points
ID: 36716136
are you looking for something like this
echo `/usr/bin/hostname`
echo "----------------------------------"
echo "Hostname "`/usr/bin/hostname`
echo "Host IP address(es)" $(/sbin/ifconfig -a | /usr/bin/awk 'BEGIN {ips=""} /inet/ && $2 !~ /127.0.0/ {ips=ips", "$2} END {print substr(ips,3)}')
echo "Main Memory (MB)" $(/usr/sbin/prtconf | /usr/bin/awk '/Memory size/ {print $3,$4}')
echo "Physical CPUs on Machine"$(/usr/sbin/psrinfo -pv | grep 'The physical' | /usr/bin/wc -l)
echo "Number of Cores per CPU "$(/usr/sbin/psrinfo -pv | /usr/bin/head -1 | /usr/bin/awk '{print $5}')
echo "Total Number of CPUs/ Virtual CPU"$(/usr/sbin/psrinfo | /usr/bin/wc -l)
echo "CPU Type" $(/usr/sbin/psrinfo -pv | /usr/bin/awk '{if (NR==2) print $1}')
echo "OS Name" $(uname -s)
echo "OS Release" $(uname -r)
echo "OS Architecture (32/64)" $(/usr/bin/file /platform/`uname -i`/kernel/unix | /usr/bin/awk '{print $3}')
echo "Kernel Version" $(uname -v)
/usr/platform/`uname -i`/sbin/prtdiag -v | head -1 | \
 nawk -v tag=`uname -m` \
 'BEGIN {manuf="";model="";arch=0}
  {for (i=3; i<=NF; i++)
   { if ($i==tag) {arch=1;continue}
     if (arch==0) manuf=manuf " " $i;
      else model=model " " $i}
   }
   END {printf("Hardware Manufacturer%s\n",manuf);
        printf("Hardware Make/Model%s\n",model)}'

Open in new window


Example output
user@host ~ $./test.sh
host
----------------------------------
Hostname hostname
Host IP address(es) 10.x.x.x, 10.x.x.x, 10.x.x.x, 10.x.x.x, 10.x.x.x, 10.x.x.x, 10.x.x.x, 10.x.x.x, 10.x.x.x
Main Memory (MB) 130848 Megabytes
Physical CPUs on Machine 2
Number of Cores per CPU 64
Total Number of CPUs/ Virtual CPU 128
CPU Type UltraSPARC-T2+
OS Name SunOS
OS Release 5.10
OS Architecture (32/64) 64-bit
Kernel Version Generic_142909-17
Hardware Manufacturer Sun Microsystems
Hardware Make/Model T3-1

Open in new window


tested on t3/t5240/M5000
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to Insert a File Using Text Editor 9 92
VBA Shell can't Find Word document 11 110
Debugging a shell script 3 31
AWK:  END { statements } 2 18
Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
Background Still having to process all these year-end "csv" files received from all these sources (including Government entities), sometimes we have the need to examine the contents due to data error, etc... As a "Unix" shop, our only readily …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question