Return to David's Python Archive

Netusage

A simple script to prevent surprise ISP Traffic Bills

In some backwaters of the internet, such as New Zealand, most ISPs set strict traffic caps and charge without mercy when you exceed these limits.

This script will save you the worry and risk of financial loss.

Features:

Requirements

Installation

Just put the script somewhere, and chmod it to ugo+x or

Then, edit a couple of constants at the top of the script to suit your situation.
Don't worry - it's easy, and there's nothing esoteric - I promise!

Then, add it to your crontab to run once a day (run crontab -e), and it will send you a daily email telling you how much traffic quota you have remaining for the month.

In your crontab script, put the (single line) entry:

0 0 * * * /path/to/netusage.py >/dev/null 2>&1

Caveats

Depending on the byte count meter on your chosen interface (see 'ifconfig'), the reports will be inaccurate up until the start of your next billing cycle. If you want to fix this, follow these steps:
Also, before you reboot or power down your gateway box, run the script manually. This will keep the tally accurate.

Download

Download netusage.py here

Privacy Policy