Re: Is accounting supported?

On Sun, 2010-01-17 at 17:15 +0100, Daniel Wagner wrote:
> Hi Dan,
> >> Just out of curiosity: where does the accounting information come from?
> >> I see one possible solution using netfilter with ULOG target and the
> >> ulogd daemon.
> >>
> >> I guess when using ulogd there is always a certain lag between the
> >> number of bytes transferred/received and the user defined maximum of
> >> bytes transferred/received (probably enforced by PolicyKit). I don't
> >> think that's a real problem and could be workaround if there isn't the
> >> need to have exact numbers.
> >
> > At least for PPP we can get traffic counts via ioctls.  I'd like to get
> > traffic counts for the other devices like ifconfig does, but last I knew
> > ifconfig got that by scraping /proc/net/dev which is just ugly.  We may
> > be able to get updated traffic counts from netlink somehow?
> I tried to figure out how a generic solution would look like and the 
> solution I found was the thing with the ULOG trick. The kernel interface 
> to netfilter is netlink based and the ulogd daemon uses this API. Though 
> I'm not so sure if the authors recommand to use this API. IRC the 
> iptables API should not be used directly.

I forgot that the nl-link-stats tool in the libnl tarball is an example
of how to talk to netlink for stats.  Unfortunately as Marcel says we
have to poll for it at this point, but oh well...  A 2 - 5 second
interval is probably appropriate enough.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]