public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* Using snmpd on host to monitor guest bandwidth usage
@ 2009-10-24 13:52 Neil Aggarwal
  2009-10-24 19:49 ` Nikolai K. Bochev
  0 siblings, 1 reply; 5+ messages in thread
From: Neil Aggarwal @ 2009-10-24 13:52 UTC (permalink / raw)
  To: kvm

Hello:

I am using Cacti to monitor traffic usage on my network.

According to what I am reading, snmpd can report traffic
stats to Cacti.

Running netstat -in on the host, I see this output:

Kernel Interface table
Iface       MTU Met    RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP
TX-OVR Flg
br0        1500   0   237609      0      0      0    13615      0      0
0 BMRU
eth0       1500   0   967594      0      0      0   354576      0      0
0 BMRU
lo        16436   0       63      0      0      0       63      0      0
0 LRU
virbr0     1500   0        0      0      0      0       32      0      0
0 BMRU
vnet0      1500   0    29802      0      0      0   306940      0      0
0 BMRU
vnet1      1500   0   311556      0      0      0   789331      0      0
0 BMRU

Each guest runs a bridge interface with a static IP address.
Looking at the firewall logs vnet1 is connected to guestA and
vnet0 is connected to guestB.  Will that ever change if I reboot
the host or the guests?  If it does, that would be a problem.

Are there any pitfalls of using this approach?

I am looking for a solution where I do not need to run anything
on the guests.

Thanks,
	Neil

--
Neil Aggarwal, (281)846-8957, www.JAMMConsulting.com
Will your e-commerce site go offline if you have
a DB server failure, fiber cut, flood, fire, or other disaster?
If so, ask about our geographically redundant database system.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Using snmpd on host to monitor guest bandwidth usage
  2009-10-24 13:52 Using snmpd on host to monitor guest bandwidth usage Neil Aggarwal
@ 2009-10-24 19:49 ` Nikolai K. Bochev
  2009-10-25  0:23   ` Neil Aggarwal
  0 siblings, 1 reply; 5+ messages in thread
From: Nikolai K. Bochev @ 2009-10-24 19:49 UTC (permalink / raw)
  To: Neil Aggarwal; +Cc: kvm

Hello,

As far as i know, you can fix the vm's interfaces on the host. I'm using libvirt and you can do it there as described in here :

http://libvirt.org/formatdomain.html#elementsNICSBridge ( What you're looking for is <target dev='vnet0'/> directive ).

If you don't do this, vnet interfaces will be assigned to vm's in the order they start - the first one getting vnet0, the second one vnet1 etc.


----- Original Message -----
From: "Neil Aggarwal" <neil@JAMMConsulting.com>
To: kvm@vger.kernel.org
Sent: Saturday, October 24, 2009 4:52:59 PM
Subject: Using snmpd on host to monitor guest bandwidth usage

Hello:

I am using Cacti to monitor traffic usage on my network.

According to what I am reading, snmpd can report traffic
stats to Cacti.

Running netstat -in on the host, I see this output:

Kernel Interface table
Iface       MTU Met    RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP
TX-OVR Flg
br0        1500   0   237609      0      0      0    13615      0      0
0 BMRU
eth0       1500   0   967594      0      0      0   354576      0      0
0 BMRU
lo        16436   0       63      0      0      0       63      0      0
0 LRU
virbr0     1500   0        0      0      0      0       32      0      0
0 BMRU
vnet0      1500   0    29802      0      0      0   306940      0      0
0 BMRU
vnet1      1500   0   311556      0      0      0   789331      0      0
0 BMRU

Each guest runs a bridge interface with a static IP address.
Looking at the firewall logs vnet1 is connected to guestA and
vnet0 is connected to guestB.  Will that ever change if I reboot
the host or the guests?  If it does, that would be a problem.

Are there any pitfalls of using this approach?

I am looking for a solution where I do not need to run anything
on the guests.

Thanks,
	Neil

--
Neil Aggarwal, (281)846-8957, www.JAMMConsulting.com
Will your e-commerce site go offline if you have
a DB server failure, fiber cut, flood, fire, or other disaster?
If so, ask about our geographically redundant database system.

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: Using snmpd on host to monitor guest bandwidth usage
  2009-10-24 19:49 ` Nikolai K. Bochev
@ 2009-10-25  0:23   ` Neil Aggarwal
  2009-10-25  5:46     ` Avi Kivity
  0 siblings, 1 reply; 5+ messages in thread
From: Neil Aggarwal @ 2009-10-25  0:23 UTC (permalink / raw)
  To: kvm

> As far as i know, you can fix the vm's interfaces on the 
> host. I'm using libvirt and you can do it there as described in here :
> http://libvirt.org/formatdomain.html#elementsNICSBridge ( 
> What you're looking for is <target dev='vnet0'/> directive ).

Setting the target device name is not working.

Here is what I did:

I stopped both my guests.

Next, I opened the file /etc/libvirt/qemu/jamm12a.xml
for my first virtual host and added a target element
for the interface:
    <interface type='bridge'>
      <mac address='54:52:00:4f:83:67'/>
      <source bridge='br0'/>
      <target dev='vnet1'/>
    </interface>

