Measuring your internet speed, latency, and jitter from your PC to the internetMeasuring your internet speed, latency, and jitter from your PC to the internet

If you’re interested in measuring your internet speed, latency, and jitter from your PC to the internet through your ISP every 15 minutes for a week, we can guide you through the process. To do this, we will use Speedtest CLI software installed on a Linux Ubuntu workstation directly connected to the internet, with no Wi-Fi in the testing.

We compare the results from Rogers and Bell Canada by running the same tests on both internet service providers. This helps us determine which ISP provides better internet performance based on your provider.

 

Install SpeedTest package

This is a download page where you can find instructions for each version.
Speedtest CLI: Internet speed test for the command line
We will be using Ubuntu/Debian.
Run the following lines to install speedtest.

sudo apt-get install curl
curl -s https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.deb.sh | sudo bash
sudo apt-get install speedtest

During the installation process, you may encounter this error message.
E: Unable to locate package speedtest

To fix that error open the specified file and replace the word “mantic” with “jammy”. I am uncertain about the status of their package

sudo nano /etc/apt/sources.list.d/ookla_speedtest-cli.list

Original file

deb [signed-by=/etc/apt/keyrings/ookla_speedtest-cli-archive-keyring.gpg] https://packagecloud.io/ookla/speedtest-cli/ubuntu/ mantic main
deb-src [signed-by=/etc/apt/keyrings/ookla_speedtest-cli-archive-keyring.gpg] https://packagecloud.io/ookla/speedtest-cli/ubuntu/ mantic main
Changed File
deb [signed-by=/etc/apt/keyrings/ookla_speedtest-cli-archive-keyring.gpg] https://packagecloud.io/ookla/speedtest-cli/ubuntu/ jammy main
deb-src [signed-by=/etc/apt/keyrings/ookla_speedtest-cli-archive-keyring.gpg] https://packagecloud.io/ookla/speedtest-cli/ubuntu/ jammy main
To update the system, please run the following two commands.
sudo apt update
sudo apt upgrade
Rerun the installation
sudo apt-get install speedtest
Check installed Version
speedtest --version
Run this command for the initial test. 
speedtest --accept-license

Create a bash script which will be scheduled to run every 15 min, do test and log test results in a CSV file.

Create the following script in $HOME (/home/dan) folder
The second line in the script will create CSV file and insert headers in a file only the first time the script is run if they can not find the speedtest.csv file.
The fourth line will run a test every time we execute the script
Change the folder name from dan to the name of your home folder. We can not use $HOME for the folder name in this step because the script is executed under the root account

sudo nano /home/dan/sp.sh
#!/bin/sh
if [ ! -f /home/dan//speedtest.csv ]; then
speedtest -f csv --output-header > >(tee -a >(sed "s/^/$(date '+%Y-%m-%d %H:%M:%S'), /" >> "/home/dan/speedtest.csv"))
fi
speedtest --accept-license -f csv &> >(tee -a >(sed "s/^/$(date '+%Y-%m-%d %H:%M:%S'), /" >> "/home/dan/speedtest.csv"))
Run this command to make the File Executable 
sudo \chmod +x /home/dan/sp.sh
Run the following command a few times to check if the CSV file is being populated.
sudo bash /home/dan/sp.sh
nano /home/dan/speedtest.csv

Schedule to run the script every 15 minutes.

We will use a cron job to schedule how often the scripts run.

Open crontab configuration file 
sudo nano /etc/crontab
Add the following command to the end of the file. 
*/15 * * * * root bash /home/dan/sp.sh
We need to run the following command to reload the cron configuration: 
sudo service cron reload

Check if the test downloaded data to the file.
nano /home/dan/speedtest.csv

This was the end of part 1. We will compile the collected data in Part 2 
http://2tech.ca/compare-bell-and-rogers-speed-latency-and-jitter/

By Dan Djurasovic

Dan is an Azure Technical Advisor, with over a dozen years of IT experience, specializing in Microsoft Office 365, Exchange Server Azure IaaS and Active Directory..

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.