[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Libvir] Disks and NICs

Katti, Vadiraj (STSD-Openview) wrote:
    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:


(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.


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

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]