Internet speed test with multiple ways to show results (using Ookla's Speedtest app)

Howdy folks, this is a simple macro I put together to get my Internet speeds and display them in a variety of ways using the Ookla Speedtest app that can be downloaded for free from the App Store. I have been using their services for several years and have always been please with them.

Initially I put this together because I was constantly fighting with my ISP due to their service slowing down and/or dropping out multiple times a week, causing me to lose business. So I decided to start tracking my Internet speeds on the hour, every hour over the course of several months to prove to them that their service was NOT what they were claiming it was. That's a story for another day though.

There are two macros, one named "Internet speed test (for export)", and the other "Internet speed test results (for export)". The speed test macro should be enabled any time you want to use it, but the results macro is designed to be disabled until the main macro runs, at which point it is enabled briefly, and then disabled again. This is further explained below and in the macros themselves.

The main macro launches the Speedtest app, begins the test, enables the results macro, and hides the Speedtest app.

The results macro is on a 5 second periodic trigger, designed to check to see if the test is done yet and cancel if not, then repeat 5 seconds later. Therefore, if it is enabled all the time you will obviously have it triggering every 5 seconds and probably getting an AppleScript error if Speedtest is not running since the AppleScript is not able to interface with it.

Once the test is done, the results are parsed and can be displayed and or saved in a variety of ways. Right now the macro is set to append them to a file on the desktop (which you would need to create and/or move where you want and update the file path in the macro), and also show them in a display window. Two other options are currently disabled, setting a Stream Deck button and sending a Pushover notification.

I have tried to include sufficient documentation in the two macros themselves to explain how they work, but if something is missing or otherwise unclear, please let me know and I will try and clarify and update the macros.

Internet speed test macros.kmmacros (45.4 KB)

Test macro:

Results macro:

Simply as an FYI…there is a command-line tool for running speed tests, called speedtest-cli

If you used it with Keyboard Maestro to run every hour and append its output to a text file (it supports JSON or CSV formatting by default) then you could collect this data automatically without needing an app that interrupts you, even if only briefly.

You can install it via brew or just download it directly from GitHub. If you install it via brew it will be at /opt/homebrew/bin/speedtest-cli on M1-based Macs or /usr/local/bin/speedtest-cli on Intel-based Macs.

This assumes that you want JSON formatted output on an M1-Mac

/opt/homebrew/bin/speedtest-cli --json >> "$HOME/Documents/SpeedTestResults.json"

or if you wanted CSV formatted output on an Intel Mac:

/usr/local/bin/speedtest-cli --csv >> "$HOME/Documents/SpeedTestResults.csv"

OTOH…

Screenshots might be more convincing to those who need to be convinced, since text files can obviously be edited to say whatever it is you want them to say.

Update!

If you use json you can have it generate a PNG on SpeedTest's servers, showing your results:

For example, I just ran this:

speedtest-cli --share --server 25598 --json

And this is the result:

{"client": {"rating": "0", "loggedin": "0", "isprating": "3.7", "ispdlavg": "0", "ip": "68.113.161.37", "isp": "Spectrum", "lon": "-73.4648", "ispulavg": "0", "country": "US", "lat": "44.6913"}, "bytes_sent": 39608320, "download": 401417101.44599605, "timestamp": "2021-09-11T23:39:47.388524Z", "share": "http://www.speedtest.net/result/12021177379.png", "bytes_received": 409373932, "ping": 38.895, "upload": 31499968.751477398, "server": {"latency": 38.895, "name": "Plattsburgh, NY", "url": "http://speedtest.primelink1.net:8080/speedtest/upload.php", "country": "United States", "lon": "-73.4529", "cc": "US", "host": "speedtest.primelink1.net:8080", "sponsor": "Primelink", "lat": "44.6995", "id": "25598", "d": 1.3100150929129688}}

Note the 'share' URL http://www.speedtest.net/result/12021177379.png which looks like this:

(Note! The --share option does not work with CSV. I don't know why, that's just what the 'help' documentation says.)

Collecting those 'share' images (both when it is working well, and when it is not) should be a useful way to demonstrate the problem.

Also note that I have added --server 25598 to my speedtest-cli command. That ensures that I am always testing my results against the same server.

You can find the ID numbers of local servers to you by using

speedtest-cli --list

which gives me this as an example output:

Retrieving speedtest.net configuration...
25598) Primelink (Plattsburgh, NY, United States) [1.31 km]
 4405) Green Mountain Access (Richmond, VT, United States) [49.29 km]
37607) CalmDownGeek (Beauharnois, QC, Canada) [76.59 km]
 7015) Convergia Networks Inc (Pointe-Claire, QC, Canada) [88.77 km]
43978) Otelco (Shoreham, VT, United States) [89.48 km]
16754) Bell Mobility (Montreal, QC, Canada) [90.47 km]
24707) TELUS Mobility (Montreal, QC, Canada) [90.47 km]
 8825) Rogers (Montreal, QC, Canada) [90.47 km]
32904) ELPC (Montreal, QC, Canada) [90.47 km]
33945) GEMSTELECOM (Montreal, QC, Canada) [90.47 km]

The numbers in the first column are the ID numbers.

2 Likes

Thank you! I was perusing this thread last week and figured I would post mine for those who wanted to go a different route.

For example I don't really know much about Home Brew, and maybe there's others who don't either and prefer something using an app that's available in the App Store.

That being said, I have that macro bookmarked for the future when I have time to mess around with Home Brew haha.

Hey Guys,

There may or may not be some useful information in this thread:

KM Macro Launching to the Front and Timing Out

Note – I have found the SpeedTest CLI Utility to be abysmally inaccurate.

-Chris

1 Like

I have not used it a lot, but I did see that, although it was giving me consistent results, it was not giving me accurate results, compared to the GUI app.

For example, the GUI app was showing my download speed near 900 Mbps, but the CLI tool showed more like 400.

Even the home page for the CLI tool seems to say "Don't bother reporting that this doesn't give you the same results as the GUI app, they measure things in a different way."

Which… is not great for two tools that share the same name.

@cdthomer - you'll have to see if what it provides you is at least consistent enough to show when there is a problem.

If you had a second Mac that could run the Keyboard Maestro macro to capture the GUI results without interrupting your work, that would seem to be ideal, but that may not be feasible.