Monitoring your Internet speed with Resin.io and DataDog

Occasionally, my home Internet speed slows to a crawl, and I was curious to get some more insight into whether there’s a pattern, and to have data to show my ISP if needed.

Some background on Resin.io, in case you’re not familiar. I’ve been using it lately for all my Raspberry Pi projects and am a huge fan. It’s a service that makes it incredibly painless to deploy apps to Raspberry Pi (and a bunch of other embedded devices). You don’t have to worry about configuring Linux, installing all the prerequisite libraries, getting your app to re-run on restart, etc. Just throw together a Docker container with your app, install ResinOS on your SD card, plug in the Pi, and deploy.

I wrote a NodeJS app that I deployed via Resin, which runs a speed test and uploads the results to DataDog on a predefined interval.

Prerequisites

  1. A Raspberry Pi :-).
  2. Set up accounts at Resin.io and DataDog.
  3. Get a DataDog API key here.
  4. Set up a Resin.io app using their quick start instructions.

Setup instructions

  1. In your Resin.io app, set the “DATADOG_API_KEY” environment variable to the key you obtained in step 3 of the prerequisites.
  2. Clone my bandwidth monitor repo:
  1. cd into this repo, add a remote for your Resin.io project, and push to it:
  1. Your app will deploy, your Raspberry Pi will download it from Resin, and very soon you’ll have data flowing into your DataDog dashboard for monitoring your Internet speeds. Knowledge is power!

IMPORTANT

The interval for running the speed test is governed by the “SPEED_TEST_INTERVAL_MIN” environment variable

BUT be careful:

I used node-inspector to do a little digging into the amount of bandwidth used up by the speed test itself, and it’s actually quite substantial.

Be careful about setting the interval to anything more frequent than 20 minutes, as that interval alone could use almost 50 GB of bandwidth per month (24.7 MB * (60/20) times per hour * 24 hrs per day * 28 days per month).

Updated:

Comments