Logging PPP downloads

Joel Pearson pearj at iprimus.com.au
Thu Jan 30 23:08:02 EST 2003


Hello again,

 

I decided to read the man page for pppd properly and lo and behold all sorts
of useful information at the end of the file.

 

>From the man page:

For  the  ip-down  and  auth-down scripts, pppd also sets the following

       variables giving statistics for the connection:

 

       CONNECT_TIME

              The number of seconds from  when  the  PPP  negotiation
started

              until the connection was terminated.

 

       BYTES_SENT

              The  number of bytes sent (at the level of the serial port)
durâ

              ing the connection.

 

       BYTES_RCVD

              The number of bytes received (at the level of the  serial
port)

              during the connection.

 

       LINKNAME

              The logical name of the link, set with the linkname option.

 

In my ip-down.local script I told it to run a simple php script that dumped
the environment to a file and these are the results that came back:

 

PPPD_PID: 7754

PPPLOGNAME: root

BYTES_RCVD: 1952018

SPEED: 38400

IPREMOTE: 172.31.20.4

CONNECT_TIME: 357

IFNAME: ppp0

DNS2: 203.134.65.66

PATH: /sbin:/usr/sbin:/bin:/usr/bin

DNS1: 203.134.64.66

_: /usr/bin/php

PWD: /

BYTES_SENT: 95152

SHLVL: 2

USEPEERDNS: 1

ORIG_UID: 0

IPLOCAL: 210.50.130.19

 

This looks very promising, assuming that pppd always creates those
environment variable I should be set.

 

Joel

 

~~~~~~~~~~~~~~~~~~~~~~~

Joel Pearson

Email: pearj at writeme.com

ICQ:1580379 <http://web.icq.com/wwp/1,,,00.html?Uin=1580379> 

MSN: joelpearson at hotmail.com
<http://members.msn.com/default.msnw?mem=joelpearson@hotmail.com&pgmarket=en
-au> 

 

-----Original Message-----
From: Joel Pearson [mailto:pearj at iprimus.com.au] 
Sent: Thursday, 30 January 2003 2:09 AM
To: 'Linux user group'
Subject: Logging PPP downloads

 

Hi,

 

I was wondering if anyone has had much experience with logging how much has
been downloaded at the end of a ppp connection.

 

The amount of data downloaded is written into /var/log/messages most of the
time in this format:

Jan 20 08:46:49 roadkill pppd[12418]: LCP terminated by peer

Jan 20 08:46:49 roadkill pppoe[12419]: Session 2557 terminated -- received
PADT from peer

Jan 20 08:46:49 roadkill pppoe[12419]: Sent PADT

Jan 20 08:46:49 roadkill pppd[12418]: Modem hangup

Jan 20 08:46:49 roadkill pppd[12418]: Connection terminated.

Jan 20 08:46:49 roadkill pppd[12418]: Connect time 1440.2 minutes.

Jan 20 08:46:49 roadkill pppd[12418]: Sent 44607376 bytes, received
1768095764 bytes.

 

 

But occasionly something in pppd screws up and for some reason it decides
not to tell me how much it’s downloaded:

 

Jan 22 15:14:24 roadkill pppd[1174]: LCP terminated by peer

Jan 22 15:14:24 roadkill pppoe[1175]: Session 3163 terminated -- received
PADT from peer

Jan 22 15:14:24 roadkill pppoe[1175]: Sent PADT

Jan 22 15:14:24 roadkill pppd[1174]: ioctl(PPPIOCSASYNCMAP): Inappropriate
ioctl for device(25)

Jan 22 15:14:24 roadkill pppd[1174]: tcflush failed: Input/output error

Jan 22 15:14:24 roadkill pppd[1174]: Exit.

 

Is there any reliable way of finding out how much data was downloaded
through ppp at the end of a connection?

 

Thanks

 

~~~~~~~~~~~~~~~~~~~~~~~

Joel Pearson

Email: pearj at writeme.com

ICQ:1580379 <http://web.icq.com/wwp/1,,,00.html?Uin=1580379> 

MSN: joelpearson at hotmail.com
<http://members.msn.com/default.msnw?mem=joelpearson@hotmail.com&pgmarket=en
-au> 

 

-------------- next part --------------
HTML attachment scrubbed and removed


More information about the linux mailing list