Polling eth0?

Peter Hansen peter at engcorp.com
Wed Apr 28 15:14:57 EDT 2004


Dennis Craven wrote:

> I intend on writing a small application that monitors incoming/outgoing
> traffic on eth0, and recording the bandwidth usage with monthly
> totals etc..
> 
> Where would be a good place to start in regards to connecting to 
> eth0 and reading such data? 

I would most definitely do this with appropriate calls to "iptables",
specifically using the -Z option with -L, which is designed specifically
for this kind of thing.

(If you aren't familiar with it, it's a Linux firewall command, not
anything to do with Python.  You could use os.popen() to call it
from Python though, and capture the output.)

-Peter



More information about the Python-list mailing list