[Users] Logging traffic stats for VEs

Thorsten Schifferdecker tsd at debian.systs.org
Wed May 9 13:51:17 EDT 2007

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}'


b) or, VE has enabled sysfs:

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


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

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,

More information about the Users mailing list