[systemd-devel] net stats per app

Gustavo Sverzut Barbieri barbieri at profusion.mobi
Wed Aug 24 07:19:43 PDT 2011


On Wed, Aug 24, 2011 at 10:42 AM, Lennart Poettering
<lennart at poettering.net> wrote:
> On Tue, 02.08.11 15:51, Daniel Wagner (wagi at monom.org) wrote:
>
>> So my thinking is, instead of using the uid driver trick, I could use
>> cgroups for collecting the network traffic. At least from the sub module
>> description it seems to be the right spot to add a new statistic
>> interface.
>
> Yupp, that makes a lot of sense I'd say. For CPU accounting there's
> already cpuacct. Adding a netacct cgroup controller would make a lot of
> sense to me. (a hackish way to achieve this with existing tools might be
> to use net_cls for this or so. dunno, might already be enough if ip
> rules allows accounting.)
>
>> A open question is how I get the whole thing persistent. So not each
>> time when an application starts the counters begin at 0. My guts feeling
>> systemd should take of this but I don't know if that is the right
>> direction.
>
> Hmm, you could simply precreate the cgroups and mark the tasks file with
> +t (sticky bit). systemd won't remove the cgroup then after use. Or, we
> could add a new switch "ControlGroupPersistant=yes" or so which would
> set +t automatically but systemd would still create the groups for you
> (so that youdon't have to pre-create anything), but not delete them
> anymore. Would that make sense?
>
> (I have added this option now to the todo list, since it will make sense
> for stuff like cpuacct where we are in the same boat)

Likely he will need to keep accounting between reboots as well, in
this case the solution can't be in systemd or kernel, will need a tool
to walk these groups accumulate them into a persistent media. Be it
periodically, upon reboot or some other method.

-- 
Gustavo Sverzut Barbieri
http://profusion.mobi embedded systems
--------------------------------------
MSN: barbieri at gmail.com
Skype: gsbarbieri
Mobile: +55 (19) 9225-2202


More information about the systemd-devel mailing list