Code Monkey home page Code Monkey logo

wrtbwmon's Introduction

wrtbwmon

Modified from https://code.google.com/p/wrtbwmon/.

New features

  • "User" column has mouseover text containing MAC and IP addresses
  • "First seen" and "Total" columns in usage table
  • Monitoring of locally generated traffic on a per-interface basis
  • remove function to delete iptables rules

What does it do?

wrtbwmon was designed to track bandwidth consumption on home routers. It accomplishes this with iptables rules, which means you don't need to run an extra process just to track bandwidth. wrtbwmon conveniently tracks bandwidth consumption on a per-IP address basis, so you can easily determine which user/device is the culprit.

Here is an example usage table: image

How do I use it?

  • Install: Download and install ipk from the releases page
  • Setup: wrtbwmon.sh setup
  • Update table: wrtbwmon.sh update /tmp/usage.db (you can place the data table anywhere)
  • Create html page: wrtbwmon.sh publish /tmp/usage.db /tmp/usage.htm

Installation options

  • Install ipk
    • e.g.,:
      • cd /tmp
      • HTTPS: curl -LO https://github.com/pyrovski/wrtbwmon/releases/download/0.3/wrtbwmon_0.3_all.ipk
      • HTTP: you're on your own :( Busybox wget usually doesn't have SSL support.
      • OpenWrt: opkg install /tmp/wrtbwmon_0.3_all.ipk
  • Or, if you don't want to use an ipk:
    • cd /tmp
    • HTTPS: curl -L https://github.com/pyrovski/wrtbwmon/archive/0.3.tar.gz | tar xvz
    • cd wrtbwmon-0.3
    • ./install.sh wrtbwmon.sh readDB.awk usage.htm1 usage.htm2 wrtbwmon
      • Currently, this depends on the install program. OpenWrt chose to provide this as the "coreutils-install" package.
  • Or, if you have make, just make install as root after cloning/unpacking.

Configuring the published table

  • wrtbwmon.sh checks a few files for MAC -> name maps:
    • 4th argument to wrtbwmon.sh publish <DB> <userDB>
    • /tmp/dhcp.leases
    • /tmp/dnsmasq.conf
    • /etc/dnsmasq.conf
    • /etc/hosts
  • If all of the above do not yield a match, the script will optionally perform a reverse DNS lookup directed at the DNS server specified in the DNS variable. If DNS is blank or unset, the script will not perform such lookups.

Regular updates

  • Add the following to root's crontab:

      # adapt PATH to your needs
      PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
    
      * * * * * <script location> update /tmp/usage.db
      0 * * * * <script location> publish /tmp/usage.db /tmp/usage.htm
    
  • Enable web serving of the generated page (optional)

    • This varies by environment, but for lighttpd:
      • ln -s /tmp/usage.htm /var/www/html/

Remove iptables rules

  • wrtbwmon.sh remove

wrtbwmon's People

Contributors

pyrovski avatar valentt avatar patrikolausson avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.