[update 23/7/2004: TristanK has added to the script to remove the requirement for lynx. A thousand thanks.]
Bigpond Broadband* is a cable/adsl ISP in Australia. As with almost all Australian ISPs, they provide a limit on the number of megabytes that a user may download in a month. In order to help a user monitor their usage and avoid paying astonishingly high excess usage charges (currently $0.15 per Mb) Bigpond provide a service known as the ‘Usage Meter’. Although unreliable, the Usage Meter is the best available way for a Bigpond user to monitor their quota usage, as it takes into account the ‘unmetered’ traffic (to some Bigpond internal services). Client side monitoring will not reflect the numbers that go onto a user’s bill.
Recently Bigpond has released some client-side tools to allow a user to tell at a glance what their current metered usage is. These take the form of an Internet Explorer toolbar or a small applet in the system tray. Although not incredibly useful themselves they introduced something useful – a usage meter XML feed. With this we can create our own client, and that is what this article is about.
I have developed a way to use free tools to create graphs of your Bigpond usage over time, such as the sample image below, of a week’s usage:
What you will need:
- Perl – I use Activestate Activeperl. This is a free, quality-assured perl distribution. Perl is a scripting language.
- mrtg – the Multi Router Traffic Grapher. Originally a tool for monitoring network links, its usage has been expanded by the community to be a multi-purpose monitoring tool.
- FireDaemon or srvany – Both of these tools allow you to run programs as Windows services, FireDaemon is a commercial product with a free version, and srvany is part of the Windows 2000 Resource Kit (and also the NT4 Resource Kit – maybe 2003 as well?).
- Windows Script – although you probably already have this installed, you can get the latest version from here.
- This script – this is the script that I wrote (remove the “.txt“ when you save it).
- This CFG file snippet – add this to your current CFG file.
- A web server such as IIS or Apache (not required).
I will not go into installing ActivePerl and mrtg, this is covered extensively elsewhere. I am assuming that you are now at the point where you have mrtg running and have produced some graphs.
Add the CFG snippet to the end of your mrtg CFG file – making sure that you edit the line
Target[bpausage]: `cscript //nologo bpausage.vbs`
to reflect the full path of the script, if necessary. The next thing you will need to do is edit the script (bpausage.vbs). There are two (or five, if you use proxy authentication) things that you will need to change in the section marked “Edit Here“ your Bigpond username, and your Bigpond password (and your proxy URL, username and password. Because your username and password are stored in clear text, please do not place this file somewhere that Bad People can get to it. The actual internet connection it makes to the Usage Meter is via SSL so you are pretty safe there.
The current plan that I am on allows for 5GB of usage per month, so I have tweaked scale of the graph to be relevant to me, showing a scale from 0-6 GB. Yuo might be on a different plan, so here is how you make the graph relevant to yuo. It is these lines that affect the scale:
The YTics value is how many vertical sections are in the graph. The MaxBytes and AbsMax values should be set to the number of GB in your plan times 1000 (Bigpond count a gigabyte as 1000 megabytes).
The way that the whole thing works is this:
- when mrtg does its 5 minutely run, it starts the script bpausage.vbs
- the script connects to the Usage Meter and logs on as you
- the usage meter returns XML data about your usage
- the script processes the XML and outputs it in a format mrtg can understand
- mrtg processes the data and updates the relevant graphs
The output graph shows two values – the total usage (both downloads and uploads) in solid orange, and the upload usage as a blue line. Look at the sample above to get the idea. While you look, notice the little dips around Monday/Tuesday. These are evidence of the increasingly frequent cable outages in my area. If you are not like me and are only online from time-to-time, the graphs will give you an idea of how long you spend online.
I would like to thank this project for giving me a head start, as it does basically the same thing for a *nix environment.
I hope that this article is helpful to you. Feel free to comment below, and if you find an error or make an improvement then I would love to find out about it.
*Bigpond Broadband a.k.a. Bigpond Advanced, Bigpond Cable, BPA, BPC, BCP.