Speed test your internet

I recently got switched from VDSL+ to Cable and wanted to see if I was getting consistent speeds. So I setup a script to run hourly and hit up speedtest.net. I recorded the results in CSV and creating a gnuplot script to make a nice graph.

My setup

  • Ubuntu 16.04.2 LTS VM running on byhve FreeNas 11
  • Wired connection with 1Gbps cabling and switching gear
  • Speedtest-cli wrapped in a script to append to a log file
  • gnuplot to make nice graph

My sript was stashed in my home folders ~/bin/speed.sh.

#!/bin/bash
BIN=/home/user/.local/bin/speedtest-cli
OUT=~/speedtest.csv
$BIN --csv >> $OUT

Crontab entry for my user using cronatb -e

0 * * * * /home/user/bin/speed.sh >> /home/user/speedtest.log 2>&1

My hacked together speed test graph with gnuplot. Lots of room for imrpovement here.

set terminal pngcairo size 700,300 enhanced font 'Verdana,10'
set output 'speedtest.png'
set title "Speed Test Plots"
set xlabel "Date"
set xdata time
set ylabel "Speeds (Mbps)"
set ytics 0, 125
set ytics 25
set y2label "Ping (ms)"
set y2tics 0, 100
set y2tics 5
set key center right

set datafile separator ","
set timefmt "%Y-%m-%dT%H:%M:%S"

plot 'speedtest.csv' using 4:($7 / (1024 * 1024)) with line title "Download (Mbps)", \
  '' using 4:($8 / (1024 * 1024)) with line title "Upload (Mbps)", \
  '' using 4:($6)  linetype 6 axis x1y2 title "Ping (ms)"


The fruits of my labour after a few days of measuring.

Speed Test Results Graph

Improvements

  • Measure full Tx/Rx via SNMP/firewall rules/etc from router to account for local usage at time of test
  • Ping first outside local network hop in addition to destination
  • 95th percential line would be nice, but gnuplot can do stats on timeline data...
  • Use the same speedtest.net server for each test (currently chooses the best match)
  • Configure it to update a static website

More Reading
comments powered by Disqus