Most of us can keep wiki pages etc up-to-date, however, typically when a manager or someone wants a layout of the VIOS or HMC (and it’s associated LPARs) the website is NOT fully up to date. I found an article about graphviz recently (can’t remember where) and how it can help in this endeavour. Once you implement a script to login to your servers, you can have it save the information into a graphic (such as png), then upload this to your webserver’s directory. If you use wiki pages, simply update your wiki page to point to the location you placed your png files to.
The first step, is to download the application. In a debian based distro, this is a simple apt-get install graphviz
. Next you can create / modify a bash script, similar to the one I have supplied below.
file ~/scripts/hmc.sh
# Main Routine
for line in $(cat ~/scripts/vio.list)
do
serverlist=`ssh -q $line 'lssyscfg -r lpar -F name' | grep -v $line`
echo "graph hmc_graph{" > $line.log
for server in $serverlist
do
" \"$line\" -- \"$server\" " | sort >> $line.log
done
echo "}" >> $line.log
# Grab the contents of the created log file, and dump it out to create the diagram
if [ ! -e ~/diagrams ]; then
mkdir ~/diagrams
cat $line.log | dot -Tpng -o ~/diagrams/$line.png
else
cat $line.log | dot -Tpng -o ~/diagrams/$line.png
fi
done
The text file vio.list is simply a text file with the hostname of a VIO server, one entry per line. The script steps through each of the hosts, and runs the lssyscfg command to list each of the LPARs. This is all saved into a log file, which is then dumped to dot (graphviz) so that it is outputted into a diagram.
To-do: Implement this script with cron, so that it is run regularly, and add the commands to scp this file to a webserver (and finally link it to the wiki pages).