Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 776
  • Last Modified:

Need to find the hardware details & Disk configration in Solaris 5

Hi,

I have been assign the task to find the hardware conf ( processror and ram and other details)
Ip address, ethernert spped , and amount of harddrive connected to the system as weel as the no. of harddrive connected.

buit i am a real novice in solaris so not able to find out myself, kindly let us know how i can achieve the above task.

Reagrds,
Rohan
0
rohanly
Asked:
rohanly
  • 3
  • 2
1 Solution
 
TintinCommented:
Use the following script
#!/bin/ksh
USAGE="Usage: `basename $0` [-Ddgkhnpst]"
 
SCRIPT=`basename $0` # Shortname of this script
RELEASE=`uname -r` # OS Release
PLATFORM=`uname -s` # Machine platform
 
#------------------------------------------------------------------------------
function help
{
  cat <<EOF
 
$USAGE
 
Displays useful configuration information on a Solaris system.
 
-D Debug mode
-d Available Disks
-g General machine configuration
-h Display help
-k Installed packages
-n Network interfaces
-p Disk partitions
-s Swap space
-t Installed patches
 
If no options are specified, all information is displayed.
EOF
 
  exit
}
 
#------------------------------------------------------------------------------
function General_info
{
  [ "$DEBUG" = TRUE ] && set -x
 
  echo "==========General Information==================================================\n"
 
  showrev | egrep -v "Release"
  release=`grep Solaris /etc/release`
  echo Release: $release
  echo "Machine type: \c"
  uname -i
 
  prtconf | grep "Memory size"
 
  maxprocessors=`psrinfo | wc -l`
  echo Number of processors: $maxprocessors
 
  if [ $maxprocessors -gt 1 ]
  then
     let processor=0
     while [ $processors -lt $maxprocessors ]
     do
       speed=`psrinfo -v $processor| grep "operates at" | sed "s/.*operates at //"`
       echo "Processor $processor: $speed"
       let processor=processor+1
     done
  else
       speed=`psrinfo -v | grep "operates at" | sed "s/.*operates at //"`
       echo "Processor runs at $speed"
  fi
}
 
#------------------------------------------------------------------------------
function Swap_space
{
  [ "$DEBUG" = TRUE ] && set -x
 
  echo "\n\n"
  echo "==========Swap Space===========================================================\n"
  echo "Swap device               Size"
  echo "-------------------------------"
  swap -l | grep -v swapfile |
  while read swapfile dev swaplo blocks free
  do
    let size="blocks / 2048"
    echo "$swapfile\t$size Mb"
  done
}
 
#------------------------------------------------------------------------------
function Network_interfaces
{
  [ "$DEBUG" = TRUE ] && set -x
 
  echo "\n\n"
  echo "==========Network Interfaces===================================================\n"
  echo "Int      Host     Address"
  echo "-------------------------------------------------------------------------------"
 
  typeset -L7 interface
  typeset -L8 intname
 
  for interface in `ls /etc/hostname.*|sed "s/.*\.//"`
  do
    intname=`cat /etc/hostname.$interface`
    echo "$interface  $intname \c"
    ifconfig $interface | grep inet | sed "s/^.*inet //"
  done
}
 
#------------------------------------------------------------------------------
function Disks
{
  [ "$DEBUG" = TRUE ] && set -x
 
  echo "\n\n"
  echo "==========Available Disks======================================================\n"
  disks=`echo "0\nq"|format 2>/dev/null |grep "[0-9]\."|sed "s/^ *//"`
  echo "$disks"
}
 
#------------------------------------------------------------------------------
function Disk_partitions
{
  [ "$DEBUG" = TRUE ] && set -x
 
  echo "\n\n"
  echo "==========Disk Partitions======================================================\n"
 
  disks=`echo "0\nq"|format 2>/dev/null |grep "[0-9]\."|sed "s/^ *//"`
  for disk in `echo "$disks" | awk '{print $2}'`
  do
    echo "\nDisk $disk"
    echo "--------------"
    prtvtoc -s /dev/rdsk/${disk}s2
  done
}
 
#------------------------------------------------------------------------------
function Installed_packages
{
  [ "$DEBUG" = TRUE ] && set -x
 
  echo "\n\n"
  echo "==========Installed Packages====================================================\n"
 
  pkginfo
}
 
#------------------------------------------------------------------------------
function Installed_patches
{
  [ "$DEBUG" = TRUE ] && set -x
 
  echo "\n\n"
  echo "==========Installed Patches=====================================================\n"
 
  showrev -p
}
 
#------------------------------------------------------------------------------
# END OF FUNCTIONS
#==============================================================================
 
#
# Some functions need root access
#
if [ `id|sed -e "s/uid=//" -e "s/(.*//"` != 0 ]
then
   echo "$SCRIPT needs to be run as root" >&2
   exit 1
fi
 
#
# Check to see what platform we are running on.
#
if [ $PLATFORM != SunOS ]
then
   echo "$SCRIPT can only run on Sun systems" >&2
   exit 1
fi
 
# Check to see if we are on Solaris 2.5 (SunOS 5.5) or higher
#
if echo $RELEASE | grep 5.[5-9] >/dev/null 2>&1
then
   : # OS level is OK
else
   echo "$SCRIPT needs to be run on Solaris version 2.5 and higher" >&2
   exit 1
fi
 
#
# Set an appropriate path
#
export PATH=/usr/bin:/usr/sbin
 
#
# If no parameters are supplied, set flag to indicate to display
# all information.
#
[ $# -eq 0 ] && ALL=TRUE
 
while getopts :Ddghknpst opt
do
  case $opt in
  D) DEBUG=TRUE
set -x
;;
  d) Disks
;;
  h) help
;;
  g) General_info
;;
  k) Installed_packages
;;
  n) Network_interfaces
;;
  p) Disk_partitions
;;
  s) Swap_space
;;
  t) Installed_patches
;;
  ?) echo "$USAGE" >&2
exit 1
;;
  esac
done
 
#
# Exit if flags have been specified
#
[ "$ALL" = TRUE ] || exit 0
 
#
# By default, display all information
#
General_info
Swap_space
Network_interfaces
Disks
Disk_partitions
Installed_packages
Installed_patches

Open in new window

0
 
rohanlyAuthor Commented:
Hi its a production server and i can't run scripts on that

kindly provide me some commands that i can run and get the information
0
 
TintinCommented:
What?  You can't even copy/paste a script into /tmp, run it, then delete it?  That's crazy.

If you want just the commands, then just look at the script and pull out the appropriate commands you need.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
rohanlyAuthor Commented:
Again i will say i am a novice ,

Don't be rude MAN, Just looking for help here,

Anyways thanks for the reply , Will try it

regards,
Rohan
0
 
TintinCommented:
I'm sorry if I came across as rude.  The comments weren't directed to you specifically, it was more a general rant at the ridiculous restrictions that management quite often place on production environments that mean so much additional work.

The other option is that you could run Sun Explorer, which might already be installed on the system.  Sun Support usually get the customer to run this when there is a support call they need to diagnose.  it is a Sun tool for extracting all sorts of information about the system (it does collect a lot of stuff).

If the directory /opt/SUNWexplo exists on your server, it means it is installed.

Do a

man -M /opt/SUNWexplo/man explorer

to view the options for running explorer.
0
 
peter991Commented:
Great script Tintin.
It stoped on my solaris 10 due to the line:

if echo $RELEASE | grep 5.[5-9] >/dev/null 2>&1

After changing that it worked perfect.

As Tintin wrote Sun Explorer will give you most of the information you need. Tintin scripts contains alot of good Solaris commands you can easily type in the prompt instead of running the script.

Another informative command is:
# prtdiag -v

To see your NIC-speed
# ndd /dev/dmfe0 adv_100fdx_cap

1 = you got 100mb full duplex
dmfe0 = your NIC, look for your by hitting.
# ifconfig -a

To read more
#man ndd

Btw,Your "tag" in the question says Solaris 5. That version does not exist. SunOS 5.0 does but it's from the early 90.

Could you give the output from:
# uname -r

Regards
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now