Link to home
Create AccountLog in
Avatar of oo_tatang
oo_tatang

asked on

HPUX script

I would like to run a script to check the dual path of each and every server from a central server. Our storage i using EMC powerpath and our servers are combination of HPUX and Linux. Please ssend me a script to check the path before and after we replace one SAN switch
at a time. Thanks
Avatar of woolmilkporc
woolmilkporc
Flag of Germany image

Create a file "serverlist" containing the network name or IP address of each of your servers, one per line,  then run

while read server; do
    echo "------ $server ------"
   ssh -n $server powermt display paths
 done < serverlist

Check the "I/O Paths" column values for "Total" and "Dead"

Please note that you must have ssh access to each of the servers in "serverlist".
Avatar of oo_tatang
oo_tatang

ASKER

How can I filter this into meaningful output that show only the output from the symmetrix logical device . Can you help me filter the output. I dont want to see the other decommissioned storage frames such as Clarion, Hitachi,invista, hp xp, ESS

Here is the script

#!/usr/bin/sh
while read server
do
  echo ======= $server =================
  ssh -n root@$server "/sbin/powermt display paths"
  if [ $? -ne 0 ]; then
    echo "[ FAIL ]"
  else
    echo "[ done ]"
  fi
done < hosts_dp_dev


======= server1.dev.na.lafarge.com =================
Symmetrix logical device count=16
==============================================================================
----- Host Bus Adapters --------- ------ Storage System -----    - I/O Paths -
###  HW Path                           ID          Interface     Total    Dead
==============================================================================
  73 0/8/0/0.53.0.6.0             000192605108      FA  8hB         16       0
  75 0/9/0/0.54.0.1.0             000192605108      FA  7hB         16       0

CLARiiON logical device count=0
==============================================================================
----- Host Bus Adapters --------- ------ Storage System -----    - I/O Paths -
###  HW Path                           ID          Interface     Total    Dead
==============================================================================

Hitachi logical device count=0
==============================================================================
----- Host Bus Adapters --------- ------ Storage System -----    - I/O Paths -
###  HW Path                           ID          Interface     Total    Dead
==============================================================================

Invista logical device count=0
==============================================================================
----- Host Bus Adapters --------- ------ Storage System -----    - I/O Paths -
###  HW Path                           ID          Interface     Total    Dead
==============================================================================

HP xp logical device count=0
==============================================================================
----- Host Bus Adapters --------- ------ Storage System -----    - I/O Paths -
###  HW Path                           ID          Interface     Total    Dead
==============================================================================

Ess logical device count=0
==============================================================================
----- Host Bus Adapters --------- ------ Storage System -----    - I/O Paths -
###  HW Path                           ID          Interface     Total    Dead
==============================================================================
#!/usr/bin/sh
while read server
do
  echo ======= $server =================
  ssh -n root@$server "/sbin/powermt display paths" | awk '/Symmetrix/,/CLARiiON/ {if(L!="") print L}{L=$0}'
  if [ $? -ne 0 ]; then
    echo "[ FAIL ]"
  else
    echo "[ done ]"
  fi
done < hosts_dp_dev

Open in new window

The above script is very good when the server had the powermt installed. How about if the server is using the native redundancy such as below:
root@server.prd # ioscan -m dsf
Persistent DSF           Legacy DSF(s)
========================================
/dev/rchgr/autoch1       /dev/rac/c3t0d0
/dev/pt/pt2              /dev/rscsi/c4t14d0
/dev/rdisk/disk2         /dev/rdsk/c0t1d0
/dev/rdisk/disk2_p1      /dev/rdsk/c0t1d0s1
/dev/rdisk/disk2_p2      /dev/rdsk/c0t1d0s2
/dev/rdisk/disk2_p3      /dev/rdsk/c0t1d0s3
/dev/rchgr/autoch4       /dev/rac/c12t0d1
/dev/rdisk/disk115       /dev/rdsk/c16t0d0
                         /dev/rdsk/c15t0d0
                         /dev/rdsk/c18t0d0
                         /dev/rdsk/c17t0d0
                         /dev/rdsk/c19t0d0
                         /dev/rdsk/c20t0d0
