[libvirt] Current cpu and memory usage for Host and Domains

Daniel P. Berrange berrange at redhat.com
Sun Jan 17 13:02:33 UTC 2010


On Fri, Jan 15, 2010 at 11:52:09AM -0800, su disheng wrote:
> Seem there is no way to get host CPU usage in libvirt API? I can get
> freeMemory by  virNodeGetFreeMemory, but no cpu usage API.
> How about add a new api for it? The host CPU usage is also important for VM
> creation and migration decision, like the free memory.
> Yes, I know, I can got it from "top"...:)

We've historically thought that monitoring of the host OS is out of
scope of the libvirt API, since there are already a huge variety of
monitoring services / APIs available for people.  I wonder if we need
to reconsider that now we have the VMWare drivers though - apps using
libvirt don't get to installl stuff in VMWare host OS, so the only
access to some of this host CPU data is probably via the VMWare APIs.
Which in turn suggests we'd need to expose some minimal hosting API
for this in libvirt

FWIW, virt-top/virt-manager calculates host CPU usage by summing the usage
of all guests over a fixed time slice. This will be an underestimate of
true host utilization though, since it can't see CPU usage for non-guest
related processes

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list