netcount

a command line tool to display PPP network connection statistics



netcount is a package for logging and displaying PPP network traffic on Linux machines. Logging is done via a small shell script which is called during the ip-up, ip-down and system startup processes and from cron, while analysis and printing is done by a program written in Python.

The following snippet shows an example of its typical output:

Date           Time   Rx Bytes     Tx Bytes       Rx       Tx           Length
Mon -02-03  8:53:46      2.412      0.114MB      9.77     0.46kB/s     0:04:07h
Mon -02-03 10:43:33      0.009      0.005MB      0.04     0.02kB/s     0:03:41h
[...]
Mon -02-03 20:54:16      0.851      0.181MB      0.93     0.20kB/s     0:15:17h
Mon -02-03 21:14:51      0.719      0.120MB      0.79     0.13kB/s     0:15:08h
Mon -02-03 22:37:29      0.267      0.045MB      0.70     0.12kB/s     0:06:18h
Mon -02-03 22:55:11      0.050      0.008MB      0.21     0.03kB/s     0:03:51h
Mon -02-03 23:04:50      0.152      0.022MB      0.49     0.07kB/s     0:05:12h
Mon -02-03 23:10:29      0.091      0.020MB      0.35     0.08kB/s     0:04:19h
Mon -02-03 23:37:31      2.011      0.100MB      5.80     0.29kB/s     0:05:47h
Mon -02-03 23:43:18      0.000      0.000MB      0.00     0.00kB/s     0:00:01h
-------------------------------------------------------------------------------
Mon -02-03              11.619      1.149MB      1.48     0.15kB/s     2:10:39h
                              7.92%                                      67.50% 

The display is highly customizable. You can select from different types of records as well as from different columns to print. netcount shows, among other things, network uptime, byte counts and transmission speeds (either as Tx and Rx bytes or summed up). Command line options also allow you to select from per-connection summaries as well as from daily and monthly summaries and from uptime and byte count percentages with respect to a daily and monthly total. These settings can be made permanent through the use of a configuration file which is written using a simple command line option.

netcount uses the kernel's ppp0 counter (found in /proc/net/dev), so packet filtering does not need to be installed. It is safe against this counter's overflow, so there is no 2 or 4 GiB limit. It should work under any flavor of Linux, including other families than the x86 systems.

You might want to have a look at its man page to see more of its features. See below for installation, download and version history.










nstat

an X utility to show PPP network state



nstat is an X application which comes with netcount. Depending on PPP network state, it shows one of the following four symbolic icons:

off PPP networking is off (pppd not running)
down ready for dialing out (and for auto dialing, if configured)
up on line, currently no traffic
traffic on line, traffic going through the PPP interface

The numbers beneath the icon show the connection time in hh:mm:ss format. Clicking on the window pops up an option menu, which, depending on permissions and network state, allows you to select from starting pppd, terminating pppd, hanging up and exiting nstat.

Besides displaying and changing pppd's state, nstat offers several options which might be useful in some situations like automatically restarting pppd if it dies or hanging up after an idle time just before the end of the current minute. You can look them up here in the man page.

nstat is packaged with netcount since they share the same logging facility.











© Heike C. Zimmerer