#!/bin/ksh # This script is used to Map out the disks on a server # The output can be easily imported to Microsoft Excel # for printing and sorting. # Written by: Ed Skolnik # # 2001/03/28 EIS Added Location to pdisk # DTSTAMP=$(date +%Y%m%d) logfile=/tmp/$(basename $0).$(uname -n).log.$DTSTAMP tmpfile=/tmp/$(basename $0.$$) echo $tmpfile sendto="root.es" # exec 1>$logfile 2>&1 echo "$logifile " # lspv > $tmpfile echo "SSA Adapter,Hdisk,Pdisk,A_SIZEMB,A1_hop1,A2_hop2,B1_hop3,B2_hop4,vg,location" for I in $(lspv | awk {'print $1'}); do A_VG=$(grep "$I " $tmpfile | awk '{print $3}') A_ADAPT=$(ssaadap -l $I) for A_PDISK in $(ssaxlate -l $I); do A_HOP1="$(ssaconn -l $A_PDISK -a $A_ADAPT | awk '{print $3}')" A_HOP2="$(ssaconn -l $A_PDISK -a $A_ADAPT | awk '{print $4}')" A_HOP3="$(ssaconn -l $A_PDISK -a $A_ADAPT | awk '{print $5}')" A_HOP4="$(ssaconn -l $A_PDISK -a $A_ADAPT | awk '{print $6}')" A_SIZEMB=$(lsattr -OE -l$A_PDISK | cut -f6 -d: | tail -1) A_LOCATION=$(lsattr -OE -l$A_PDISK | cut -f4 -d: | tail -1) if [ "$A_SIZEMB" = "" ] then A_SIZEMB=$(lsattr -OE -l$I | cut -f10 -d: | tail -1) fi if [ "$A_ADAPT" = "" ] then A_ADAPT=NONE fi if [ "$A_VG" = "None" ] then A_VG="** FREE **" fi echo "$A_ADAPT,$I,$A_PDISK ,$A_SIZEMB,$A_HOP1,$A_HOP2,$A_HOP3,$A_HOP4,$A_VG,$A_LOCATION" done 2> /dev/null done 2> /dev/null # rm $tmpfile mail -s"$(uname -n) SSA MAP" $sendto < $logfile From root.es Mon Apr 30 15:27:36 2001 To: /usr/local/scripts/aixadmin/ALL_MAP root.es #!/bin/ksh # This script is used to Map out the disks on a server # The output can be easily imported to Microsoft Excel # for printing and sorting. # Written by: Ed Skolnik # # 2001/03/28 EIS Added Location to pdisk # DTSTAMP=$(date +%Y%m%d) logfile=/tmp/$(basename $0).$(uname -n).log.$DTSTAMP tmpfile=/tmp/$(basename $0.$$) echo $tmpfile sendto="root.es" # exec 1>$logfile 2>&1 echo "$logifile " # lspv > $tmpfile echo "SSA Adapter,Hdisk,Pdisk,A_SIZEMB,A1_hop1,A2_hop2,B1_hop3,B2_hop4,vg,location" for I in $(lspv | awk {'print $1'}); do A_VG=$(grep "$I " $tmpfile | awk '{print $3}') A_ADAPT=$(ssaadap -l $I) for A_PDISK in $(ssaxlate -l $I); do A_HOP1="$(ssaconn -l $A_PDISK -a $A_ADAPT | awk '{print $3}')" A_HOP2="$(ssaconn -l $A_PDISK -a $A_ADAPT | awk '{print $4}')" A_HOP3="$(ssaconn -l $A_PDISK -a $A_ADAPT | awk '{print $5}')" A_HOP4="$(ssaconn -l $A_PDISK -a $A_ADAPT | awk '{print $6}')" A_SIZEMB=$(lsattr -OE -l$A_PDISK | cut -f6 -d: | tail -1) A_LOCATION=$(lsattr -OE -l$A_PDISK | cut -f4 -d: | tail -1) if [ "$A_SIZEMB" = "" ] then A_SIZEMB=$(lsattr -OE -l$I | cut -f10 -d: | tail -1) fi if [ "$A_ADAPT" = "" ] then A_ADAPT=NONE fi if [ "$A_VG" = "None" ] then A_VG="** FREE **" fi echo "$A_ADAPT,$I,$A_PDISK ,$A_SIZEMB,$A_HOP1,$A_HOP2,$A_HOP3,$A_HOP4,$A_VG,$A_LOCATION" done 2> /dev/null done 2> /dev/null # rm $tmpfile mail -s"$(uname -n) SSA MAP" $sendto < $logfile