Results 16 to 22 of 22

Thread: How-To MRTG bandwidth monitoring utility

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2007
    Location
    The Netherlands - Eindhoven
    Posts
    1,767

    How-To MRTG bandwidth monitoring utility

    Do you want to measure what's going in and what's going out your router? I always did, and after some searching I found a tool to do this and plot it in a graph


    I found MRTG which is the predecessor of RRDtool, used by the largest internet exchange in the world: Amsterdam Internet Exchange
    Now, RRDtool is nice, but it will be too advanced for what we want to do, so in this how-to we'll stick to MRTG which does the job just as well
    The good thing about this monitor is that it only polls once every 5 minutes, so it uses hardly any CPU and will allow the harddrive to spin down now and then.


    Before you begin
    You need a proper IPKG setup (e.g. from wengi's how-to).
    Also you need to activate the SNMP server in the webadmin interface:

    Set it up like in this screenshot
    Furthermore, you need some way to access the generated graphs, this can be done via a samba share or a webserver.


    Installing
    It's as easy as executing:
    ipkg install mrtg
    Creating config files
    The IPKG package doesn't come with configuration files since they're different for every system!
    Before you can generate a config file you NEED to make sure the SNMP server is up and running.
    Adjust the workdir to your needs, this workdir should be accessible via samba or a webserver. Also don't forget to create the folder before you assign it.
    /opt/bin/cfgmaker --global 'WorkDir: /tmp/mnt/share/mrtg' --global 'RunAsDaemon: Yes' --global 'Options[_]: bits,growright' --output /opt/etc/mrtg.cfg public@localhost
    now wait a few seconds while the configuration is being made.

    Making a startupscript
    vi /opt/etc/init.d/S99mrtg
    and paste the code:
    #!/bin/sh
    if [ -n "`pidof mrtg`" ]; then
    killall mrtg 2>/dev/null
    fi
    /opt/bin/mrtg /opt/etc/mrtg.cfg
    save it and make it executable:
    chmod +x /opt/etc/init.d/S99mrtg

    Starting and monitoring
    Just execute
    /opt/etc/init.d/S99mrtg
    and it should start monitoring.
    Now just browse to the folder you put as workdir (either via samba or webserver).
    You'll see a few html pages called "localhost_x.html" (where x is a number).
    Just open up one of those files and the browser should open a page about a single network interface containing daily, weekly, monthly and yearly graphs.
    Usually "eth1" is the WAN port (where the internet goes in) so there you can see all the results for internet usage.

    Note that the speeds are displayed in bits per second meaning you have to devide the numbers by 8 to get the bytes per second.

    the end
    I hope you'll have fun monitoring.


    some extra: http://wl500g.info/showpost.php?p=205121&postcount=18
    kolaCZek made a nice post about some other scripts to monitor cpu load, memory usage and ping
    Just put the mrtg settings in the mrtg.cfg config file and the bash scripts in /opt/etc/mrtg (like described in the target information)
    don't forget to chmod +x /some/file the bash scripts to make them executable
    Last edited by wpte; 30-07-2010 at 02:15.

Similar Threads

  1. Bandwidth Management, static leases not working
    By AugustsZ in forum WL-500w Q&A
    Replies: 1
    Last Post: 12-01-2011, 04:26
  2. Bandwidth management
    By smarttowers in forum WL-500gP Q&A
    Replies: 0
    Last Post: 07-12-2008, 08:13

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •