storage check script for AIX

echo "HOSTNAME = `hostname`"
echo "OS Level : `uname -a|awk '{print $1, $3}'`"
echo ""
echo "Device,WWN no,SPEED,Status,Target Name,pwwn"
/usr/sbin/lscfg >lscfgout
cat lscfgout|grep fcs|awk '{print $2}'|sort>fcl
for i in `cat fcl`
do
touch tgname
echo $i>fcsname
/usr/sbin/lscfg -vpl $i |grep 'Network Address'|awk -F. '{print $14}'>wwn
speed=`/usr/bin/fcstat $i |grep 'Port Speed (running)'|awk '{print $4}'`
echo "$speed ">speed
if [ -n "$speed" ];then
echo "Active">status
fcsaddr=`cat lscfgout|grep -w $i|awk '{print $3}'`
cat lscfgout|grep $fcsaddr|egrep -v '(fcs|fcnet|fscsi|PowerPath)'|awk '{print $3}'|awk -F- '{print $5}'|sort |uniq>tgwwn
for t in `cat tgwwn`;do cat lscfgout|grep $t|head -1|awk '{print $4,$5,$6,$7,$8,$9,$10}'>>tgname;done

else
echo "Not Active">status
echo " ">tgname
echo " " >tgwwn
fi

/usr/bin/paste -d"," fcsname wwn speed status tgwwn tgname
rm -f tgname
done
rm -f fcsname wwn speed status tgwwn tgname fcl lscfgout

Comments

Popular posts from this blog

Understanding How ZFS Calculates Used Space

How To Verify Remote System Controller (RSC) is Configured and Current on Sun Fire[TM] 280R/V480/V490/V880/V890 servers

Restart autosys agent