Web hosting by ICDSoft
pppd-logger & pppd-logger-gtk :: Connection Estabilished

Logging pppd


Problem is to record elapsed time and traffic of all ppp connection estabilished by pppd, in order to have a report on band spend in a give periods.

There could be more type of connection (GPRS, ADSL, PSTN), different provider (ISP) and different price, based on traffic or on time.

Not Invasive Solution

If coming from MS Windows you could think to code a dialer that record everything and manage update in a db (or file). But on Linux such a kind of solution is too much invasive: the problem is that the process that create a new network interface should be run as super user or with suid, and more than that it have to setup all other thing, such as firewall and other.

Fortunately in Linux (or BSD, or any *NIX) there is pppd, that is a deamon which install network interface, run a chatscript for AT commands, a does all that is needed for estabilish a connection, but give you opportunity to do other task at start and end time.
Typically you can insert a script in /etc/ppp/ip-up.d/ directory and pppd call it everytime a network interface is up. (analogous for /etc/ppp/ip-down.d/ on net down).

This is the working schema for logging ppp connection:

pppd-logger is a simple C program that is run at every connection up and every connection down.

Note: if keep-alive is setted and connection goes down (pppd still live) scripts in ip-up.d and ip-down.d are called at any connection up and down, even if the deamon is the same.

Working schema is simple, the code is short. It is needed a GUI for making and looking at report.


This is also a simple program: it connects to a db, collect connection based on type (for device name) e do simple calc on cost given price per traffic and price per time

Look at screenshot of ppplogger

It is named -gtk, but actually it is linked against libgnomeui (for date-time widget) and gconf for db connection data (it was annoying to enter data every time I run the program, also I find gconf simple, kind and good)

In http://repository.smartango.com/debian/ there are source packages and binary .deb (compiled on Ubuntu, the program was originally writed for a Debian)

Both sofware are release without warranty and could be distribuited under condition of GPL. A copy of the license is included in the source package.

For any problems, suggest, comment contact me via email at daniele @ smartango.com

Parsing a posteriori

For record in db old connection (done before pppd-logger was born I wrote a perl script. This is in /parsing_log/

for pppd-logger e ppplogger-gtk

© Daniele Cruciani

Back to SmartanGo.com | torna UP

Web hosting by ICDSoft