When I upgraded my internet tariff, I was excited about how much the bandwith will effectively increase.
As a first attempt for getting some insights I used one of the various online speed tests. This worked pretty well - but the downside is that you actively need to trigger the speed test to get the data for the specific point in time.
To get a better picture of the bandwith situation, my goal was to establish a scheduled speed test which runs once per hour. The result is a speed test solution running as a Docker container on my Synology DS218+ NAS. In this blog post I would like to explain how the setup works.
Prerequisites
The following explanations assume that you are familiar with Docker in general and that you know how to run Docker containers on a Synology NAS. If the latter is not the case, you could have a look at my blog post Using Docker on Synology NAS.
The general use of the Docker image to run a speed test does of course not depend on a Synology NAS. That’s why it can be used on any platform. Nevertheless, this blog post will cover the topic with focus on the Synology NAS.
Download The Docker Image
Searching for speed test Docker images I stumbled accross the roest/docker-speedtest-analyser image which is publicly available on Docker Hub. I tried it and came to the conclusion that it perfectly matches my requirements.
The features included are:
- Scheduling is already configured to run hourly, but the schedule can be overridden.
- The results are provided as interactive diagram delivered by the built-in webserver.
- It is possible to persist the results in a file based format.
Under the hood, the Docker image uses the speedtest-cli tool written in Python which connects to speedtest.net. Thanks to Tobias Rös for providing this convenient speed test Docker image.
To download the Docker image please open the Docker application in the Synology user interface. Make sure that Docker Hub is the active Docker registry.
Search for the Docker image, e.g. by entering docker-speedtest-analyser
as search term, select the proper Docker image and download it by clicking the button.
A dialog will ask for the tag to download.
I recommend choosing a specific version instead of latest
.
At the time I wrote the blog post, the most recent version was 1.2
.
Create The Docker Container
To create a new Docker container from the previously downloaded Docker image, please switch to the image section.
Select the Docker image and click the Launch
button.
A dialog will open in which you can modify the name of the Docker container.
You could proceed with the Next
button, but I recommend doing some additional settings by clicking on the Advanced Settings
button.
The first useful setting is to enable the auto-restart of the Docker container. If this is enabled, the Docker container will automatically start with the NAS.
To keep the speed test results persistent and accessible, you should configure a volume and map it to /var/www/html/data
.
As described in another blog post, I use a network share for all Docker related things like configuration backups and volumes.
This way you can easily access the volume data.
Additionally, I configured a specific external port for the webserver running in the Docker container.
If you would not set a specific port, a free port is assigned. This would be a bit cumbersome, if you want to access the speed test result website.
Once all settings are done, we can go back and proceed.
An overview of the settings will be shown.
Once the Apply
button is clicked, the container will start.
Accessing The Results
To access the results, we can use the browser and navigate to http://<nas-ip-or-domain>:<speedtest-port>
.
Please make sure to replace the values accordingly.
- The
<nas-ip-or-domain>
is the IP address or the domain you use to access your NAS. - The
<speedtest-port>
is the port you configured for the Docker container in one of the previous steps.
Please note that it could take some time until first results show up. By default, the speed test runs every full hour.
If you would like to access the plain data, you can have a look at the folder you mapped as volume. It will contain a CSV file with the raw speed test result data.
Optional Steps
There are several optional steps, which can help to further improve the setup. In my environment I did the following additions steps:
- Create a backup of the Docker configuration of the specfic Docker container.
- Create a separate domain or subdomain to access the speed test results.
- Create a reverse proxy entry to access the speed test results.
These steps are separate topics, which are not further explained here.
Conclusion
This blog post explained how a scheduled speed test can be set up using Docker on a Synology NAS. There are similar Docker images available, which solve the same purpose. So feel free to choose any Docker image which fits to your use case.
8 Comments
Olivier on October 09, 2020
Hey, Great post. It was really helpful but I only have access to the CVS. Can't get the graph interface to work. Using the local port 8092 and the NAS ip adress but it doesn't work at all. I am trying to figure out why my 10gbe network maxes out at around 50mb/s. Cat6 cable between the NAS and the Mac mini, both equipped with a 10gbe card. The CVS files gives me a transfer rate of around 150 read/write but in real life I get around 50. Tried many cables...No idea what's up with that. Any clues? Thanks. Great blog post again :)
Olivier on October 09, 2020
Ok. Got the graph working. Thanks. :) Still have the transfer speed issue tho. :(
Florian on April 09, 2021
Great tutorial, thank! Got it running for about a year or so until recently the test results are not written to the results.csv anymore. Any clue? Tried removing the whole container and re-installed it, including deletion of all the (old/previous) folders, no luck. Still getting access to the web interface, but no data is displayed...
Iw on April 27, 2021
Seems linked to a change in the speedtest: https://www.raspberrypi.org/forums/viewtopic.php?t=309024
Bill M on June 03, 2021
This is exactly the tool I've been looking for to run on my Synology in a remote location. I've followed the post above and I'm not seeing any csv files added to the docker directory or data showing up in the graph. Any more hints to get this running?
Wkstar on July 04, 2021
I could type the same as Bill M. I followed the info and can see the graph page. But it is blank Is there anything else we should know ?
Big joe on October 20, 2021
Installed and configured the container. No graph displayed, but a csv is generated on the shared folder. Tried playing with time ranges but no luck.
Bas on November 10, 2021
Hi ! Sounds really great; seems very nice too; however no results are displayed; only " invalid date"
Leave A Comment
I'd love to hear your opinion and experiences. Share your thoughts with a comment below! Please note that comments will appear after moderation.