Archive for January, 2012

How to monitor broadband uptime

January 10, 2012

After moving to a house a few years back we ended up in a situation where ADSL was the only option (aside of mobile broadband, which is not really a realistic option if you plan to do a fair amount of computer work from home) available to us. However, the nearest phone station turned out to be close to 4 kilometers away, which according to the broadband provider is a lot, maybe even approaching the distance where ADSL is usable.

Except that they failed to mention this when we informed them about the move from hyper-connected downtown to the suburb we now live in…

After well over a year of poor broadband speeds I got them (the ISP in question is Glocalnet, subsidiary of Telenor, btw) to acknowledge the problem, and even give us a refund for the months we’ve been paying for a 24 Mbit service, even though actual speed never gets above 5 Mbit.

Fast forwarding a couple of years, we’ve been paying less per month than before, but the quality of the ADSL connection is still poor, with the connection yoyo-ing several times per day. A couple of weeks back I finally had it and told them to fix the problem or stop charging us for a service they can’t deliver. A few days later an SMS arrived stating “your technical problem has been resolved” .

So, to the point of this blog post. How can I monitor they have actually fixed the problem and now provide a stable broadband service to us?

I ended up using a two-tiered approach:

1. External monitoring service
Using a free, third party server monitoring service to ensure there is connectivity from Internet to my home network. As the broadband outages we had experienced were typically quite short (on the order of a few minutes each), I needed a service that would ping a suitable computer in my home network at frequent intervals. Turns out there are many good free monitoring services (moni.tor.us etc), but they all (?) offer 20 or 30 minutes as shortest ping interval.

I finally found Pingdom, which offer you a free account from which you can monitor ONE server, with a shortest ping interval of 1 minute. Perfect. Their web site is slick and no-nonsense, they even have a very efficient and easy-to-use iPhone app. Great.

Only caveat is that you need an always-on computer at home, in order for Pingdom to have something to check connectivity to. Assuming that’s in place, you get stats like the following:

2. Ping from internal network to Internet
In order to minimize the number of false positives I decided to also check connectivity from the home network to a suitable site on the Internet. Once again, this assumes there is an always-turned-on computer in your home network. I use a Linux virtual machine that is always running anyway, looking after various other stuff.

A small script pings http://www.google.com once every minute and outputs the result into a text file. If Pingdom indicate a broadband connectivity outage, I can then go into the text file to verify that this was really the case (ruling out problems with Pingdom’s servers/service). The script looks like the following, paths might need some editing in other environments.

echo —————————– >> /home/goran/pinglog_google.txt
date >> /home/goran/pinglog_google.txt
ping -D -c 2 http://www.google.com >> /home/goran/pinglog_google.txt

Add to this a crontab (run crontab -e) entry for running the above once every minute:

# ping Google once every minute to make sure broadband connection is up
*/1 * * * * /home/goran/ping_google.sh

…and that’s about it. Keeping fingers crossed I won’t have to use this data against the ISP – nonetheless good to have it, just in case.

Advertisements