Using RapidSpike Connect Anything to Check Internet Connection Speeds

RapidSpike Connect Anything (RCA) is a really cool addition to our line-up of monitors that allows our customers to literally “Connect Anything” they would like to our service and utilize the power of our custom alert notifications.

In this blog post, I am going to talk you through a fictitious usage scenario for RCA where we use a Raspberry Pi to report the state of the Internet connection in one of our remote offices. Although we use a Raspberry PI for this example scenario, there is nothing stopping you running this script on any Linux compatible device. Although the scenario is fictitious, we really do have this script running in multiple locations – and it works fantastically well!

This is not an overview of installing and running Linux CLI tools or an tutorial on programming in Python so some prior experience is required. The great thing about RCA is that there are a lot of ways to achieve this functionality and you are free to use whatever method you wish.

Example Overview

One of our remote offices has intermittent Internet access and it suffers frequent drops. The site is remote and can only be serviced by very low-speed ADSL.

The staff in the remote office have mentioned that they think the Internet bandwidth reduces considerably before a drop occurs and normally when the drop does occur, rebooting the router appears to bring things back to life.

We wanted to write a script which monitored the Internet Upload and Download speeds that the office is receiving as well as telling us when the office is no longer online.

Using a RapidSpike Pro Plan we were able to configure an RCA Monitor with a 5-minute push interval to check the connection data for the remote site.

RCA Monitor Solution

We identified a great Linux CLI tool called speedtest-cli which is part of the bandwidth checking site. Once installed, running this tool from the command line returns the Ping speed along with Upload and Download connection speeds.

This tool also supports a simple mode where the output is suppressed to just headers and the values that you require. The command line we used was:

speedtest-cli --simple

It returns the following output:

Ping: 98.959 ms
Download: 23.15 Mbit/s
Upload: 18.12 Mbit/s

Fabulous, we have the figures, now we just need to write a script to get these into a URL that we can send to the RapidSpike RCA Monitor at timed intervals. We will now look at the steps necessary to achieve this.

Step 1 – Create the RCA Monitor

The first step is to create the RCA monitor. We need the Unique ID and the Keys for our script to pass the values in the correct format as expected by the RCA Monitor.

Let’s create an RCA Monitor called Internet Connection Monitor with keys for Ping, Upload, and Download.

RCA Internet Speed

Step 2 – Write the Python Script

Once the RCA Monitor configured, it is listening for the keys to be sent using the Unique ID that you are provided when setting up the RCA Monitor. We now need to write a script to run the speedtest-cli tool.

The Python script below runs the command and takes the output, removing the leading and trailing text to store the values for ping, download, and upload before sending these as a HTTP GET to the RCA service.

We set this script to run every 5 minutes with a CRON job so that the stats are sent to the RCA service at frequent intervals.

Step 3 – Set up Alerting

The RCA is configured and the script is working sending data to the RCA service. Checking the User Interface, we were able to see the data hitting the service and being shown in both the table and graph view.

The next thing to do is to configure some Alerts to notify us when there is a problem. We will create two alerts:

The first is to alert when the remote site Internet connection fails. In order to achieve this, we have created a rule that notifies us if it has not received any data to the RCA monitor for 15 minutes.

RCA Failure Rule


We also want to be notified if the remote site download speed falls below 5 Mbps. We have created the following alert rule to trigger if this happens:

Low Bandwidth Rule

These two rules, once configured will allow us to receive the notifications that we require for this project.

We hope you have found this blog post of interest and from it we hope you can see the value and diversity of setting up a RapidSpike Connect Anything Monitor.

Be sure to check out the RCA Knowledgebase for some deeper technical insights into this service.