[libvirt] monitor cpu & network load

Hi, I want to write a program to monitor the CPU and network usage of the Xen domUs. But I don't know how to implement. Can the libvirt APIs help me to do that? Does libvirt have the APIs to get the CPU and network usages? If yes I'll study libvirt APIs. Thanks Zu

On Wed, Jul 09, 2008 at 05:16:10PM +0800, Zu wrote:
Hi,
I want to write a program to monitor the CPU and network usage of the Xen domUs. But I don't know how to implement. Can the libvirt APIs help me to do that? Does libvirt have the APIs to get the CPU and network usages? If yes I'll study libvirt APIs.
Yes,you want to look at virDomainGetInfo virDomainBlockStats virDomainInterfaceStats Regards, 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 :|

On Wed, Jul 09, 2008 at 05:16:10PM +0800, Zu wrote:
I want to write a program to monitor the CPU and network usage of the Xen domUs. But I don't know how to implement. Can the libvirt APIs help me to do that? Does libvirt have the APIs to get the CPU and network usages? If yes I'll study libvirt APIs.
Yes, libvirt APIs can do that. However it'll probably be much easier for you to just use 'virt-top --csv ...' which does all the hard work and all you need to do is to parse the generated CSV format. Rich. -- 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. http://et.redhat.com/~rjones/virt-top
participants (3)
-
Daniel P. Berrange
-
Richard W.M. Jones
-
Zu