Monitoring my VoIP service status

My home Internet Service Provider gives me access to a phone landline via a VoIP service. Until recently I had no major complaints about this service and was actually starting to believe it to be as reliable as traditional copper wire phone services... well, that was then.

I noticed that from time to time, the phone service would go down and would fail to automatically reconnect once the downtime is over. The frustrating thing was that I had virtually no information about the downtime:

  • I only knew about it because I tried to make a call and wouldn't get any tone
  • I didn't know if someone tried to call me
  • I didn't know either how long it had been since the downtime started

First solution

In an attempt to gather more data about the problem and ultimately be able to determine my phone service availability, I decided to do what I do best... so I wrote a small monitoring application in Java. Knowing that my ISP was exposing a public API to programmatically interact with its triple-play router, the process was pretty straightforward.

The app queried my triple-play router for the VoIP service status and stored the result in a SQLite database. To get data 24/7, the app was hosted on a Raspberry Pi, directly plugged to the router. Cool, I was getting data... but exploiting them turned out to be quite painful: I would ssh to the Pi and query the SQLite database.

Scratch that... I needed something more user-friendly.

Here comes Jenkins!

To focus more on the visual feedback and not on the data gathering part, I ultimately decided to setup a Jenkins instance on my Raspberry Pi. Using the Groovy plugin, I created a job that would periodically poll the router API and fail whenever the phone service was down (source code right over here!).
Having written my monitoring app in Java, I was able to reuse its core part directly in Groovy.

This is the result:
Jenkins TV Monitoring view

Now I can easily check my phone status!

Lesson learned: while it is fun to start a new programming project from scratch, taking a few steps back to figure out what tools already available can solve the problem and at what cost is a more sane approach :)