I started the virtual host and when I do ifconfig,
I see vnet0.

Also, when look in /var/log/libvirt/qemu/jamm12a.log,
I see this info:

LC_ALL=C PATH=/sbin:/usr/sbin:/bin:/usr/bin HOME=/ /usr/libexec/qemu-kvm -S
-M pc -m 1024 -smp 1 -name jamm12a -uuid
6452dcff-c20f-908b-d1ee-7dcf1406a3e0 -monitor pty -pidfile
/var/run/libvirt/qemu//jamm12a.pid -boot c -drive
file=/var/lib/libvirt/images/jamm12a.img,if=ide,index=0,boot=on -drive
file=,if=ide,media=cdrom,index=2 -net nic,macaddr=54:52:00:4f:83:67,vlan=0
-net tap,fd=12,script=,vlan=0,ifname=vnet0 -serial pty -parallel none -usb
-vnc 127.0.0.1:0 -k en-us

The ifname has vnet0 for its value.

This seems to be a bug in KVM.  I searched the bug tracker and I
do not see anything related.

I am using KVM 83-105.el5 installed by yum in CentOS 5.4,
could this be fixed in a later version of KVM?

Thanks,
	Neil

--
Neil Aggarwal, (281)846-8957, www.JAMMConsulting.com
Will your e-commerce site go offline if you have
a DB server failure, fiber cut, flood, fire, or other disaster?
If so, ask about our geographically redundant database system. 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Using snmpd on host to monitor guest bandwidth usage
  2009-10-25  0:23   ` Neil Aggarwal
@ 2009-10-25  5:46     ` Avi Kivity
  2009-10-25  7:02       ` Nikolai K. Bochev
  0 siblings, 1 reply; 5+ messages in thread
From: Avi Kivity @ 2009-10-25  5:46 UTC (permalink / raw)
  To: Neil Aggarwal; +Cc: kvm

On 10/25/2009 02:23 AM, Neil Aggarwal wrote:
>> As far as i know, you can fix the vm's interfaces on the
>> host. I'm using libvirt and you can do it there as described in here :
>> http://libvirt.org/formatdomain.html#elementsNICSBridge (
>> What you're looking for is<target dev='vnet0'/>  directive ).
>>      
> Setting the target device name is not working.
>
> Here is what I did:
>
> I stopped both my guests.
>
> Next, I opened the file /etc/libvirt/qemu/jamm12a.xml
> for my first virtual host and added a target element
> for the interface:
>      <interface type='bridge'>
>        <mac address='54:52:00:4f:83:67'/>
>        <source bridge='br0'/>
>        <target dev='vnet1'/>
>      </interface>
>
>    

Please take this to the libvirt mailing list, since that is all handled 
by libvirt, not qemu or kvm.

-- 
Do not meddle in the internals of kernels, for they are subtle and quick to panic.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Using snmpd on host to monitor guest bandwidth usage
  2009-10-25  5:46     ` Avi Kivity
@ 2009-10-25  7:02       ` Nikolai K. Bochev
  0 siblings, 0 replies; 5+ messages in thread
From: Nikolai K. Bochev @ 2009-10-25  7:02 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm, Neil Aggarwal

I'm just gonna answer him very shortly here :

virsh destroy jamm12a
virsh define /etc/libvirt/qemu/jamm12a.xml
virsh start jamm12a

And yes, this convo doesn't belong here.

----- Original Message -----
From: "Avi Kivity" <avi@redhat.com>
To: "Neil Aggarwal" <neil@JAMMConsulting.com>
Cc: kvm@vger.kernel.org
Sent: Sunday, October 25, 2009 7:46:15 AM
Subject: Re: Using snmpd on host to monitor guest bandwidth usage

On 10/25/2009 02:23 AM, Neil Aggarwal wrote:
>> As far as i know, you can fix the vm's interfaces on the
>> host. I'm using libvirt and you can do it there as described in here :
>> http://libvirt.org/formatdomain.html#elementsNICSBridge (
>> What you're looking for is<target dev='vnet0'/>  directive ).
>>      
> Setting the target device name is not working.
>
> Here is what I did:
>
> I stopped both my guests.
>
> Next, I opened the file /etc/libvirt/qemu/jamm12a.xml
> for my first virtual host and added a target element
> for the interface:
>      <interface type='bridge'>
>        <mac address='54:52:00:4f:83:67'/>
>        <source bridge='br0'/>
>        <target dev='vnet1'/>
>      </interface>
>
>    

Please take this to the libvirt mailing list, since that is all handled 
by libvirt, not qemu or kvm.

-- 
Do not meddle in the internals of kernels, for they are subtle and quick to panic.

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-10-25  7:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-24 13:52 Using snmpd on host to monitor guest bandwidth usage Neil Aggarwal
2009-10-24 19:49 ` Nikolai K. Bochev
2009-10-25  0:23   ` Neil Aggarwal
2009-10-25  5:46     ` Avi Kivity
2009-10-25  7:02       ` Nikolai K. Bochev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox