My flat has a shared internet connection, and we have a bandwidth cap, If we go over our cap it costs us all extra money.

There's this great little script wrtbwmon for DD-WRT that shows total bandwidth usage. There are other projects that do a nicer job but they require different router firmware, that doesn't support my router.

The main imitation of Wrtbwmon is that it doesn't show how usage is changing over time. If someone suddenly uses lots of our bandwidth cap I need to be able to tell them when it was. My solution to this is to dump the output from Wrtbwmon into a log. It'll be clumsy to work with, but hopefully I wont need to often.

Using a similar approach I could create graphs of the per user bandwidth usage using a javascript graphing library, but for now this will do.

Heres my script which I have running from a cron job on the router.


$WRTBWMON update $DB peak
$WRTBWMON publish $DB $PUB
date > $SEND
arp >> $SEND
cat $DB >> $SEND
echo -e "\n" >> $SEND

cat $SEND | ssh me@logging-server "cat >> wrtbwmon/log"