[systemd-devel] net stats per app
Daniel Wagner
wagi at monom.org
Wed Aug 24 08:22:50 PDT 2011
On 08/24/2011 04:19 PM, Gustavo Sverzut Barbieri wrote:
>>> 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.
Yes, the aim is to maintain statistics even over system reboots. I had
not yet time to figure out how this could be done.
The use case is as following:
We have a browser instance which is only used to connect to a our
company portal. The user is able to start another instance of the
browser which is used for ordinary web browsing. These two instance
should be treated differently, so we have to maintain two statistics,
one for the portal browser and one for the normal browser. If a certain
traffic limit has been reached on the ordinary web browser, ConnMan
should stop this session. The portal web browser is still allowed to
access the internet through the current path.
We have some more of those use cases but most of them can be mapped to
that one. If a limit for an application is reached either shutdown the
session or reroute the traffic to an different device.
If ConnMan would know which application is put into which cgroup then
ConnMan could maintain the statistics (also persistent). ConnMan knows
which network device/route is currently in use for the application. So
everything is there. I think systemd would be the wrong place to solve this.
cheers,
daniel
More information about the systemd-devel
mailing list