#!/bin/bash
# osdba 2009.06.29 list iscsi target and disk information.
#
echo " target name target ipaddress LunId disk"
echo "---------------------------------------------------------------- ----------------------- ----- ----------"
iscsiadm -m session -P 3 |awk -F':' \
'{
if($1 ~ /^Target/)
{
pos=index($0,":");
targetname=substr($0,pos+1);
};
if($1 ~ /Persistent Portal/)
{
pos=index($0,":");
ipaddress=substr($0,pos+1);
};
if($1 ~/ Lun$/)
{
Lunid=$2;
};
if($1 ~/Attached scsi disk/)
{
split($1,diskarray," ");
printf("%-64s %-23s %5d %s\n",targetname,ipaddress,Lunid,diskarray[4]);
}
}'
阅读(1111) | 评论(0) | 转发(0) |