This post is about my open source remote bandwidth usage stats logger project.
I’ve been wanting to log the internet bandwidth usage at my home for quite some time since I don’t really find the stats put out by my ISP to be completely accurate. But I have multiple devices at home that access the internet so it is not feasible to install a bandwidth monitor individually on all these devices as I’d still need to add up all logs and many of such devices don’t even have a way to install a monitoring software installed (e.g. my PS3, my TV, my media players, etc). So, I thought of monitoring the usage at my router. It is a smart one (Asus wl-500w) and I can install various linux software on it but then it requires a hard disk to run most of them which I don’t turn on all the time. Moreover, even if I could run the software directly from router flash, it doesn’t have enough space to store the logs (neither is it a good idea to keep writing to the flash often).
Hence I came up with the idea of a light weight remote bandwidth usage logger where in the router has to do the bare minimum possible (here, it just has to make a GET call to a webpage with current status of received and transmitted bytes, accomplished by a single line of wget command). The system is completely open source and is intelligent enough to keep track of things even if router reboots or the bytes count wraps around the 4 GB limit (because of 32 bit data structures used). The logging and parsing is all done on server side and provides various useful things.
Few of the features of the system:
Very lightweight in CPU/RAM resource usage on host as well as server
Outputs easy to browse html and graphs
User defined directory structure to decide the granularity that is wanted
yearly, monthly, daily stats and graphs
Provides quick access to extra stats like last time the host connected, last known host IP etc
Provides total download/upload numbers as well as detailed
Estimates uptime of remote host
Can use a DNS name or IP to avoid (or call out) spurious amounts of usage logged by a spurious IP
The code and all files can be found at github: Remote-Bandwidth-Stats
The screenshots of the web pages generated by the system can be seen below. Please let me know if you find any issues with the programs or would like to request any new features.