Re: Is accounting supported?

2010-01-19 Thread Андрей Григорьев
May be you could use conntrack events subsystem for accounting? In
such way, by using conntrack, it can become an a good solution to
control traffic. There is a simple scrypt on python, that catch events
from conntrack using ctypes to interact with
libnetfilter_conntrack.so,
http://code.activestate.com/recipes/577011/.

2010/1/19 Dan Williams d...@redhat.com:
 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.

 Dan


 ___
 NetworkManager-list mailing list
 NetworkManager-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/networkmanager-list

___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: Is accounting supported?

2010-01-19 Thread José Queiroz
What about using SNMP data to gather accounting on interfaces?
___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: Is accounting supported?

2010-01-19 Thread Dan Williams
On Tue, 2010-01-19 at 12:10 -0200, José Queiroz wrote:
 What about using SNMP data to gather accounting on interfaces?

Honestly I'd rather just go to the source (netlink) from which most of
these interfaces get their data anyway.  Fewer layers in the system that
way.  Any of the other methods get their data out of the kernel's
netdevice, which is where the netlink bits read it from too.

Dan


___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: Is accounting supported?

2010-01-18 Thread Dan Williams
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.

Dan


___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: Is accounting supported?

2010-01-17 Thread Daniel Wagner

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.


daniel

___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: Is accounting supported?

2010-01-17 Thread Marcel Holtmann
Hi Daniel,

  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 looked into that a few weeks ago and you get netlink messages with the
statistics details for all network interfaces. You get them even when
you unplug the adapter suddenly via the DELLINK netlink message.

However you don't get periodic updates. It might be useful to extend the
kernel with an option to send NEWLINK updates when certain amount of
packets/bytes have been received or transmitted.

The tricky part here is obvious the case that if you have no consumer of
these information you don't want any updates. Meaning if no UI component
is showing these information, then don't even bother to make the kernel
send out updates.

Regards

Marcel


___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: Is accounting supported?

2010-01-13 Thread Dan Williams
On Wed, 2010-01-13 at 08:09 +0100, Daniel Wagner wrote:
 On 01/07/2010 05:27 PM, Dan Williams wrote:
  On Thu, 2010-01-07 at 08:18 +, Alex Buell wrote:
  On Wed, 2010-01-06 at 22:51 -0800, Dan Williams wrote:
  On Tue, 2010-01-05 at 14:31 +0530, Elison Niven wrote:
  Hi List,
 
  I am using Network manager with Gnome network applet on Fedora 12.
 
  Are there any options for getting accounting like information about 
  connect
  times, data bytes in and out etc?
 
  Not yet, but I've been trying to get somebody interested in doing the
  feature since I'm swamped with a bunch of other stuff at this point.  It
  shouldn't be too bad; we just keep a sqlite database around of all
  connection start/stop/bytecounts and then expose that as a D-Bus
  interface that applets can read.  Either somebody needs to step up or I
  guess just wait until I get around to it.
 
  I'd like to volunteer to do this. I'll get around to it over the weekend
  and send you patches if you like. All I need is a list of desired
  features and I'll implement it. Just my way of contributing to NM!
 
  Excellent!  I put a summary of what I think should be done here:
 
  https://bugzilla.gnome.org/show_bug.cgi?id=601372
 
  Does the stuff in Comment #3 sound doable?  You don't have to do
  everything at the start but we can do it incrementally.  Like you don't
  need to populate the user-id and user-name fields yet, since we need
  to do a bit more internally to NM to store that information in the
  NMActRequest structure (by pulling the uid off the D-Bus request to
  start the connection).
 
  Let me know if you have any questions.
 
 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?

Dan


___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: Is accounting supported?

2010-01-12 Thread Daniel Wagner

On 01/07/2010 05:27 PM, Dan Williams wrote:

On Thu, 2010-01-07 at 08:18 +, Alex Buell wrote:

On Wed, 2010-01-06 at 22:51 -0800, Dan Williams wrote:

On Tue, 2010-01-05 at 14:31 +0530, Elison Niven wrote:

Hi List,

I am using Network manager with Gnome network applet on Fedora 12.

Are there any options for getting accounting like information about connect
times, data bytes in and out etc?


