Script to list all LPARs on all Managed Systems Connected to HMC

if you have Many Managed Systems connected to HMC and you need to list ALL LPARs that you have on a table view like the following output:

-----------------------------
Server Name : Server-****-***-***
------------
LPAR Name          LPAR Number   IP Address
TEST1                             5                       10.10.10.1
TEST2                            4                       10.10.10.2
TEST2                             3                      10.10.10.3
TEST4                            2                       10.10.10.4
LPAR                              1                       10.10.10.5
VIO                                  6                      10.10.10.6

just run the following commands on HMC :

for sys in $(lssyscfg -r sys -F name)
do
echo "-----------------------------"
echo "Server Name : $sys"
echo "------------"
printf "LPAR Name %-8s LPAR Number %-1s IP Address"
for lpar in $(lssyscfg -r lpar -m $sys -F name,lpar_id,rmc_ipaddr)
do
echo ""
NAME=`echo $lpar | cut -f1 -d,`
ID=`echo $lpar | cut -f2 -d,`
IP=`echo $lpar | cut -f3 -d,`
if [ "$IP" == "" ];
then
IP="NO IP";
fi
printf "%-22s" $NAME && printf "%-10s" $ID && printf "%-1s $IP"
done
echo
done
This entry was posted in HMC and tagged , , , , . Bookmark the permalink.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.