Logging traffic stats for VEs [message #12791] |
Wed, 09 May 2007 15:44 |
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 |
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,
|
|
|
|
|