#/usr/bin/sh
name1=`hostname`_fc
ioscan -kfnNC fc |grep "/dev/" >/tmp/data/$name1.txt
num1=`cat /tmp/data/$name1.txt |awk '{print $1}'|uniq|wc -l`
i=1
while ((i<=$num1))
do
fcnm1=`cat /tmp/data/$name1.txt|awk '{print $1}'|sed -n "$i"p`
fcwwn=`fcmsutil $fcnm1 |grep "N_Port Port" |awk -F "=" '{print $2}'`
fcpath=`fcmsutil $fcnm1|grep "Hardware Path"|awk -F "=" '{print $2}'`
slot1=`echo $fcpath |awk -F "/" '{print $1"/"$2"/"$3"/"$4"/"$5"/"$6}'`
fcslot=`olrad -q |grep $slot1 |awk '{print $1}'`
fcspeed=`fcmsutil $fcnm1|grep "Link Speed"|awk -F "=" '{print $2}'`
fcstat=`fcmsutil $fcnm1|grep "Driver state"|awk -F "=" '{print $2}'`
PN1=`fcmsutil $fcnm1 vpd |grep -iE "Part number"|awk -F ":" '{print $2}'`
FV1=`fcmsutil $fcnm1 vpd |grep -iE "ROM Firmware version"|awk -F ":" '{print $2}'`
name2=`uname -a|awk '{print $2,$3}'`
ch1=`netstat -rn | grep default|awk '{print $2}' |awk -F "." '{print $1"."$2"."$3}'`
charip1=`netstat -in |grep $ch1|head -1 |awk '{print $4}'`
echo $name2 $charip1 $fcslot $fcnm1 $fcwwn $fcspeed $fcstat $fcpath $PN1 $FV1
((i=i+1))
done

显示的格式是:
主机名称 操作系统类型 ip地址 HBA卡slot位置 HBA卡WWN号 HBA卡速率 HBA的链接状态 路径 备件信息 HBA卡的firmware版本

posted on 2016-09-08 14:17  zlg88  阅读(311)  评论(0编辑  收藏  举报