[systemd-devel] net stats per app

Jeremy belxjander at gmail.com
Wed Aug 24 07:43:12 PDT 2011


On Wed, 2011-08-24 at 11:19 -0300, Gustavo Sverzut Barbieri wrote:
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.
> 

ControlGroupPersistant=yes  for persistent runtime only statistics
ControlGroupPersistent=/<filename> for persistent disk-backed
statistics?

Would this be at all feasible? if the string is not "yes"/"no" string
variations,
  checking it for being a valid pathname and using it as an on-disk
store of statistics?

Feasible?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20110825/698207e2/attachment.pgp>


More information about the systemd-devel mailing list