[one-users] network traffic monitor for KVM guests

Shi Jin jinzishuai at gmail.com
Mon May 17 22:53:25 PDT 2010


Hi Rogier,

There is another way to get network traffic: ifconfig vnet1.

For example:
$ virsh domifstat one-529 vnet4
vnet4 rx_bytes 70136914
vnet4 rx_packets 528585
vnet4 rx_errs 0
vnet4 rx_drop 0
vnet4 tx_bytes 57902688
vnet4 tx_packets 299616
vnet4 tx_errs 0
vnet4 tx_drop 0

$ ifconfig vnet4
vnet4     Link encap:Ethernet  HWaddr 1A:F2:E9:43:73:3D
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:299616 errors:0 dropped:0 overruns:0 frame:0
          TX packets:528585 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:500
          RX bytes:57902688 (55.2 MiB)  TX bytes:70136914 (66.8 MiB)

They provide the same information.

Shi
On Tue, May 11, 2010 at 5:23 PM, Rogier Mars <rogier at fortytwo.nl> wrote:
> Hi,
>
> I just noticed this post and did some checking with libvirt. I am able to
> get the interface that is used in a KVM vm via the dumpxml command, and then
> get the network interface statistics via domifstat (see the example below).
> I think this could be included in the one_vmm_kvm.rb script. I'm not a ruby
> programmer, but I think this should be possible.
>
> Cheers,
>
> Rogier
>
>
> virsh # dumpxml one-60
> <domain type='kvm' id='11'>
>  <name>one-60</name>
>  <uuid>3e62f716-b9bc-4b3e-6af6-7121181a5487</uuid>
>  <memory>524288</memory>
>  <currentMemory>524288</currentMemory>
>  <vcpu>2</vcpu>
>  <os>
>    <type arch='x86_64' machine='pc'>hvm</type>
>    <boot dev='hd'/>
>  </os>
>  <features>
>    <acpi/>
>  </features>
>  <clock offset='utc'/>
>  <on_poweroff>destroy</on_poweroff>
>  <on_reboot>restart</on_reboot>
>  <on_crash>destroy</on_crash>
>  <devices>
>    <emulator>/usr/bin/kvm</emulator>
>    <disk type='file' device='disk'>
>      <source file='/srv/cloud/one/var/60/images/disk.0'/>
>      <target dev='hda' bus='ide'/>
>    </disk>
>    <interface type='bridge'>
>      <mac address='00:03:5d:bc:f9:64'/>
>      <source bridge='br1'/>
>      <target dev='vnet1'/>
>    </interface>
>  </devices>
> </domain>
>
> virsh # domifstat one-60 vnet1
> vnet1 rx_bytes 517120841
> vnet1 rx_packets 6065654
> vnet1 rx_errs 0
> vnet1 rx_drop 0
> vnet1 tx_bytes 189675090
> vnet1 tx_packets 1166682
> vnet1 tx_errs 0
> vnet1 tx_drop 0
>
> virsh #
>
>
> On Jan 7, 2010, at 10:52 AM, Javier Fontan wrote:
>
>> Hello,
>>
>>
>> Hello,
>>
>> Libvirt does not directly provide this information so it is always 0
>> for kvm drivers. Maybe the driver could be improved to get network
>> traffic by other means. Do you have any idea on how this could be
>> done?
>>
>> Bye
>>
>> On Wed, Dec 30, 2009 at 10:18 PM, Shi Jin <jinzishuai at gmail.com> wrote:
>>>
>>> Hi there,
>>>
>>> I noticed that the "onevm show -x" command returns 0 in the XML output
>>>  <CPU>0</CPU>
>>>  <NET_TX>0</NET_TX>
>>>  <NET_RX>0</NET_RX>
>>> for all KVM virtual machine. I am not sure whether it is the same for
>>> Xen.
>>>
>>> Could you please comment on the possibility of monitor network traffic
>>> for individual VM in OpenNebula?
>>> I know that the "onehost show" command actually reports the traffic
>>> for each host but what is really interesting is to know exactly how
>>> much traffic used by each VM.
>>>
>>> Thank you very much and Happy New Year to All!
>>>
>>> --
>>> Shi Jin, Ph.D.
>>> _______________________________________________
>>> Users mailing list
>>> Users at lists.opennebula.org
>>> http://lists.opennebula.org/listinfo.cgi/users-opennebula.org
>>>
>>
>>
>>
>> --
>> Javier Fontan, Grid & Virtualization Technology Engineer/Researcher
>> DSA Research Group: http://dsa-research.org
>> Globus GridWay Metascheduler: http://www.GridWay.org
>> OpenNebula Virtual Infrastructure Engine: http://www.OpenNebula.org
>> _______________________________________________
>> Users mailing list
>> Users at lists.opennebula.org
>> http://lists.opennebula.org/listinfo.cgi/users-opennebula.org
>>
>
>



-- 
Shi Jin, Ph.D.



More information about the Users mailing list