I recently upgraded my Buffalo WHR-HP-G54 to an ASUS RT-N16 as I needed gigabit ethernet; and usb ports + wifi N are all welcoming upgrades to the aging buffalo. As an inevitability, I installed TomatoUSB and plugged in a 4GB USB stick. Now, TomatoUSB itself is a very good system with loads of features but you can extend even more by adding Optware. I will not go into the installation as there already is a very good guide to follow.
Once you have the USB stick mounted and Optware up and running, you can do lots of nifty things. For example, I installed zsh, screen, vim and a whole bunch of other essential stuff. A few examples can be found here.
One particular interest I had when found out about optware was the extension of tomato’s visual bandwidth log graphs. I said extension because the original one comes with tomato has a max 24 hour window. However, occasionally I want to see what happened in the previous week or even month. So first, I thought of rrdtool and rrdgraph. Now rrdtool is a good database for this purpose, however rrdgraph proved to be too resource intensive for the little cpu.
So I searched around and found dygraphs. This is a perfect solution as all you need is to feed the data in csv format and the graphing would be done on the client’s browser. Have a look at my example here (1 week window), you can click&drag the cursor to zoom in and double click to zoom out.
Cool? If you’re interested, let’s start. Assuming you already have a persistent storage (jffs,usb/sd card, etc.) setup at /opt, first, ssh to your router, then:
That will install rrdtool, perl and download my rrdtool collector script, put it in the crontab to be executed every 1 minute. Now, create a directory somewhere in your /opt to store the necessary files, mine is at /opt/share/www/cgi-bin.
You should also append the these into /opt/.autorun. This will tell tomato to run these command right after mounting my usb stick.
What just happened is we got the files we need, save them somewhere that will not disappear as the router restart, link them to the router’s cgi-bin directory. Now, assuming the router’s ip is 192.168.0.1, you can test everything by going to: http://192.168.0.1/ext/cgi-bin/bandwidth.cgi there you should already see a few data points collected by rrdtool.sh earlier. Download some big files, leave it running for a while (the page will auto refresh every minute) and you should see more pretty data come up :)