I have a need for internet speed.....

vaughan mason - 2021-05-29

Anyone who has a fast internet connectivity at home, checks whether they are getting what they paid for. So obviously, I have been doing the same. With most things in life, automation, the more frequently and the smallest detail you meaure, the more accurate your decision making process will be. So I want to see if I could autmate the process of collecting these stats. Will not be covering how to show them visually besides stored in a log file.

Speedtest

So I’m not going to going to try of rebuilding something that is readily available. speedtest.net, has a great website for you to track you upload and download speeds. Depending on your ISP, they will usually accept these results with the slight exception that you have to remove all devices off the network (You can refer to my other post on networking, I would provide a link but have not gotten that fully working yet). Great thing about Speedtest, is that they now offer a CLI (Command Line Interface).

Time to install:

Installing CLI

Depending on your OS, you can follow the information here.

I did the following:

1
2
curl -s https://install.speedtest.net/app/cli/install.deb.sh | sudo bash
sudo apt-get install speedtest

Then to check your speed your just type

1
speedtest

Results

1
2
3
4
5
6
7
8
   Speedtest by Ookla

     Server: xxxxxxxx
        ISP: xxxxxxxx
    Latency:     1.40 ms   (0.07 ms jitter)
   Download:   252.52 Mbps (data used: 123.3 MB)
     Upload:    88.74 Mbps (data used: 44.6 MB)
Packet Loss:     0.0%

But now we need to automate this process….

Automation is king

So as I am using a RaspberryPi (read Linux), I will be using a shell file and crontab to automate this process.

Few things that I learned:

So I created a sh file, scheduled it with crontab and we are away.

Here is the basic script for the sh file update the user details

1
2
3
4
5
6
#!/bin/bash
pushDate=$(date +'%Y%m%d')
FILE=/home/<user>/speedtest/logs/${pushDate}.log
date >>$FILE

speedtest --accept-license >>$FILE

Why is this important

This page was last updated at 2021-05-29

If you don't agree with the content on this page, please click here