Solved

solaris system information

Posted on 2011-09-27
10
454 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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
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 76

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

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…
I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

758 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

20 Experts available now in Live!

Get 1:1 Help Now