I have a need for internet speed.....
vaughan mason - 2021-05-29Anyone 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:
- Speedtest does not want you to automate
- Bit of a half truth, as they just need you to confirm that you are using this for personal use. Which I am.
- If you add the following argument, –accept-license, it works.
- As I am still learning Linux, the folder structures, file locations and privileges took me a few minutes (read hour) to master.
- Most of the time this goes to the root of the user that you logged in as.
- I went with the approach of a file per day, so make sure you append instead of over writting if you want to follow this approach (» over >).
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
- When developing apps in the cloud, you need to understand latency and network speed. If you go for a cheaper region, you need to be sure you meeting the technical specifications of your applications (think timeouts).
- Being cloud native means understanding what that cloud is built on. So that is why I am experimenting and continuing to learn in this environment.
This page was last updated at 2021-05-29
If you don't agree with the content on this page, please click here