Katti, Vadiraj (STSD-Openview) wrote:
Hi, Libvirt provides the disk and Network interfaces statistics for each of the guests configured. Is there a api which tells me how many disk and network interface are configured per guest so that can make the corrosponding calls to get the statistics of each the disk/nic (like virDomainBlockStats and virDomainInterfaceStats).
In addition to DV's answer, this is how it's done in virt-top: http://hg.et.redhat.com/virt/applications/virt-top--devel?f=31e1a2bb21e4;file=virt-top/virt_top_xml.ml(It'd be a lot easier if I'd had an XML library available with XPath support...)
If you want some C code which does this using libxml2 and XPath, then take a look at my virtstats module in the collectd source (http://collectd.org/).
Because trawling through the XML is rather inefficient, virt-top only does it once for each new domain it sees, so if interfaces are added or removed then you have to restart virt-top. For collectd it rechecks the XML every 60 seconds IIRC.
Rich. -- Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/ Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 03798903
Attachment:
smime.p7s
Description: S/MIME Cryptographic Signature
-- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list