Home Speedtest
Posted in Tech Ramblings
So every night around 7-11:59pm my downspeeds drop to <10Mbit and latency starts pumping up to around 500ms… So I’ve come up with a system to chart it so I can provide them irrefutable proof there’s an issue…
Technically all you need to make this work is the speedtest.py script… but I went a bit further and also setup a speedtest/mini server to combat the stupid techs from telling me it’s my wifi. This is how I created it.
- Install Ubuntu Server 14.x LTS in a VM.
-
During install, select SSH Server, LAMP, Samba services by default.
-
Update the server
- apt-get update
- apt-get upgrade
-
-
Setup the Samba share as required…
- sudo smbpasswd -a yoursambauser
-
sudo nano –w /etc/samba/smb.conf
- Add a block like this to the end:
[secured]
path = /home/yourusername
valid users = yoursambauser
guest ok = no
writable = yes
browsable = yes
- Add a block like this to the end:
-
Install the Mini Speed Test (optional)
-
Make sure the pre-reqs are installed
- apt-get install php5 php5-mysql php5-mcrypt php5-gd libapache2-mod-php5
- Download the mini.zip from http://www.speedtest.net/mini.php
- Extract it to /var/www/html/
-
Test it at http://server/mini
-
-
Install speedtest.py (https://github.com/sivel/speedtest-cli)
- wget -O speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest_cli.py
- chmod ugo+x speedtest-cli
- sudo chown root:root speedtest-cli
- mv speedtest-cli /usr/bin/
-
Grab speedtest-csv from https://github.com/HenrikBengtsson/speedtest-cli-extras/tree/master/bin
-
Do some tests… make sure speedtest-csv is actually calling speedtest-cli properly…
- I had to make a few edits to the script to specify a server when calling it… (attached)
- There’s a windows .bat variant on the github page if you opt not to do it on a linux box.
-
- Add it to the crontab… (or Task Scheduler in windows)
# Crontab running speedtest-csv.sh which calls speedtest.py which uses the speedtest.net servers… # Best Pick Server 08,38 * * * * /home/user/speedtest-csv.sh --standardize --server 3635 >> /home/daceige/speedtestlog.random.csv # 3635) LUS Fiber 18,48 * * * * /home/user/speedtest-csv.sh --standardize --server 3635 >> /home/daceige/speedtestlog.csv # 2410) Charter Communications (Slidell, LA, United States) [41.34 km] 28,58 * * * * /home/user/speedtest-csv.sh --standardize --server 2410 >> /home/daceige/speedtestlog.csv
/home/user/speedtestlog.csv is shared via a Samba service on the server… which then I import into an excel spreadsheet as a data source, which I then pump into a few pivot tables and graphs…
And … Volia…