Measuring cumulative network statistics per user or per process

Posted by zsimpson on Server Fault See other posts from Server Fault or by zsimpson
Published on 2012-02-29T21:23:33Z Indexed on 2012/12/06 23:06 UTC
Read the original article Hit count: 298

Filed under:
|
|

I've been googling for hours -- Under Linux I want to know the cumulative bytes sent and received by user or by process over all ip protocols. The best I've found in my searches is that it's possible to use iptables to mark packets for a user, for example:

iptables -t mangle -A OUTPUT -p tcp -m owner --uid-owner test -j MARK --set-mark 1

It appears that "tc" can then shape traffic with that but I just want the statistic -- I don't want to shape the traffic. I want something like: "user U has transmitted used XMB since time Y". I can't figure out how to get statistics from these marked packets. Also, I've looked at nethogs but they seem to be measuring the instantaneous flow and I need cumulative counts. Anyone have ideas?

© Server Fault or respective owner

Related posts about linux

Related posts about iptables