LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 04-30-2009, 08:44 PM   #1
number-g
LQ Newbie
 
Registered: Mar 2009
Distribution: Debian
Posts: 16

Rep: Reputation: 2
pppd, wvdial, ip-down script | monthly bandwidth measure


hi,

i've just made a little script that will tell me the RX and TX bytes of my ppp0 interface.

i'm with a 3g isp with a limited monthly bandwidth allowance and high overage fees; there is no facility to measure how much i've used in any given month so i want the script to run every time the interface goes down so that i can keep an eye on my bandwidth use.

my script just runs "ifconfig ppp0" and reads the last line, then takes the relevant information for processing elsewhere.

the problem (i think) i have ran into is that when i ctrl-c wvdial (or reboot the system or whatever), ppp0 is down before the script can run ifconfig to check the RX/TX, so it doesn't work.

any advice on the right approach for this would be much appreciated.

perhaps there is already some software out there that will accurately give me the details i need? this is all running on a console-only system.

thanks,

g
 
Old 05-02-2009, 06:08 PM   #2
salasi
Senior Member
 
Registered: Jul 2007
Location: Directly above centre of the earth, UK
Distribution: SuSE, plus some hopping
Posts: 4,070

Rep: Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897Reputation: 897
Quote:
Originally Posted by number-g View Post
i'm with a 3g isp with a limited monthly bandwidth allowance and high overage fees;
This probably doesn't help, but I note that 3 currently have an offer with a 15G/£15 monthly deal.
BTW, I'm assuming that you are using one of the, eg Huawei, USB dongles and that you don't have the companion router box.
Quote:
there is no facility to measure how much i've used in any given month
3 don't have a web page or something where you van look that up; that's an incredible oversight...no, sorry, knowing how inept some of these people are that really ought to be 'should be an incredible oversight'

Quote:
so i want the script to run every time the interface goes down so that i can keep an eye on my bandwidth use.

my script just runs "ifconfig ppp0" and reads the last line, then takes the relevant information for processing elsewhere.

the problem (i think) i have ran into is that when i ctrl-c wvdial (or reboot the system or whatever), ppp0 is down before the script can run ifconfig to check the RX/TX, so it doesn't work.
Well, I think your diagnosis of the problem is correct (and inevitable). If you stop the program with a control C, then it won't do the normal clean up at the end, and that includes writing out whatever information it would normally do to the command line. I'm not sure what the answer is, but there are a few options you can try:
  1. don't use ^C to stop wvdial
  2. if you don't use '-no-syslog', some information should get written to syslog, so it might be worth having a look to see if anything useful get written there
  3. use the router box (this isn't so much a solution, as a way of moving the problem somewhere else...but if that data goes over ethernet, you can use iptables to count packets (is there an option for bytes??) or maybe the router box itself can count the data)
If you don't use ^C, you have to stop wvdial somehow, and the issue is can you send it a signal that stops it, but does allow it to write out data as its final act? You could try something like SIGTERM instead of SIGINT (effectively) and see what happens.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there a way to measure QLA bandwidth at the host? markseger Linux - General 0 06-10-2008 05:44 AM
How to measure bandwidth usage on an IP-VPN setup using MRTG? depam Linux - Hardware 2 02-20-2007 09:38 AM
wvdial-pppd problem with earthlink Geocritter Linux - Networking 7 07-19-2005 07:23 AM
Limited monthly bandwidth management razormonkey Linux - Networking 5 01-22-2004 06:29 PM
pppd(wvdial) problem nakkaya Linux - Networking 3 06-23-2003 03:19 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 12:20 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration