Highlighted
NTA12
1 Copper

How with symcli command get host, dev, capacity, FA port and LUN in same output?

HI all,

I'm using following command to get dev, host and port:

symcfg -sid ID -

list -host hostname

Symmetrix ID      : ID

Host Name         : test

Identifiers Found : WWN1
                         WWN 2

Device  Cap(MB)  Attr  Dir:P
------  -------  ----  ----
0011          2         7C:1,10C:1
0012          2         7C:1,10C:1
0013          2         7C:1,10C:1
0014          2         7C:1,10C:1
0015          2         7C:1,10C:1
0016          2         7C:1,10C:1

-----------------------------

MB Total:     12
GB Total:    0.0

AND the follwing command to get LUN ID of DEV.

symcfg -sid 17 list -dir 7c -p 1 -address -available

Symmetrix ID: ID

           Director                 Device Name          Attr     Address
    ---------------------- ----------------------------- ---- --------------
    Ident   Symbolic  Port Sym   Physical                     VBUS  TID  LUN
    ------  --------  ---- ----  -----------------------      ----  ---  ---

    FA-7C   07C       1    -          AVAILABLE                       0   00  000 *
                                          0011  /dev/sdrj                       0   00  011
                                          0012  /dev/sdrk                       0   00  012
                                          0013  /dev/sdrl                       0   00  013
                                          0014  /dev/sdrm                       0   00  014
                                          0015  /dev/sdrn                       0   00  015
                                          0016  /dev/sdro                       0   00  016

BUT Do you know any command or script can give host, dev, capacity, FA port and LUN in same output?

Thx.

Message was edited by: NTA12 Thx a lot for sharing your script it's working fine.

0 Kudos
1 Reply
eugenef1
1 Copper

Re: How with symcli command get host, dev, capacity, FA port and LUN in same output?

showhost

#!/usr/bin/ksh

PROG=${0##*/}
SID=1234

function usage {
   print "Usage: $PROG \"hostname\""
   return
}

function get_dev_detail {
   nf=`echo $1|awk '{print NF}'`
   [[ $nf -lt 2 ]] && printf "%s\n" "$1" && return
   dev=`echo "$1"|cut -c 1-4`
   cap=`echo "$1"|cut -c 9-15`
   atr=`echo "$1"|cut -c 18-21`
   fas=`echo "$1"|cut -c 24-`
   vtd=""
   for fa in `echo $fas|sed 's/,/ /'`
   do
      f=`echo $fa|cut -d ":" -f 1`
      p=`echo $fa|cut -d ":" -f 2`
      t=`sudo symcfg -sid 3565 -fa $f -p $p list -address | grep $dev | awk '{printf "%s:%s:%s,", $(NF-2),$(NF-1),$NF}'`
      vtd=${vtd}${t}
   done
   # chop last character (comma) from end of string
   newvtd=`echo $vtd|awk '{l=length($0);print substr($0,0,l-1)}'`
   printf "%-6.6s  %7d  %4.4s  %-24s  %-32s\n"  "$dev" $cap "$atr" "$fas" "$newvtd"
   return
}

################################################################################

[[ -z $1 ]] && print "You must supply an argument." && usage && exit 1
HOST=$1
sudo symmaskdb -sid $SID list capacity -host $HOST | while read line
do
   len=`echo "$line" | awk '{print length($0)}'`
   if [[ "$line" = Device* ]]; then
      printf "%s                     v:t:d\n" "$line"
   elif [[ "$line" = "------  ------"* ]]; then
      printf "%s                      --------\n" "$line"
   elif [[ $len -lt 28 ]]; then
      printf "%s\n" "$line"
   elif [[ "$line" = [0-9A-F]* ]]; then
      get_dev_detail "$line"
   else
      printf "%s\n" "$line"
   fi
done

exit

Sample Output

./showhost bobolink

Symmetrix ID      : 000000001234

Host Name         : j201u009

Identifiers Found : 50014380070fa69e
50014380070fa6a4

Device  Cap(MB)  Attr  Dir:P                     v:t:d
------  -------  ----  ----                      --------
0E60      69713   (M)   7A:0,10A:0               1:0F:004,1:0F:004
0E68      69713   (M)   7A:0,10A:0               1:0F:005,1:0F:005
1100      69713   (M)   7A:0,10A:0               2:0B:006,2:0B:006
1108      69713   (M)   7A:0,10A:0               2:0B:007,2:0B:007
1110      69713   (M)   7A:0,10A:0               2:0C:000,2:0C:000
1118      69713   (M)   7A:0,10A:0               2:0C:001,2:0C:001
1120      69713   (M)   7A:0,10A:0               2:0C:002,2:0C:002


-----------------------------

MB Total: 487991
GB Total:  476.6

Message was edited by: SymmetrixForumsModerator Changed Symmetrix ID.