Recently been diving into Grafana and InfluxDB at work and playing around a bit at home. Started looking into doing a Speed Test Page in order to see how my Network Speeds are during the day.

Stumbled upon a tutorial here.

I tried it on a Raspberry Pi 3B, but due to its limited Network Speeds, I could never test above 70MB/s. I utilized one of my Raspberry Pi 4s that are folding, to handle the Speediest CLI and script, and was able to obtain accurate results.

I made some changes to his script.

First, I increases the threads from 1 to 5. Testing up to 10 threads, anything over five gave diminishing returns.

Second I changed the get_best_server function to get_closest_servers. This gave more accurate results. The best results are via the Secure argument using speedtest-cli, but I have not been able to make the changes need in the Python script, as I’m a beginner with Python.

Here are the changes

# run a single-threaded speedtest using default server

s = speedtest.Speedtest()

s.get_closest_servers()

s.download(threads=5)

s.upload(threads=5)

res = s.results.dict()

Second, Simon’s JSON dashboard has some mistakes. There are multiple sections where is measurement variable is speed, when it should be speedtest. This results in only viewing a subset of the metrics on the Grafana side. He’s been notified via comment in his blog, but hasn’t updated yet.

The working JSON is here.

{
“editable”: true,
“gnetId”: null,
“graphTooltip”: 0,
“id”: 5,
“links”: [],
“panels”: [
{
“aliasColors”: {},
“bars”: false,
“dashLength”: 10,
“dashes”: false,
“datasource”: null,
“fill”: 1,
“fillGradient”: 0,
“gridPos”: {
“h”: 14,
“w”: 24,
“x”: 0,
“y”: 0
},
“hiddenSeries”: false,
“id”: 2,
“legend”: {
“avg”: false,
“current”: false,
“max”: true,
“min”: false,
“show”: true,
“total”: false,
“values”: true
},
“lines”: true,
“linewidth”: 1,
“nullPointMode”: “null”,
“options”: {
“dataLinks”: []
},
“percentage”: false,
“pointradius”: 2,
“points”: false,
“renderer”: “flot”,
“seriesOverrides”: [
{
“alias”: “Ping (ms)”,
“yaxis”: 2
}
],
“spaceLength”: 10,
“stack”: false,
“steppedLine”: false,
“targets”: [
{
“alias”: “Ping (ms)”,
“groupBy”: [
{
“params”: [
“$__interval”
],
“type”: “time”
},
{
“params”: [
“none”
],
“type”: “fill”
}
],
“measurement”: “speedtest”,
“orderByTime”: “ASC”,
“policy”: “default”,
“refId”: “A”,
“resultFormat”: “time_series”,
“select”: [
[
{
“params”: [
“ping”
],
“type”: “field”
},
{
“params”: [],
“type”: “mean”
}
]
],
“tags”: []
},
{
“alias”: “Download (Mbps)”,
“groupBy”: [
{
“params”: [
“$__interval”
],
“type”: “time”
},
{
“params”: [
“none”
],
“type”: “fill”
}
],
“measurement”: “speedtest”,
“orderByTime”: “ASC”,
“policy”: “default”,
“refId”: “B”,
“resultFormat”: “time_series”,
“select”: [
[
{
“params”: [
“download”
],
“type”: “field”
},
{
“params”: [],
“type”: “mean”
},
{
“params”: [
” / 1000000″
],
“type”: “math”
}
]
],
“tags”: []
},
{
“alias”: “Upload (Mbps)”,
“groupBy”: [
{
“params”: [
“$__interval”
],
“type”: “time”
},
{
“params”: [
“none”
],
“type”: “fill”
}
],
“measurement”: “speedtest”,
“orderByTime”: “ASC”,
“policy”: “default”,
“refId”: “C”,
“resultFormat”: “time_series”,
“select”: [
[
{
“params”: [
“upload”
],
“type”: “field”
},
{
“params”: [],
“type”: “mean”
},
{
“params”: [
” / 1000000″
],
“type”: “math”
}
]
],
“tags”: []
},
{
“alias”: “4h Avg Download (Mbps)”,
“groupBy”: [
{
“params”: [
“4h”
],
“type”: “time”
},
{
“params”: [
“none”
],
“type”: “fill”
}
],
“measurement”: “speedtest”,
“orderByTime”: “ASC”,
“policy”: “default”,
“refId”: “D”,
“resultFormat”: “time_series”,
“select”: [
[
{
“params”: [
“download”
],
“type”: “field”
},
{
“params”: [],
“type”: “mean”
},
{
“params”: [
” / 1000000″
],
“type”: “math”
}
]
],
“tags”: []
}
],
“thresholds”: [],
“timeFrom”: null,
“timeRegions”: [],
“timeShift”: null,
“title”: “Network Quality”,
“tooltip”: {
“shared”: true,
“sort”: 0,
“value_type”: “individual”
},
“type”: “graph”,
“xaxis”: {
“buckets”: null,
“mode”: “time”,
“name”: null,
“show”: true,
“values”: []
},
“yaxes”: [
{
“format”: “Mbits”,
“label”: “Speed”,
“logBase”: 1,
“max”: null,
“min”: null,
“show”: true
},
{
“format”: “ms”,
“label”: “Ping”,
“logBase”: 1,
“max”: null,
“min”: null,
“show”: true
}
],
“yaxis”: {
“align”: false,
“alignLevel”: null
}
}
],
“schemaVersion”: 21,
“style”: “dark”,
“tags”: [],
“templating”: {
“list”: []
},
“time”: {
“from”: “now-24h”,
“to”: “now”
},
“timepicker”: {},
“timezone”: “”,
“title”: “Network”,
“uid”: “_gyrT3zgk”,
“version”: 5
}

Finally I found the line graphs a bit useless. I found a speed dial more handy, simply because its easier for quick at a glance viewing, so I’ve changed my dashboard to this.

Published by mdicecca112

Systems Engineer from the Greater Boston Area

Leave a comment

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: