[libvirt] Unable to find node's mem and cpu api

Richard W.M. Jones rjones at redhat.com
Mon Sep 1 15:04:11 UTC 2008

On Mon, Sep 01, 2008 at 04:54:04PM +0200, jovialGuy _ wrote:
> I am unable to find the api in java and perl binding to find the host node's
> current memory and cpu information. Any body has any idea where I can find
> the information?

I'm not certain about whether the Java & Perl bindings support them,
but these are the calls you should use:


For CPU usage of the host, libvirt doesn't specifically provide that
information.  If the hypervisor is Xen, then you can get information
about CPU usage of Dom0 (usually what is meant by "the host") using:


but that won't work for QEMU/KVM where "the host node" is just the
Linux kernel.  (In the local case, you can extract that information
you need just by looking in /proc or using ordinary Linux tools).

Also read this: http://et.redhat.com/~rjones/virt-top/faq.html#calccpu


Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.

More information about the libvir-list mailing list