/dev/rdisk/disk126       /dev/rdsk/c16t0d1
                         /dev/rdsk/c15t0d1
                         /dev/rdsk/c18t0d1
                         /dev/rdsk/c17t0d1
/dev/rdisk/disk127       /dev/rdsk/c16t0d2
                         /dev/rdsk/c15t0d2
                         /dev/rdsk/c18t0d2
                         /dev/rdsk/c17t0d2
/dev/rdisk/disk128       /dev/rdsk/c16t0d3
                         /dev/rdsk/c15t0d3
                         /dev/rdsk/c18t0d3
                         /dev/rdsk/c17t0d3
/dev/rdisk/disk129       /dev/rdsk/c16t0d4
                         /dev/rdsk/c15t0d4
                         /dev/rdsk/c18t0d4
                         /dev/rdsk/c17t0d4
/dev/rdisk/disk130       /dev/rdsk/c16t0d5
                         /dev/rdsk/c15t0d5
                         /dev/rdsk/c18t0d5
                         /dev/rdsk/c17t0d5
/dev/rdisk/disk131       /dev/rdsk/c16t0d6
                         /dev/rdsk/c15t0d6
                         /dev/rdsk/c18t0d6
                         /dev/rdsk/c17t0d6

How can I check that it has redundant paths
ASKER CERTIFIED SOLUTION
Avatar of woolmilkporc
woolmilkporc
Flag of Germany image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
This is the output of the script.
How can I  identify the redundant path

=======server.dev =================
/dev/rdisk/disk1 1
/dev/rdisk/disk1_p1 1
/dev/rdisk/disk1_p2 1
/dev/rdisk/disk1_p3 1
/dev/rdisk/disk3 1
/dev/rdisk/disk5 1
[ done ]


======= server.qua =================
/dev/rdisk/disk1 1
/dev/rdisk/disk1_p1 1
/dev/rdisk/disk1_p2 1
/dev/rdisk/disk1_p3 1
/dev/rdisk/disk3 1
/dev/rdisk/disk5 1
/dev/rdisk/disk7 1
[ done ]
It's the number in the last column.

Since it's all ones ("1") there are no redundant paths.
From this output, how can I modify the output to give me only the "disk" and not the tapes.
How about the disk with 4 and 6 at the end of the output? What does it mean?