Not yet, but I've been trying to get somebody interested in doing the
feature since I'm swamped with a bunch of other stuff at this point.  It
shouldn't be too bad; we just keep a sqlite database around of all
connection start/stop/bytecounts and then expose that as a D-Bus
interface that applets can read.  Either somebody needs to step up or I
guess just wait until I get around to it.


I'd like to volunteer to do this. I'll get around to it over the weekend
and send you patches if you like. All I need is a list of desired
features and I'll implement it. Just my way of contributing to NM!


Excellent!  I put a summary of what I think should be done here:

https://bugzilla.gnome.org/show_bug.cgi?id=601372

Does the stuff in Comment #3 sound doable?  You don't have to do
everything at the start but we can do it incrementally.  Like you don't
need to populate the user-id and user-name fields yet, since we need
to do a bit more internally to NM to store that information in the
NMActRequest structure (by pulling the uid off the D-Bus request to
start the connection).

Let me know if you have any questions.


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.


thanks,
daniel
___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: Is accounting supported?

2010-01-07 Thread Alex Buell
On Wed, 2010-01-06 at 22:51 -0800, Dan Williams wrote:
 On Tue, 2010-01-05 at 14:31 +0530, Elison Niven wrote:
  Hi List,
  
  I am using Network manager with Gnome network applet on Fedora 12.
  
  Are there any options for getting accounting like information about connect
  times, data bytes in and out etc?
 
 Not yet, but I've been trying to get somebody interested in doing the
 feature since I'm swamped with a bunch of other stuff at this point.  It
 shouldn't be too bad; we just keep a sqlite database around of all
 connection start/stop/bytecounts and then expose that as a D-Bus
 interface that applets can read.  Either somebody needs to step up or I
 guess just wait until I get around to it.

I'd like to volunteer to do this. I'll get around to it over the weekend
and send you patches if you like. All I need is a list of desired
features and I'll implement it. Just my way of contributing to NM!
-- 
http://www.munted.org.uk

One very high maintenance cat living here.
___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: Is accounting supported?

2010-01-07 Thread Dan Williams
On Thu, 2010-01-07 at 08:18 +, Alex Buell wrote:
 On Wed, 2010-01-06 at 22:51 -0800, Dan Williams wrote:
  On Tue, 2010-01-05 at 14:31 +0530, Elison Niven wrote:
   Hi List,
   
   I am using Network manager with Gnome network applet on Fedora 12.
   
   Are there any options for getting accounting like information about 
   connect
   times, data bytes in and out etc?
  
  Not yet, but I've been trying to get somebody interested in doing the
  feature since I'm swamped with a bunch of other stuff at this point.  It
  shouldn't be too bad; we just keep a sqlite database around of all
  connection start/stop/bytecounts and then expose that as a D-Bus
  interface that applets can read.  Either somebody needs to step up or I
  guess just wait until I get around to it.
 
 I'd like to volunteer to do this. I'll get around to it over the weekend
 and send you patches if you like. All I need is a list of desired
 features and I'll implement it. Just my way of contributing to NM!

Excellent!  I put a summary of what I think should be done here:

https://bugzilla.gnome.org/show_bug.cgi?id=601372

Does the stuff in Comment #3 sound doable?  You don't have to do
everything at the start but we can do it incrementally.  Like you don't
need to populate the user-id and user-name fields yet, since we need
to do a bit more internally to NM to store that information in the
NMActRequest structure (by pulling the uid off the D-Bus request to
start the connection).

Let me know if you have any questions.

Thanks!
Dan


___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: Is accounting supported?

2010-01-06 Thread Dan Williams
On Tue, 2010-01-05 at 14:31 +0530, Elison Niven wrote:
 Hi List,
 
 I am using Network manager with Gnome network applet on Fedora 12.
 
 Are there any options for getting accounting like information about connect
 times, data bytes in and out etc?

Not yet, but I've been trying to get somebody interested in doing the
feature since I'm swamped with a bunch of other stuff at this point.  It
shouldn't be too bad; we just keep a sqlite database around of all
connection start/stop/bytecounts and then expose that as a D-Bus
interface that applets can read.  Either somebody needs to step up or I
guess just wait until I get around to it.

Dan


___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list