Script to gather LPAR wwpn number

Step 1: Choose a server where you can access all your LPAR’s
Step 2: Generate a key from the chosen server and then scp same key to LPAR under /root
Step 3: Now, You can execute the below script from chosen server

Note:- In our case, We have chosen NIM server as our source server where the script to be executed
server – Should contain LPAR or server name
Name of the script: lpar_wwpn_number.sh

echo Server Name,FCS,WWPN,Location Code

CSV=","

for lpar_wwpn_number_list in `cat server`
do
for FCSX in `ssh $lpar_wwpn_number_list lscfg | grep fcs | awk '{ print $2 }'`
do
echo $lpar_wwpn_number_list${CSV}${FCSX}${CSV}`ssh $lpar_wwpn_number_list lscfg -vl ${FCSX} | grep "Network Address" | sed -e "s/^.*\.//" | sed 's/../&:/g;s/:$//'`${CSV}`ssh $lpar_wwpn_number_list lscfg -l ${FCSX} | awk '{ print $2 }'`
done
done

 

Script to gather vio wwpn number

Step 1: Choose a server where you can access all your VIO’s
Step 2: Generate a key from the chosen server and then scp same key to VIO under /home/padmin
Step 3: Now, You can execute the below script from chosen server

Note:- In our case, We have chosen NIM server as our source server where the script to be executed
vio_server – Should contain VIO server name
Name of the script: vio_wwpn_number.sh

echo Server Name,FCS,WWPN,Location Code

CSV=","

for vio_wwpn_number_list in `cat vio_server`
do
for FCSX in `ssh padmin@$vio_wwpn_number_list ioscli lsdev |grep fcs |awk '{print $1}'`
do
echo $vio_wwpn_number_list${CSV}${FCSX}${CSV}`ssh padmin@$vio_wwpn_number_list ioscli lsdev -dev $FCSX -vpd |grep "Network Address" |sed -e "s/^.*\.//"|sed 's/../&:/g;s/:$//'`${CSV}`ssh padmin@$vio_wwpn_number_list ioscli lsdev -dev $FCSX -vpd |grep "Hardware Location Code" |awk -F "Hardware Location Code......" '{print $2}'`
done
done

 

Advertisements