copyright 1998-2018 by Mark Verboom
ipv6 ready RSS Feed Schakel naar Nederlands

Go back to What's new

TP-Link ADSL modem in Cacti

To blog index

Thursday, 14 June, 2012

TP-Link ADSL modem in Cacti

After having problems with my Zyxel ADSL modem (couldn't get it into 100% bridge mode), I decided to buy a ADSL modem from TP-Link, a TD-8816.

I choose this modem because it was really simple, has bridging and it is CHEAP. You can buy them new from a shop for around EUR 14,00.

The nice thing about the modem is that it has a pretty OK webinterface, but it also has a CLI! You can just telnet into it and run commands :). So after playing around for a bit and some digging on the internet I deceded to build a statistics gathering script to get some stats of the modem into cacti.

The basic idea behind the scripts is that it telnets into the modem, quickly runs a couple of commands and stores the output in a file. After the info has been retrieved the info is split into 3 files with information on:

  • Line information
  • System information
  • Interface information
To use the script you need to change 3 parameters at the top of the script:

  • MODEM this should point to the hostname or the IP adres of the ADSL modem
  • SYSTEMPROMPT basically this is the prompt you get when logging in on the cli. As you can customize this in the modem the script needs to know what it is.
  • PASSWORD well... basically this is the password of the modem :)
You can download my attempt at the script below:

tp-link.sh

The script uses 1 parameter which can be:

  • collect - This fetches information from the modem
  • interfaces - Show network interface statistics
  • line - Show ATM line statistics
  • system - Show system statistics
For the cacti configuration below you have to put the script in /usr/local/bin (or modify the cacti configuration). It should run periodically from cron. Best is every 5 minutes, something like:

*/5 * * * * /usr/local/bin/tp-link.sh collect

The collect parameter tells the script to get information from the modem.

Now for the cacti part. I exported the configuration to xml. It is downloadable from the link below and should put all the required parts in your cacti configuration:

tp-link-8816.xml

So what statistics can you get from the modem running this script with cacti? I've put some examples below from my TP-Link (which is called slave btw, named from the popular Blakes-7 TV series).

Below the graphs are grouped per script output.

Interfaces

I have 2 interfaces in use on the modem:

  • enet0 - The ethernet interface
  • mpoa00 - The ADSL (ATM) interface
For each interface there are 2 graphs. This first one shows the errors on the interface. Each interface shows:

  • discards (in and out of the interface)
  • drops (packets dropped)
  • errors
The graphs look like:

The second interface shows the traffic going in and out of the interface. To make the graphs clearer I decided to make the incoming traffic on the interface negative. The legend below the graph also shows the total amount of data transferred in the period the graph is displaying.

Line

The line section has statistics on the ADSL (ATM) line. This has some useful information if you are trouble shooting instability or speed problems.

The first graph shows the amount of error correction that was done at the near end (modem) and the far end (DSLAM).

The second graph is the signal to noise ratio, both for the upstream and the downstream.

Next is the attenuation or transmitting power, both upstream and downstream is graphed.

Then there is the line speed graph. Both established up- and downstream speeds are graphed. Based on the line quality the maximum attainable up- and downstream speeds are graphed. As you can see my line has more bandwidth available then my provider allows me to use ;)

Next are two graphs for the bins and how many bits are encoded in each bin. This is getting quite technical, but basically the whole frequency spectrum of your ADSL line is divided in bins. The lower end has a set of bins for the upstream, rest above the upstream has the downstream bins. Depending on the line quality each bin can encode a number of bits. Normally you will see the amount of bits that can be encoded get lower when the bin number goes up (higher frequency, more errors/less quality). As there are quite a lot of downstream bins, I did these in groups of 16 bins. So each color has 16 bins.

The last graph on the line is the uptime. This is different then the system uptime, and can be quite handy to determine if there was a line reset or a modem reset.

System

System has 3 graphs.

The first one is the CPU usage, which basically shows how busy your modem is.

Next is the free system heap size, which give a bit of info on the memory usage in the system.

The last one is the system uptime. Useful in combination with the line uptime graph.

So for such a cheap modem it has some very nice features and gives out a lot of information on what it is actually doing.