OpenVZ Forum


Home » Mailing lists » Users » Logging traffic stats for VEs
Logging traffic stats for VEs [message #12791] Wed, 09 May 2007 15:44 Go to next message
pookey is currently offline  pookey
Messages: 12
Registered: March 2007
Junior Member
Hi all,

I need to graph the traffic usage for each VE. I've seen on the wiki
that I should use iptables for this, but it seems to me that there
should be some kind of counter as part of the openVZ counters - is there?

My concern with using iptables is that in a situation when you have
multiple hosts, the VE could be moved around between hosts a fair
amount, and therefore the iptables counters won't be relevant.

I'm sure someone must have solved this issue before, care to share?

Thanks,

--
Ian P. Christian ~ http://pookey.co.uk
Re: Logging traffic stats for VEs [message #12794 is a reply to message #12791] Wed, 09 May 2007 17:51 Go to previous messageGo to next message
Thorsten Schifferdeck is currently offline  Thorsten Schifferdeck
Messages: 38
Registered: February 2006
Member
Hi Ian,

a) use the /proc/net/dev of your VE:

# vzctl exec <VEID> grep venet0 /proc/net/dev | cut -d":" -f2 | awk
'{print $1"\n"$9}'

xxx
xxx

b) or, VE has enabled sysfs:

# vzctl exec <VEID> cat /sys/class/net/venet0/statistics/{r,t}x_bytes

xxx
xxx

a) and b) prints netstats of VE-netdev venet0, in and out in bytes, so
you can put these stats in a a rrd or in a sql database, a old howto
which use a) can be found at
http://forum.openvz.org/index.php?t=msg&th=261&start =0&

Hope this helps,
Thorsten Schifferdecker

Ian P. Christian schrieb:
> Hi all,
>
> I need to graph the traffic usage for each VE. I've seen on the wiki
> that I should use iptables for this, but it seems to me that there
> should be some kind of counter as part of the openVZ counters - is there?
>
> My concern with using iptables is that in a situation when you have
> multiple hosts, the VE could be moved around between hosts a fair
> amount, and therefore the iptables counters won't be relevant.
>
> I'm sure someone must have solved this issue before, care to share?
>
> Thanks,
Re: Logging traffic stats for VEs [message #12795 is a reply to message #12794] Wed, 09 May 2007 17:58 Go to previous messageGo to next message
pookey is currently offline  pookey
Messages: 12
Registered: March 2007
Junior Member
Thorsten Schifferdecker wrote:
> Hi Ian,
>
> a) use the /proc/net/dev of your VE:
>
> # vzctl exec <VEID> grep venet0 /proc/net/dev | cut -d":" -f2 | awk
> '{print $1"\n"$9}'
>
> xxx
> xxx
>
> b) or, VE has enabled sysfs:
>
> # vzctl exec <VEID> cat /sys/class/net/venet0/statistics/{r,t}x_bytes

These would both be reset on a customer rebooting their VE wouldn't
they? Is there any way a user of a VE could manipulate the figures in
either of these places?


Thanks!

--
Ian P. Christian ~ http://pookey.co.uk
Re: Logging traffic stats for VEs [message #12808 is a reply to message #12795] Thu, 10 May 2007 10:09 Go to previous message
dev is currently offline  dev
Messages: 1693
Registered: September 2005
Location: Moscow
Senior Member

Ian P. Christian wrote:
> Thorsten Schifferdecker wrote:
>
>>Hi Ian,
>>
>>a) use the /proc/net/dev of your VE:
>>
>># vzctl exec <VEID> grep venet0 /proc/net/dev | cut -d":" -f2 | awk
>>'{print $1"\n"$9}'
>>
>>xxx
>>xxx
>>
>>b) or, VE has enabled sysfs:
>>
>># vzctl exec <VEID> cat /sys/class/net/venet0/statistics/{r,t}x_bytes
>
>
> These would both be reset on a customer rebooting their VE wouldn't
> they? Is there any way a user of a VE could manipulate the figures in
> either of these places?
yep. if you want non-resetable counters then add iptables rules
in VE0 for VE IP addresses. And then read these statistics via iptables -L -v

Thanks,
Kirill
Previous Topic: VEs and rebooting
Next Topic: About many connections in SMTP
Goto Forum:
  


Current Time: Sat Apr 27 16:20:04 GMT 2024

Total time taken to generate the page: 0.02367 seconds