Shell Script to grab some size of disks from some servers

I have 21 AIX  servers from which I need to collect the size of all SAN disks attached to each server. I have rsh enabled. I need an output something like this

Server 1 :
hdisk0       73000mb
hdisk1       73000mb

Server 2 :
hdisk 0     73000mb

jdenver247Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

joolsCommented:
first of all you may want to see if you can add the AIX group to this Q.

How the script it written will depend on how your disks are reported onto the system.
Post the following listings back here;
   lsdev -Ccdisk
   lscfg | grep disk
   lscfg -vpl hdisk1

I sure someone will be able to knock something up.
0
woolmilkporcCommented:
Hi,
I think I have a nice one for you (attached)
 
Things to consider -
1. You must provide a file containing your hostnames, one by line (my 'sanhosts', line 2).
2. I used ssh, please change to rsh as needed. I don't run rsh, so I can't test.
3. To find out which disk is a SAN disk, I searched for 'FC 2107' (line 6). Change it according to your environment.
4. The disks must be in some volume group, and it must be AIX.
5. I'm not _that_ awk specialist. One surely could make it look nicer there.
 
Have fun!
 
wmp
 
 

#!/bin/ksh
for srv in $(cat ~/sanhosts)
do
ssh $srv \
     'echo \\n$(/usr/bin/hostname):
     for disk in  $(lscfg |grep hdisk | grep "FC 2107" | cut -f2 -d " ")
     do
      echo ${disk}: \\c
      lspv $disk | awk "/TOTAL PPs:/ {print \$4 \$5}" | tr -d "()" | sed "s/megabytes/ mb/"
     done'
done

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
woolmilkporcCommented:
... and I strongly agree with jools - please add this Q to the AIX zone.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

jdenver247Author Commented:
Sure I will add this in the AIX zone
0
jdenver247Author Commented:
Hello,
I changed the code  lil bit.. to print the the queue_dept and here is the output

aixserver27:
hdisk6: queue_depth     256                              Queue DEPTH                      True
hdisk8: queue_depth     256                              Queue DEPTH                      True
hdisk9: queue_depth     256                              Queue DEPTH                      True
hdisk11: queue_depth     256                              Queue DEPTH                      True

How do I trim the output just to get
aixserver27:
hdisk6: queue_depth     256                            
hdisk8: queue_depth     256                              
hdisk9: queue_depth     256                              
hdisk11: queue_depth     256                              

#!/bin/ksh
for srv in $(cat dwprod)
do
rsh $srv \
     'echo \\n$(/usr/bin/hostname):
     for disk in  $(lscfg |grep hdisk | grep "NetApp" | cut -f2 -d " ")
     do
      echo ${disk}: \\c
      lsattr -El $disk |grep queue_depth
     done'
done
 

Open in new window

0
woolmilkporcCommented:

Hi, change line 9 to -
 
lsattr -El $disk | awk "/queue_depth/ {print \$1, \$2}"
0
jdenver247Author Commented:
thanks a lot its working now
0
woolmilkporcCommented:
You're welcome!
Have fun and success!
 
Norbert (wmp)
 
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Unix OS

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.