======= server =================
/dev/rchgr/autoch1 1
/dev/pt/pt2 1
/dev/rdisk/disk2 1
/dev/rdisk/disk2_p1 1
/dev/rdisk/disk2_p2 1
/dev/rdisk/disk2_p3 1
/dev/rchgr/autoch4 3
/dev/pt/pt3 1
/dev/rdisk/disk3 1
/dev/rdisk/disk3_p1 1
/dev/rdisk/disk3_p2 1
/dev/rdisk/disk3_p3 1
/dev/rdisk/disk5 1
/dev/pt/pt6 2
/dev/rtape/tape8_BEST 1
/dev/rtape/tape8_BESTn 1
/dev/rtape/tape8_BESTb 1
/dev/rtape/tape8_BESTnb 1
/dev/rtape/tape9_BEST 1
/dev/rtape/tape9_BESTn 1
/dev/rtape/tape9_BESTb 1
/dev/rtape/tape9_BESTnb 1
/dev/pt/pt11 2
/dev/rtape/tape10_BEST 1
/dev/rtape/tape10_BESTn 1
/dev/rtape/tape10_BESTb 1
/dev/rtape/tape10_BESTnb 1
/dev/rtape/tape11_BEST 1
/dev/rtape/tape11_BESTn 1
/dev/rtape/tape11_BESTb 1
/dev/rtape/tape11_BESTnb 1
/dev/rtape/tape12_BEST 1
/dev/rtape/tape12_BESTn 1
/dev/rtape/tape12_BESTb 1
/dev/rtape/tape12_BESTnb 1
/dev/pt/pt14 1
/dev/rtape/tape13_BEST 1
/dev/rtape/tape13_BESTn 1
/dev/rtape/tape13_BESTb 1
/dev/rtape/tape13_BESTnb 1
/dev/rtape/tape14_BEST 1
/dev/rtape/tape14_BESTn 1
/dev/rtape/tape14_BESTb 1
/dev/rtape/tape14_BESTnb 1
/dev/pt/pt16 1
/dev/rtape/tape15_BEST 1
/dev/rtape/tape15_BESTn 1
/dev/rtape/tape15_BESTb 1
/dev/rtape/tape15_BESTnb 1
/dev/pt/pt18 1
/dev/pt/pt20 1
/dev/pt/pt22 1
/dev/pt/pt24 1
/dev/rtape/tape23_BEST 1
/dev/rtape/tape23_BESTn 1
/dev/rtape/tape23_BESTb 1
/dev/rtape/tape23_BESTnb 1
/dev/rtape/tape24_BEST 1
/dev/rtape/tape24_BESTn 1
/dev/rtape/tape24_BESTb 1
/dev/rtape/tape24_BESTnb 1
/dev/pt/pt26 1
/dev/rtape/tape25_BEST 1
/dev/rtape/tape25_BESTn 1
/dev/rtape/tape25_BESTb 1
/dev/rtape/tape25_BESTnb 1
/dev/rtape/tape26_BEST 1
/dev/rtape/tape26_BESTn 1
/dev/rtape/tape26_BESTb 1
/dev/rtape/tape26_BESTnb 1
/dev/rtape/tape27_BEST 1
/dev/rtape/tape27_BESTn 1
/dev/rtape/tape27_BESTb 1
/dev/rtape/tape27_BESTnb 1
/dev/rtape/tape28_BEST 1
/dev/rtape/tape28_BESTn 1
/dev/rtape/tape28_BESTb 1
/dev/rtape/tape28_BESTnb 1
/dev/rtape/tape29_BEST 1
/dev/rtape/tape29_BESTn 1
/dev/rtape/tape29_BESTb 1
/dev/rtape/tape29_BESTnb 1
/dev/rtape/tape34_BEST 1
/dev/rtape/tape34_BESTn 1
/dev/rtape/tape34_BESTb 1
/dev/rtape/tape34_BESTnb 1
/dev/rtape/tape35_BEST 1
/dev/rtape/tape35_BESTn 1
/dev/rtape/tape35_BESTb 1
/dev/rtape/tape35_BESTnb 1
/dev/rtape/tape36_BEST 1
/dev/rtape/tape36_BESTn 1
/dev/rtape/tape36_BESTb 1
/dev/rtape/tape36_BESTnb 1
/dev/rtape/tape37_BEST 1
/dev/rtape/tape37_BESTn 1
/dev/rtape/tape37_BESTb 1
/dev/rtape/tape37_BESTnb 1
/dev/rtape/tape50_BEST 1
/dev/rtape/tape50_BESTn 1
/dev/rtape/tape50_BESTb 1
/dev/rtape/tape50_BESTnb 1
/dev/rtape/tape51_BEST 1
/dev/rtape/tape51_BESTn 1
/dev/rtape/tape51_BESTb 1
/dev/rtape/tape51_BESTnb 1
/dev/rdisk/disk115 6
/dev/rdisk/disk126 4
/dev/rdisk/disk127 4
/dev/rdisk/disk128 4
/dev/rdisk/disk129 4
/dev/rdisk/disk130 4
/dev/rdisk/disk131 4
[ done ]
I would appreciate if somebody can help me. We need this script as soon as possible
Hello,
Please help . Thanks
Thanks for your amazing help