auto-speedtest
auto-speedtest copied to clipboard
Automated speed test with log and graphical Output
auto-speedtest
My ISP has a FTTH network with coaxial cable running into appartments. In the middle of the day the download speed is so slow that I usually have about only 1% of the bandwith advertised in my agreement. I think they are stingy with adding more peering points... So I have decided to make speed tests every 5 minutes and log the results to have an overview (and make a lots of traffic 😈).
I hope you find it useful, too. Please copy, share, fix and send me feedback (I'm really bad at coding).
How to use
- First download Python and speedtest-cli (You can run "chmod +x installAuto-Speedtest.sh && ./installAuto-Speedtest.sh")
- Run
speedtest.sh
- Make a crontab entry with your desired time interval (for slower connections use greater time intervals)
- Write a frontend website with graphs and statistics and send me your source code ;-)
Crontab
- Edit your contab with:
crontab -e
- Insert a new line line like
*/5 * * * * /home/username/speedtest.sh > /dev/null
to run every 5 minutes
Log-Syntax
The generated log file contains a new line for each measurement in the following format:
YEAR-MONTH-DAY;HOUR:MINUTE:SECOND;PING;DOWNLOAD;UPLOAD
The values for PING
, DOWNLOAD
and UPLOAD
are all floating point numbers.
Speedtest-CLI
speedtest-cli is a:
Command line interface for testing internet bandwidth using speedtest.net
- Download
speedtest-cli
in the same directory asspeedtest.sh
:wget -O speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py
- Make it executable:
chmod +x speedtest-cli
Display
See this Links https://codingworld.io/project/das-20-x-4-zeichen-mit-dem-raspberry-pi
Install the Framework for the Display on a Raspberry Pi via:
sudo pip-3.2 install RPLCD
add the display.py to your Directory and activate the Commented Line in the speedtest.sh to start the Script.
Preview
Graph-Builder
This module is experimental. It generates graphs from the log file which can be used on websites etc.
- Install dependencies (Ubuntu):
sudo apt-get install python3 python3-matplotlib
- Run it:
python3 graph-builder.py
This reads from test.csv
and exports three images called download.png
, upload.png
and ping.png
into the current directory.
Ideas for the Future
- Export/Backup the data
- Export the graph images for specific date ranges (day, month, year, custom range)
- Write HTML code to show the graphs with selection of day, month, year etc. Alpha in index.html + generator.sh
- Traffic extension which calculates the traffic passed through the router and the part of the speed test traffic for a better overview
- Add Automatically Upload to a Website
- Add Capacity, problems with a AVM FritzBox in Internal LAN
THX to AS25415 for Hosting Server ID 4617 under 212.51.1.42 <3