Script to capture OVM information

Being a Unix Guy, I love to work on CLI. I guess same will go for you as well. Recently I found difficulty to identify the VM (Virtuam Machine) name while working on Physical server CLI. As below output was showing UUID, everytime I was going on OVM GUI and coming back on CLI to Match the UUID.

newovs01 ~> xm list
Name ID Mem VCPUs State Time(s)
0004fb00000600003632d1759bbca654 7 2048 2 -b—- 538.6
0004fb000006000060bb115b3ca77974 5 2048 2 -b—- 218.5
0004fb00000600007b517d13e7f12f20 3 24576 4 -b—- 2527.4
0004fb00000600007ef75fc091689d1a 2 2048 1 -b—- 1802.8
Domain-0 0 12288 20 r—– 40776.5

So to collect the information of all the VM hosted in OVM (Oracle Virtual Manager), I created one script. This script works fine for me. I was lazy to do proper formatting of output. I left to you Guys to add the grep parameters and do output fromatting as per your requirement. You can paste the output of this script in Notepad and use Find.

Following are the Key Points regarding script.

1) My all repositories are starting with /OVS.
2) Output file will be /tmp/Output

#Created By : vikrant Aggarwal
### To capture OVM VM information.
if [ -f “/tmp/Output” ]
rm /tmp/Output
touch /tmp/Output
for i in `df -Ph | awk ‘{print $6}’ | grep -i “^\/OVS”`
cd $i/VirtualMachines/
for j in `ls -lrt | awk ‘{print $9}’ | grep -v “^$”`
echo “================================================” >> /tmp/Output
cat $j/vm.cfg | egrep -i “OVM_simple_name|vif|name|uuid|guest_os_type” >> /tmp/Output

Hope this will make troubleshooting easy while working on Physical Server CLI.


One thought on “Script to capture OVM information

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s