Speedtest Data in Grafana

Alex's Guardian > Blog > Homelab Things > Grafana > Speedtest Data in Grafana
Green is Download (RX) Yellow is Upload (TX)

You’ll first need to create the database that the speedtest container will be writing data to. If you followed my Grafana guide then you will need to use the following commands to create the database and needed permissions. Make sure to change <> areas with your needed info

curl -XPOST "http://<ip.of.influx.db>:8086/query" -u admin:password --data-urlencode "q=CREATE DATABASE speedtest"

curl -XPOST "http://<ip.of.influx.db>:8086/query" -u admin:password --data-urlencode "q=CREATE USER speedtest WITH PASSWORD 'speedtest'"

curl -XPOST "http://<ip.of.influx.db>:8086/query" -u admin:password --data-urlencode "q=GRANT WRITE ON speedtest TO 'speedtest'"

curl -XPOST "http://<ip.of.influx.db>:8086/query" -u admin:password --data-urlencode "q=GRANT READ ON speedtest TO grafana"

Now to save a few words I am just going to link the guide for the Speedtest-for-InfluxDB-and-Grafana docker container here. Its pretty straight forward and easy to follow, so go get the container running with your new database and then return!

Now that you have the speedtest container running in docker and sending the info to influxdb, (I recommend changing the delay = 300 to someting more infrequent so its not testing every 5 minutes), we can set up the graph to plot the data.

You can use this site to get speedtest server IDs if you wish to specify them instead of using “Auto.”

Navigate to Grafana, login, go to the add data sources view and click “add data source”.

NAMESpeedtest Data

Now head to your dashboard and add a new graph. Under Metrics:

SELECT mean("download") FROM "speed_test_results" WHERE time >= now() - 30d GROUP BY time(1h) fill(linear);SELECT mean("upload") FROM "speed_test_results" WHERE time >= now() - 30d GROUP BY time(1h) fill(linear)

Axes tab:

Left Y – Unitbits/sec
Left Y – Decimals1

Edit the rest of the settings to your liking and then click the back arrow. Give it time to update, aka allow the speedtest to run, and you should see your first mark on the graph.

Edit 4/29/19: Updated to match new Grafana guide settings.