Solved

solaris system information

Posted on 2011-09-27
10
456 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
 
LVL 7

Expert Comment

by:Jacobfw
ID: 36708845
prtdiag may have additional information that you want
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

When you do backups in the Solaris Operating System, the file system must be inactive. Otherwise, the output may be inconsistent. A file system is inactive when it's unmounted or it's write-locked by the operating system. Although the fssnap utility…
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
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.:
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

919 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now