KVM monitor: how to discover running guests


#1

Hello,

I am running kvm-85 on a rhel 5 and i am writing a linux script to discover running KVM guests (the script runs locally).

The main problem I found is the discovery of running KVM guests.
Consider I don’t want to install any additional software like libvrt to manage guests

  1. Is there a monitor I can query with some scripts to detect the runnign guests ? (as in XEN where I used xm/xe commands to list available domains)

  2. Is there an easy way to detect running machines ? with a command line script ?

  3. Should I require that every machine is started with -monitor option and connect to this monitor for each machine ?

Thanks in advance,
Francesco


#2

You can specify a PID file when lauching you VMs. Work with those in your bash script.
Or maybe examine the ‘ps aux | grep kvm’ output for running VMs.