[libvirt] I need help for use virDomainInterfaceStats

Michal Privoznik mprivozn at redhat.com
Tue Apr 3 14:39:49 UTC 2012


On 02.04.2012 20:56, siddharth wrote:
> Фёдор Пранович <pr.fedor <at> gmail.com> writes:
> 
>>
>> Hi I want use the virDomainInterfaceStats for get statistic of domain,
>> but I don't now how get path parametr.
>> Please help me!
>> Thanks.
>>
>>
> 
> Please Help me Too !!

Basically, it's string(/domain/devices/interface[n]/target/@dev) where n is index of the interface you wanna get statistics for.
For example, if I have this in XML (virDomainGetXMLDesc()):
...
    <interface type='network'>
      <mac address='52:54:00:57:f5:50'/>
      <source network='default'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      <filterref filter='no-ip-spoofing'>
        <parameter name='ip_learning' value='dhcp'/>
      </filterref>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <interface type='direct'>
      <mac address='52:54:00:16:e6:5c'/>
      <source dev='eth0' mode='bridge'/>
      <target dev='macvtap0'/>
      <model type='virtio'/>
      <alias name='net1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </interface>
...

I would query for stats:
virDomainInterfaceStats(dom, "vnet0", ...);
virDomainInterfaceStats(dom, "macvtap0", ...);

Michal




More information about the libvir-list mailing list