Measuring your bandwidth

Lately trying to measure what is going on with the bandwidth of the house, at first installed dd-wrt. And it kind of work, but I wanted some statistics to get what’s been consumed during the month, and who was the one which have been using more bandwidth, and things like that; so I found a project bw_monitor.sh and it works really fine.

Basically you have to download the bw_monitor.sh shell script, create a start configuration file, and download the template; the scripts run some monitoring and basically generates a user_script.js file which is used to display the information in and web page which you can check on your access point. The steps are as follow:

  1. Enable the jffs option on your dd-wrt box. It will create a mount point under the /jffs name
  2. Install bc; use the package manager which dd-wrt has
  3. Then download the bw_monitor.sh script from the project page, used a directory named /jffs/www and I placed the files there: bw_monitor.sh and monitor.html (Anyway I will upload a zip file with the files I have used)
  4. Place the init script under /jffs/etc/config/bw_monitor.startup, this is the mine:
    #!/bin/sh
    MONITOR_LOCK_FILE=/tmp/monitor-started.lock
    MONITOR_STOP_FILE=/tmp/monitor-stop
    MONITOR_STOPPED_FILE=/tmp/monitor-stopped
    ln -sf /jffs/www /www/user
    while [ ! -f $MONITOR_LOCK_FILE ] && [ ! -f $MONITOR_STOP_FILE ]; do
    /jffs/www/bw_monitor.sh 30 3 30 7 /jffs/www/users.file /jffs/monitor/usage.backup /jffs/monitor/history/ /jffs/monitor/usage.db /jffs/www/ 1 1 1 1 1 0 1
    #/jffs/www/monitor.log
    if [ ! -f $MONITOR_LOCK_FILE ]; then
    sleep 10
    fi
    done

And below is a screenshot with the results, enjoy 🙂

ss-bw_monitor.sh