[libvirt-users] Understanding Libvirt Java API in order to get CPU usage of a VM

Richard W.M. Jones rjones at redhat.com
Thu Aug 7 13:30:33 UTC 2014


On Thu, Aug 07, 2014 at 01:01:56AM -0700, Restituto Marcus Arevalo wrote:
> I'm having a problemin understanding the Libvirt Java API. Here is my sourcein reading some of the classes: http://libvirt.org/sources/java/javadoc/
> 
> I have no idea where to start in order for me to get the CPU usage. Can anybody help? Or at least give me some points on where to start in order for me to get the CPU usage of a VM in KVM? Any suggestions will really help. Thanks

It used to be ridiculously complex.  Not sure if the API has improved
at all since then.

If I were you I'd look at the source of 'virt-top', and also question
#4 in the virt-top FAQ:

http://people.redhat.com/~rjones/virt-top/faq.html

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top




More information about the libvirt-users mailing list