Monitoring a BT Voyager 2110

Recently out broadband usage seems to have gone up quite significantly. This, naturally, has been blamed on me. And the Mac. As Min put it “this only became an issue since the mac came into the house!”.

Now you can log into the web interface of the Voyager and get the bytes since it connected. You can also reset some network traffic counters in Status -> Traffic Stats, but none of these really give you a feel for whats happening over time. Enter MRTG. I’ve been using MRTG to monitor traffic on interfaces since college and it’s very good at it. By default it will communicate with a device by SNMP, however the Voyager does not appear to have an SNMP daemon.

Thankfully MRTG can also execute a command to get its data.

You can log into the Voyager using ssh with the admin user and your admin password. This gets you to a very basic shell but one thing you can run is ifconfig which will report on the network interfaces in the box including their TX and TX byte counts.

There doesnt appear to be an easy way to set up public key authentication with the voyager so I fell back on some old school tricks for automating logins – perl & expect.

This expect script will log into the Voyager and get your ifconfig output:

#!/usr/bin/expect -f
spawn ssh [email protected]
expect "password:"
sleep 1
send "YOUR-PASSWORD\n"
expect "> "
sleep 1
send "ifconfig\n"
expect "> "
send "logout\n"

Next we need to grab the counters from there in a way that MRTG will understand. That is the recieved count on the first line, the transmitted count on the second, uptime is the third and the name is the fourth (mrtg docs). I just use the first and second. ppp_8_35_1 is the interface I need on my router, yours may be different. This perl script calls the expect script above to get the data.

#!/usr/bin/perl

my $flag=0;

@op=<code>/rusr/local/bin/bt.expect</code>;

foreach $_ (@op) {
    if ($_ =~ /ppp_8_35_1/ ){
        $flag=1;
        next;
    }

    if ($flag == 1 &amp;&amp; $_ =~ /RX bytes:(\d+).*TX bytes:(\d+)/){
        print $1."\n";
        print $2."\n";
        print "0\n";
        print "0\n";
        last;
    }
}

Next we need a configuration file for MRTG. Mine is below. The various options are explained in the mrtg docs

EnableIPv6: no
WorkDir: /var/www/mrtg

Interval: 5

Title[ppp]: Network traffic (ppp)
PageTop[ppp]:
<h1>Network traffic (ppp)</h1>
Target[ppp]: <code>/usr/local/bin/gettraffic.pl</code>
Unscaled[ppp]: n
WithPeak[ppp]: ymw

It’s the just a matter of setting up a cron job for MRTG to get the data every 5 minutes:

0,5,10,15,20,25,30,35,40,45,50,55 * * * * /usr/bin/mrtg /usr/local/etc/bt.cfg > /dev/null 2>&amp;1

Over the course of a few hours you’ll see the patterns in your usage:
mrtg graph

2 thoughts on “Monitoring a BT Voyager 2110”

  1. Hi, Interesting information. A little complicated for me. The information I’m looking for is a total daily usage for those pieces of hardware that access the BT Voyager i.e.PC, Tablet and mobile ‘phone. Any suggestions ??

  2. Hi,
    Can’t offer much help I’m afraid as I’m no longer using that device. Rather than trying to write something for the Voyager it might be easiest to just buy a DSL router that offers that kind of statistics. I don’t know offhand of any that offer that but If you have a look through the products from reputable companies (e.g. D-Link) you might be able to find something.
    ~Al

Leave a Reply

Your email address will not be published. Required fields are marked *