Skip to content

Commit

Permalink
Add grafana screenshot
Browse files Browse the repository at this point in the history
  • Loading branch information
robinmanuelthiel committed Apr 18, 2020
1 parent 52e0787 commit c43827e
Show file tree
Hide file tree
Showing 3 changed files with 280 additions and 0 deletions.
49 changes: 49 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,52 @@ Your upload speed is 42 Mbps (4012944 Bytes/s).
| `DB_NAME` | `speedtest` | InfluxDB Database name |
| `DB_USERNAME` | `admin` | InfluxDB Username |
| `DB_PASSWORD` | `password` | InfluxDB Password |

## Grafana and InfluxDB

![Screenshot of a Grafana Dashboard with upload and download speed values](img/grafana.png)

For a full visualization and long term tracking, I recommend InfluxDB as a time-series database and Grafana as a dashboard engine. Both come in Docker containers, so the whole setup can be achieved by starting a Docker Compose file.

```yaml
version: "3"
services:
grafana:
image: grafana/grafana:latest
restart: always
ports:
- 3000:3000
volumes:
- grafana:/var/lib/grafana

influxdb:
image: influxdb
volumes:
- influxdb:/var/lib/influxdb
ports:
- 8083:8083
- 8086:8086
environment:
- INFLUXDB_ADMIN_USER="admin"
- INFLUXDB_ADMIN_PASSWORD="password"
- INFLUXDB_DB="speedtest"

speedtest:
image: robinmanuelthiel/speedtest:latest
environment:
- LOOP=true
- LOOP_DELAY=1800
- DB_SAVE=true
- DB_HOST=http://influxdb:8086
- DB_NAME=speedtest
- DB_USERNAME=admin
- DB_PASSWORD=password

volumes:
grafana:
influxdb:
```
To configure Grafana, we need to add InfluxDB as a data source and create a dashboard with the upload and download values. You can find a demo dashboard configuration in the [/demo](/demo) folder.
> **Hint:** The speedtest outputs values as bytes per second. Make sure to divide all values by 125000 in your dashboard to get the Mbps values.
231 changes: 231 additions & 0 deletions demo/dashboard.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,231 @@
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"type": "dashboard"
}
]
},
"editable": true,
"gnetId": null,
"graphTooltip": 0,
"id": 1,
"links": [],
"panels": [
{
"aliasColors": {},
"bars": false,
"cacheTimeout": null,
"dashLength": 10,
"dashes": false,
"datasource": null,
"fill": 1,
"fillGradient": 2,
"gridPos": {
"h": 13,
"w": 24,
"x": 0,
"y": 0
},
"hiddenSeries": false,
"id": 2,
"legend": {
"alignAsTable": false,
"avg": true,
"current": false,
"hideEmpty": false,
"max": true,
"min": true,
"rightSide": false,
"show": true,
"total": false,
"values": true
},
"lines": true,
"linewidth": 2,
"links": [],
"nullPointMode": "connected",
"options": {
"dataLinks": []
},
"percentage": false,
"pluginVersion": "6.7.2",
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"alias": "download",
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"hide": false,
"measurement": "download",
"orderByTime": "ASC",
"policy": "default",
"query": "SELECT mean(\"value\") FROM \"download\" WHERE $timeFilter GROUP BY time($__interval) fill(null)",
"rawQuery": false,
"refId": "A",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "mean"
},
{
"params": [
" / 125000"
],
"type": "math"
}
]
],
"tags": []
},
{
"alias": "upload",
"groupBy": [
{
"params": [
"$__interval"
],
"type": "time"
},
{
"params": [
"null"
],
"type": "fill"
}
],
"measurement": "upload",
"orderByTime": "ASC",
"policy": "default",
"refId": "B",
"resultFormat": "time_series",
"select": [
[
{
"params": [
"value"
],
"type": "field"
},
{
"params": [],
"type": "mean"
},
{
"params": [
"/125000"
],
"type": "math"
}
]
],
"tags": []
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "m-Net",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "Mbits",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": false
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
}
],
"refresh": "5m",
"schemaVersion": 22,
"style": "dark",
"tags": [],
"templating": {
"list": []
},
"time": {
"from": "now-12h",
"to": "now"
},
"timepicker": {
"refresh_intervals": [
"5s",
"10s",
"30s",
"1m",
"5m",
"15m",
"30m",
"1h",
"2h",
"1d"
]
},
"timezone": "",
"title": "Bandwidth",
"uid": "M27juGmgk",
"variables": {
"list": []
},
"version": 5
}
Binary file added img/grafana.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c43827e

Please sign in to comment.