Monitoring Mobile Broadband Bandwidth Usage

Filed under Uncategorized

A while back, I blogged about how I connect to Verizon mobile broadband in Lubuntu. Now that I am connected, I have to worry about the monthly 5GB/month limit enforced by Verizon. In order to avoid the very high overuse fees, I must carefully monitor my bandwidth usage.

I’ve chosen the easy to set up vnstat to monitor bandwidth and vnstati to output the stats as an image. Installing vnstat and vnstati in Ubuntu is as simple as:

sudo apt-get install vnstat vnstati

Once vnstat is installed, I must tell vnstat to start monitoring my network interface. For my mobile broadband setup, the interface is ppp0.

sudo vnstat -u -i ppp0

After running that command, I rebooted to make sure the vnstat daemon was running.
Now vnstat is storing network usage information in a database. But how can one see this information in an easy-to-understand form? This command will output an image with a nice graph showing daily bandwidth usage:

vnstati -i ppp0 -o ~/vnstat.png -d

Of course, I don’t want to run that command every time I want to see up-to-date stats. So I create a cron job to run the command every five minutes by running

crontab -e

copying

0,5,10,15,20,25,30,35,40,45,50,55 * * * * vnstati -i ppp0 -o ~/vnstat.png -d

into the editor, and then saving the file.

Cron will immediately start doing its thing and within five minutes an up-to-date image will appear in the home folder.

For convenience, I have made file:///home/mac9416/vnstat.png my home page in Firefox. When I want to check the latest stats, I simply refresh the page.

http://mac9416.com/2010/06/12/connecting-to-verizon-mobile-broadband-in-ubuntu-10-04/

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*