Hi Javier,<br><br>I am trying to apply this patch to opennebula 1.4 but even after I change one_vmm_kvm.rb and onevm, i am not able to get the network statistics. It also stopped reporting memory now.<br><br>I know this has been added as part of 2.0 but I see there are more changes (Gangila integration)  etc. I just want to add this one particular feature to 1.4. <br>
<br>Any help is appreciated<br><br>Ranga<br><br><div class="gmail_quote">On Mon, May 17, 2010 at 9:57 AM, Javier Fontan <span dir="ltr"><<a href="mailto:jfontan@gmail.com">jfontan@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hello,<br>
<br>
Thank's a lot for the patch. A new ticket is created to add it. It<br>
will be added to one-1.6 as we don't want to add more "features" to<br>
current 1.4 branch.<br>
<br>
<a href="http://dev.opennebula.org/issues/244" target="_blank">http://dev.opennebula.org/issues/244</a><br>
<br>
Bye<br>
<div><div></div><div class="h5"><br>
On Sun, May 16, 2010 at 10:22 PM, Rogier Mars <<a href="mailto:rogier@fortytwo.nl">rogier@fortytwo.nl</a>> wrote:<br>
> Hi,<br>
><br>
> I've created a quick patch (see below) to the file one_vmm_kvm.rb to include<br>
> proper monitoring of network interface statistics for KVM.<br>
> This patch uses the libvirt dumpxml command and domifstat to get interface<br>
> statistics.<br>
><br>
> I've attached the updated one_vmm_kvm.rb file, see the patch below.<br>
><br>
> Best regards,<br>
><br>
> Rogier<br>
><br>
><br>
> 42a43<br>
>> require 'rexml/document'<br>
> 61c62,65<br>
> <         :poll     => "virsh --connect #{LIBVIRT_URI} dominfo"<br>
> ---<br>
>>         :poll     => "virsh --connect #{LIBVIRT_URI} dominfo",<br>
>>         :netstats => "virsh --connect #{LIBVIRT_URI} domifstat",<br>
>>         :dumpxml  => "virsh --connect #{LIBVIRT_URI} dumpxml"<br>
>><br>
> 146a151,162<br>
>>         exe2  = SSHCommand.run("#{LIBVIRT[:dumpxml]} #{deploy_id}", host,<br>
>>                               log_method(id))<br>
>><br>
>>        doc = REXML::Document.new(exe2.stdout)<br>
>>        interfaces = []<br>
>>        doc.elements.each('domain/devices/interface/target') do |ele|<br>
>>           interfaces << ele.attributes["dev"]<br>
>>        end<br>
>><br>
>>         exe3  = SSHCommand.run("#{LIBVIRT[:netstats]} #{deploy_id}<br>
>> #{interfaces}", host,<br>
>>                               log_method(id))<br>
>><br>
> 182a199<br>
>><br>
> 185a203,212<br>
>>         exe3.stdout.each_line {|line|<br>
>>             columns=line.split(" ").collect {|c| c.strip }<br>
>>             case columns[1]<br>
>>                 when 'rx_bytes'<br>
>>                     info << " #{POLL_ATTRIBUTE[:netrx]}="  <<<br>
>> (columns[2].to_i).to_s<br>
>>                 when 'tx_bytes'<br>
>>                     info << " #{POLL_ATTRIBUTE[:nettx]}="  <<<br>
>> (columns[2].to_i).to_s<br>
>>             end<br>
>> }<br>
>><br>
><br>
><br>
><br>
><br>
</div></div>> On May 12, 2010, at 1:23 AM, Rogier Mars wrote:<br>
><br>
>> Hi,<br>
>><br>
>> I just noticed this post and did some checking with libvirt. I am able to<br>
>> get the interface that is used in a KVM vm via the dumpxml command, and then<br>
>> get the network interface statistics via domifstat (see the example below).<br>
>> I think this could be included in the one_vmm_kvm.rb script. I'm not a ruby<br>
>> programmer, but I think this should be possible.<br>
>><br>
>> Cheers,<br>
>><br>
>> Rogier<br>
>><br>
>><br>
>> virsh # dumpxml one-60<br>
>> <domain type='kvm' id='11'><br>
>>  <name>one-60</name><br>
>>  <uuid>3e62f716-b9bc-4b3e-6af6-7121181a5487</uuid><br>
>>  <memory>524288</memory><br>
>>  <currentMemory>524288</currentMemory><br>
>>  <vcpu>2</vcpu><br>
>>  <os><br>
>>   <type arch='x86_64' machine='pc'>hvm</type><br>
>>   <boot dev='hd'/><br>
>>  </os><br>
>>  <features><br>
>>   <acpi/><br>
>>  </features><br>
>>  <clock offset='utc'/><br>
>>  <on_poweroff>destroy</on_poweroff><br>
>>  <on_reboot>restart</on_reboot><br>
>>  <on_crash>destroy</on_crash><br>
>>  <devices><br>
>>   <emulator>/usr/bin/kvm</emulator><br>
>>   <disk type='file' device='disk'><br>
>>     <source file='/srv/cloud/one/var/60/images/disk.0'/><br>
>>     <target dev='hda' bus='ide'/><br>
>>   </disk><br>
>>   <interface type='bridge'><br>
>>     <mac address='00:03:5d:bc:f9:64'/><br>
>>     <source bridge='br1'/><br>
>>     <target dev='vnet1'/><br>
>>   </interface><br>
>>  </devices><br>
>> </domain><br>
>><br>
>> virsh # domifstat one-60 vnet1<br>
>> vnet1 rx_bytes 517120841<br>
>> vnet1 rx_packets 6065654<br>
>> vnet1 rx_errs 0<br>
>> vnet1 rx_drop 0<br>
>> vnet1 tx_bytes 189675090<br>
>> vnet1 tx_packets 1166682<br>
>> vnet1 tx_errs 0<br>
>> vnet1 tx_drop 0<br>
>><br>
>> virsh #<br>
>><br>
>><br>
>> On Jan 7, 2010, at 10:52 AM, Javier Fontan wrote:<br>
>><br>
>>> Hello,<br>
>>><br>
>>><br>
>>> Hello,<br>
>>><br>
>>> Libvirt does not directly provide this information so it is always 0<br>
>>> for kvm drivers. Maybe the driver could be improved to get network<br>
>>> traffic by other means. Do you have any idea on how this could be<br>
>>> done?<br>
>>><br>
>>> Bye<br>
>>><br>
>>> On Wed, Dec 30, 2009 at 10:18 PM, Shi Jin <<a href="mailto:jinzishuai@gmail.com">jinzishuai@gmail.com</a>> wrote:<br>
>>>><br>
>>>> Hi there,<br>
>>>><br>
>>>> I noticed that the "onevm show -x" command returns 0 in the XML output<br>
>>>> <CPU>0</CPU><br>
>>>> <NET_TX>0</NET_TX><br>
>>>> <NET_RX>0</NET_RX><br>
>>>> for all KVM virtual machine. I am not sure whether it is the same for<br>
>>>> Xen.<br>
>>>><br>
>>>> Could you please comment on the possibility of monitor network traffic<br>
>>>> for individual VM in OpenNebula?<br>
>>>> I know that the "onehost show" command actually reports the traffic<br>
>>>> for each host but what is really interesting is to know exactly how<br>
>>>> much traffic used by each VM.<br>
>>>><br>
>>>> Thank you very much and Happy New Year to All!<br>
>>>><br>
>>>> --<br>
>>>> Shi Jin, Ph.D.<br>
>>>> _______________________________________________<br>
>>>> Users mailing list<br>
>>>> <a href="mailto:Users@lists.opennebula.org">Users@lists.opennebula.org</a><br>
>>>> <a href="http://lists.opennebula.org/listinfo.cgi/users-opennebula.org" target="_blank">http://lists.opennebula.org/listinfo.cgi/users-opennebula.org</a><br>
>>>><br>
>>><br>
>>><br>
>>><br>
>>> --<br>
>>> Javier Fontan, Grid & Virtualization Technology Engineer/Researcher<br>
>>> DSA Research Group: <a href="http://dsa-research.org" target="_blank">http://dsa-research.org</a><br>
>>> Globus GridWay Metascheduler: <a href="http://www.GridWay.org" target="_blank">http://www.GridWay.org</a><br>
>>> OpenNebula Virtual Infrastructure Engine: <a href="http://www.OpenNebula.org" target="_blank">http://www.OpenNebula.org</a><br>
>>> _______________________________________________<br>
>>> Users mailing list<br>
>>> <a href="mailto:Users@lists.opennebula.org">Users@lists.opennebula.org</a><br>
>>> <a href="http://lists.opennebula.org/listinfo.cgi/users-opennebula.org" target="_blank">http://lists.opennebula.org/listinfo.cgi/users-opennebula.org</a><br>
>>><br>
>><br>
>> _______________________________________________<br>
>> Users mailing list<br>
>> <a href="mailto:Users@lists.opennebula.org">Users@lists.opennebula.org</a><br>
>> <a href="http://lists.opennebula.org/listinfo.cgi/users-opennebula.org" target="_blank">http://lists.opennebula.org/listinfo.cgi/users-opennebula.org</a><br>
>><br>
><br>
><br>
><br>
<br>
<br>
<br>
--<br>
<font color="#888888">Javier Fontan, Grid & Virtualization Technology Engineer/Researcher<br>
DSA Research Group: <a href="http://dsa-research.org" target="_blank">http://dsa-research.org</a><br>
Globus GridWay Metascheduler: <a href="http://www.GridWay.org" target="_blank">http://www.GridWay.org</a><br>
OpenNebula Virtual Infrastructure Engine: <a href="http://www.OpenNebula.org" target="_blank">http://www.OpenNebula.org</a><br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opennebula.org">Users@lists.opennebula.org</a><br>
<a href="http://lists.opennebula.org/listinfo.cgi/users-opennebula.org" target="_blank">http://lists.opennebula.org/listinfo.cgi/users-opennebula.org</a><br>
</font></blockquote></div><br>