Oct 072015

I’ve finally gotten around to working on my projects again after doing some exams.

I wanted to get some ADSL monitoring going so I could get some history on the state of my line, get sync rates etc.

The first thing I needed to do was get the modem stats via a script as Zabbix couldn’t login to the modem properly.
I did a quick python script that can be called from Zabbix to get the modem stats.

The script can be used to either get all the stats at once, or a stat can be specified and only the stat itself will be returned.
e.g. To get all stats
./getmodemstats.py admin admin

To get a single stat, in this case upstream bitrate
./getmodemstats.py admin admin --stat upstreamCurrRate

Onto the script itself, which is also available on GitHub

Copy the below code into a file, name it something like getmodemstats.py, and then run it like the examples above.
This may work for other TP-Link modems, I don’t have any to test with unfortunately

import telnetlib
import argparse

parser = argparse.ArgumentParser(description="Gets TP-Link TD-8840 Modem stats")
parser.add_argument('--stat',help="Stat to retrieve")
parser.add_argument('host',help="modem IP address")
parser.add_argument('user',help="modem username")
parser.add_argument('pw',help="modem password")

args = parser.parse_args()
stat = args.stat
host = args.host
user = args.user
pw = args.pw

tn = telnetlib.Telnet(host)


tn.write("adsl show info\n")
output = tn.read_until("cmd:SUCC")
if stat == None:
print output
for item in output.split("\n"):
if stat in item:
line = item.split("=")
print line[1]

Jul 242015

I’ve been searching for a while on how to centre the Nav bar in a bootstrap fluid container.
Finally after hours of Googling, I came across this CSS snippet –

.navbar-nav {
width: 100%;
text-align: center;
.navbar-nav > li {
float: none;
display: inline-block;

Source: http://codepen.io/davidcochran/pen/rcHae

Applying this to my Navbar allows me to centre it as per the source example.

<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container-fluid">
<div class="row">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="pull-left"><a class="navbar-brand" href="/"><img src="/img/navbar/logo.png" /></a></li>
<li><a class="navbar-brand" href="/blog">Blog</a></li>
<li><a class="navbar-brand" href="/archives">Archives</a></li>
<li><a class="navbar-brand" href="/contact">Contact Us</a></li>

This present me with a nicely centered navbar like this –

Nicely Centred Navigation with a logo on the left

Nicely Centred Navigation with a logo on the left

Jul 162015

I recently had a thought…I wonder if Zabbix can graph the fuel prices near me.
This thought was triggered by a news article I read about how the petrol station cycles have changed so that the cheapest fuel is on a Monday rather than a Wednesday like it used to be.
Continue reading »

Jul 092015

So after poking around with the bootloader, I decided to go look for the stock firmware to see if I could upload that with some modifications so I could play around with the stock system.

After a night of Googling, I couldn’t find any links to the original firmware. I tried to discover if I could download the firmware from the NAS, but that didn’t get me anywhere either. All the Googling did point me in the direction of SnakeOS however, which is replacement firmware for some NASes. However, it hadn’t been maintained in quite a few years so I was initially a bit hesitant.
Continue reading »

Jul 062015

I received my USB to TTL adapter today, so decided to have a look at the NAS and see if I could get root access to it.

The Serial console is actually under where the drive is, so I’ve gotten access to it from the bottom as there’s some plastic between where the drive goes and the port itself.

NAS Connected via Serial

NAS Connected via Serial

As you can see from the picture, I’ve stuck some jumper cords into the serial console port. The Yellow wire is actually the white wire on my USB->TTL converter, the green is still green, and black is still black. With the jumper leads plugged in, I turned the NAS On with screen listening on /dev/ttyUSB0 with a baud rate of 38400.
Continue reading »