Update default configuration, small fixes in dashboard

This commit is contained in:
Vitaliy Skrypnyk
2021-02-26 23:54:35 +02:00
parent 16e3c37bf8
commit 7661b5819d
3 changed files with 157 additions and 75 deletions

View File

@@ -12,13 +12,9 @@
# Supporter router # Supporter router
Tested with: Keenetic Ultra (KN-1810) KeeneticOS 3.4.12 Tested with: Keenetic Ultra (KN-1810) KeeneticOS 3.5.6
May work on other Keenetic routers May works on other Keenetic routers
# Build from sources
`docker build -t keenetic-grafana-monitoring .`
# Preparation # Preparation
@@ -52,7 +48,28 @@ Destination port: 79
* Import Grafana dashboard from [grafana.com](https://grafana.com/grafana/dashboards/12723) * Import Grafana dashboard from [grafana.com](https://grafana.com/grafana/dashboards/12723)
# Run with docker-compose.yml # Run
There are two options, you can run collector directly on the router or in Docker on separate host.
## Run on router
* Copy repository content to your router `/opt/home/keenetic-grafana-monitoring`
* Install Python `opkg install python3 python3-pip`
* Install dependencies ` pip install -r requirements.txt`
* Create script for autorun `/opt/etc/init.d/S99keeneticgrafana`
```$bash
#!/bin/sh
[ "$1" != "start" ] && exit 0
nohup python /opt/home/keenetic-grafana-monitoring/keentic_influxdb_exporter.py >/dev/null 2>&1 &
```
* Run `/opt/etc/init.d/S99keeneticgrafana start`
## Run on Docker
``` ```
--- ---
@@ -69,19 +86,6 @@ services:
restart: always restart: always
``` ```
# Run on router # Build Docker image
* Copy repository content to your router `/opt/home/keenetic-grafana-monitoring` `docker build -t keenetic-grafana-monitoring .`
* Install Python `opkg install python3 python3-pip`
* Install dependencies ` pip install -r requirements.txt`
* Create script for autorun `/opt/etc/init.d/S99keeneticgrafana`
```$bash
#!/bin/sh
[ "$1" != "start" ] && exit 0
nohup python /opt/home/keenetic-grafana-monitoring/keentic_influxdb_exporter.py >/dev/null 2>&1 &
```
* Run `/opt/etc/init.d/S99keeneticgrafana start`

View File

@@ -111,7 +111,49 @@
"command": "interface stat", "command": "interface stat",
"root" : "$", "root" : "$",
"param" : { "param" : {
"name" : "GigabitEthernet1" "name" : "ISP"
},
"tags" : {},
"values" : {
"rxbytes": "$.rxbytes",
"txbytes": "$.txbytes",
"rxspeed": "$.rxspeed",
"txspeed": "$.txspeed"
}
},
{
"command": "interface stat",
"root" : "$",
"param" : {
"name" : "AccessPoint"
},
"tags" : {},
"values" : {
"rxbytes": "$.rxbytes",
"txbytes": "$.txbytes",
"rxspeed": "$.rxspeed",
"txspeed": "$.txspeed"
}
},
{
"command": "interface stat",
"root" : "$",
"param" : {
"name" : "AccessPoint_5G"
},
"tags" : {},
"values" : {
"rxbytes": "$.rxbytes",
"txbytes": "$.txbytes",
"rxspeed": "$.rxspeed",
"txspeed": "$.txspeed"
}
},
{
"command": "interface stat",
"root" : "$",
"param" : {
"name" : "GigabitEthernet0"
}, },
"tags" : {}, "tags" : {},
"values" : { "values" : {
@@ -136,4 +178,4 @@
} }
} }
] ]
} }

View File

@@ -20,7 +20,7 @@
"type": "grafana", "type": "grafana",
"id": "grafana", "id": "grafana",
"name": "Grafana", "name": "Grafana",
"version": "7.0.2" "version": "7.4.3"
}, },
{ {
"type": "panel", "type": "panel",
@@ -100,10 +100,13 @@
"calcs": [ "calcs": [
"count" "count"
], ],
"fields": "",
"values": false "values": false
} },
"text": {},
"textMode": "auto"
}, },
"pluginVersion": "7.0.2", "pluginVersion": "7.4.3",
"targets": [ "targets": [
{ {
"alias": "Ethernet Clients", "alias": "Ethernet Clients",
@@ -231,10 +234,13 @@
"calcs": [ "calcs": [
"last" "last"
], ],
"fields": "",
"values": false "values": false
} },
"text": {},
"textMode": "auto"
}, },
"pluginVersion": "7.0.2", "pluginVersion": "7.4.3",
"targets": [ "targets": [
{ {
"groupBy": [ "groupBy": [
@@ -348,12 +354,14 @@
"calcs": [ "calcs": [
"mean" "mean"
], ],
"fields": "",
"values": false "values": false
}, },
"showThresholdLabels": false, "showThresholdLabels": false,
"showThresholdMarkers": true "showThresholdMarkers": true,
"text": {}
}, },
"pluginVersion": "7.0.2", "pluginVersion": "7.4.3",
"targets": [ "targets": [
{ {
"alias": "$col", "alias": "$col",
@@ -373,7 +381,7 @@
], ],
"orderByTime": "ASC", "orderByTime": "ASC",
"policy": "default", "policy": "default",
"query": "SELECT (mean(\"memtotal\") - mean(\"memfree\")) as \"RAM Usage\" FROM \"system\" WHERE $timeFilter GROUP BY time($__interval) fill(none)", "query": "SELECT (mean(\"memtotal\") - mean(\"memfree\") - mean(\"membuffers\") - mean(\"memcache\")) as \"RAM Usage\" FROM \"system\" WHERE $timeFilter GROUP BY time($__interval) fill(null)",
"rawQuery": true, "rawQuery": true,
"refId": "A", "refId": "A",
"resultFormat": "time_series", "resultFormat": "time_series",
@@ -411,7 +419,7 @@
], ],
"orderByTime": "ASC", "orderByTime": "ASC",
"policy": "default", "policy": "default",
"query": "SELECT mean(\"cpuload\") as \"CPU Usage\" FROM \"system\" WHERE $timeFilter GROUP BY time($__interval) fill(none)", "query": "SELECT mean(\"cpuload\") as \"CPU Usage\" FROM \"system\" WHERE $timeFilter GROUP BY time($__interval) fill(null)",
"rawQuery": true, "rawQuery": true,
"refId": "B", "refId": "B",
"resultFormat": "time_series", "resultFormat": "time_series",
@@ -441,9 +449,7 @@
"datasource": "${DS_INFLUXDB_KEENETIC}", "datasource": "${DS_INFLUXDB_KEENETIC}",
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"custom": { "custom": {},
"align": null
},
"decimals": 0, "decimals": 0,
"mappings": [ "mappings": [
{ {
@@ -500,12 +506,14 @@
"calcs": [ "calcs": [
"last" "last"
], ],
"fields": "",
"values": false "values": false
}, },
"showThresholdLabels": false, "showThresholdLabels": false,
"showThresholdMarkers": false "showThresholdMarkers": false,
"text": {}
}, },
"pluginVersion": "7.0.2", "pluginVersion": "7.4.3",
"targets": [ "targets": [
{ {
"alias": "$col", "alias": "$col",
@@ -561,7 +569,8 @@
"decimals": 2, "decimals": 2,
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"custom": {} "custom": {},
"links": []
}, },
"overrides": [] "overrides": []
}, },
@@ -592,9 +601,10 @@
"linewidth": 1, "linewidth": 1,
"nullPointMode": "null", "nullPointMode": "null",
"options": { "options": {
"dataLinks": [] "alertThreshold": true
}, },
"percentage": false, "percentage": false,
"pluginVersion": "7.4.3",
"pointradius": 2, "pointradius": 2,
"points": false, "points": false,
"renderer": "flot", "renderer": "flot",
@@ -628,7 +638,7 @@
"measurement": "interface stat", "measurement": "interface stat",
"orderByTime": "ASC", "orderByTime": "ASC",
"policy": "default", "policy": "default",
"query": "SELECT non_negative_difference(mean(\"txbytes\")) FROM \"interface stat\" WHERE $timeFilter GROUP BY time($__interval), \"name\" fill(none)", "query": "SELECT non_negative_difference(mean(\"txbytes\")) FROM \"interface stat\" WHERE $timeFilter GROUP BY time($__interval), \"name\" fill(null)",
"rawQuery": true, "rawQuery": true,
"refId": "B", "refId": "B",
"resultFormat": "time_series", "resultFormat": "time_series",
@@ -670,7 +680,7 @@
], ],
"orderByTime": "ASC", "orderByTime": "ASC",
"policy": "default", "policy": "default",
"query": "SELECT non_negative_difference(mean(\"rxbytes\")) FROM \"interface stat\" WHERE $timeFilter GROUP BY time($__interval), \"name\" fill(none)", "query": "SELECT non_negative_difference(mean(\"rxbytes\")) FROM \"interface stat\" WHERE $timeFilter GROUP BY time($__interval), \"name\" fill(null)",
"rawQuery": true, "rawQuery": true,
"refId": "A", "refId": "A",
"resultFormat": "time_series", "resultFormat": "time_series",
@@ -743,7 +753,8 @@
"decimals": 2, "decimals": 2,
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"custom": {} "custom": {},
"links": []
}, },
"overrides": [] "overrides": []
}, },
@@ -774,9 +785,10 @@
"linewidth": 1, "linewidth": 1,
"nullPointMode": "null", "nullPointMode": "null",
"options": { "options": {
"dataLinks": [] "alertThreshold": true
}, },
"percentage": false, "percentage": false,
"pluginVersion": "7.4.3",
"pointradius": 2, "pointradius": 2,
"points": false, "points": false,
"renderer": "flot", "renderer": "flot",
@@ -810,7 +822,7 @@
"measurement": "interface stat", "measurement": "interface stat",
"orderByTime": "ASC", "orderByTime": "ASC",
"policy": "default", "policy": "default",
"query": "SELECT(mean(\"txspeed\")) FROM \"interface stat\" WHERE $timeFilter GROUP BY time($__interval), \"name\" fill(none)", "query": "SELECT(mean(\"txspeed\")) FROM \"interface stat\" WHERE $timeFilter GROUP BY time($__interval), \"name\" fill(null)",
"rawQuery": true, "rawQuery": true,
"refId": "B", "refId": "B",
"resultFormat": "time_series", "resultFormat": "time_series",
@@ -852,7 +864,7 @@
], ],
"orderByTime": "ASC", "orderByTime": "ASC",
"policy": "default", "policy": "default",
"query": "SELECT(mean(\"rxspeed\")) FROM \"interface stat\" WHERE $timeFilter GROUP BY time($__interval), \"name\" fill(none)", "query": "SELECT(mean(\"rxspeed\")) FROM \"interface stat\" WHERE $timeFilter GROUP BY time($__interval), \"name\" fill(null)",
"rawQuery": true, "rawQuery": true,
"refId": "A", "refId": "A",
"resultFormat": "time_series", "resultFormat": "time_series",
@@ -925,7 +937,8 @@
"decimals": 2, "decimals": 2,
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"custom": {} "custom": {},
"links": []
}, },
"overrides": [] "overrides": []
}, },
@@ -956,9 +969,10 @@
"linewidth": 1, "linewidth": 1,
"nullPointMode": "null", "nullPointMode": "null",
"options": { "options": {
"dataLinks": [] "alertThreshold": true
}, },
"percentage": false, "percentage": false,
"pluginVersion": "7.4.3",
"pointradius": 2, "pointradius": 2,
"points": false, "points": false,
"renderer": "flot", "renderer": "flot",
@@ -992,7 +1006,7 @@
"measurement": "ip hotspot", "measurement": "ip hotspot",
"orderByTime": "ASC", "orderByTime": "ASC",
"policy": "default", "policy": "default",
"query": "SELECT non_negative_difference(mean(\"rxbytes\")) + non_negative_difference(mean(\"txbytes\")) FROM \"ip hotspot\" WHERE $timeFilter AND \"active\" = 1 GROUP BY time($__interval), \"name\" fill(none)", "query": "SELECT non_negative_difference(mean(\"rxbytes\")) + non_negative_difference(mean(\"txbytes\")) FROM \"ip hotspot\" WHERE $timeFilter AND \"active\" = 1 GROUP BY time($__interval), \"name\" fill(null)",
"rawQuery": true, "rawQuery": true,
"refId": "A", "refId": "A",
"resultFormat": "time_series", "resultFormat": "time_series",
@@ -1088,7 +1102,8 @@
"datasource": "${DS_INFLUXDB_KEENETIC}", "datasource": "${DS_INFLUXDB_KEENETIC}",
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"custom": {} "custom": {},
"links": []
}, },
"overrides": [] "overrides": []
}, },
@@ -1115,9 +1130,10 @@
"linewidth": 1, "linewidth": 1,
"nullPointMode": "null", "nullPointMode": "null",
"options": { "options": {
"dataLinks": [] "alertThreshold": true
}, },
"percentage": false, "percentage": false,
"pluginVersion": "7.4.3",
"pointradius": 2, "pointradius": 2,
"points": false, "points": false,
"renderer": "flot", "renderer": "flot",
@@ -1215,7 +1231,8 @@
"datasource": "${DS_INFLUXDB_KEENETIC}", "datasource": "${DS_INFLUXDB_KEENETIC}",
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"custom": {} "custom": {},
"links": []
}, },
"overrides": [] "overrides": []
}, },
@@ -1229,6 +1246,7 @@
}, },
"hiddenSeries": false, "hiddenSeries": false,
"id": 5, "id": 5,
"interval": "",
"legend": { "legend": {
"alignAsTable": true, "alignAsTable": true,
"avg": true, "avg": true,
@@ -1246,9 +1264,10 @@
"linewidth": 1, "linewidth": 1,
"nullPointMode": "null", "nullPointMode": "null",
"options": { "options": {
"dataLinks": [] "alertThreshold": true
}, },
"percentage": false, "percentage": false,
"pluginVersion": "7.4.3",
"pointradius": 2, "pointradius": 2,
"points": false, "points": false,
"renderer": "flot", "renderer": "flot",
@@ -1258,7 +1277,7 @@
"steppedLine": false, "steppedLine": false,
"targets": [ "targets": [
{ {
"alias": "$tag_name", "alias": "$tag_name [$tag_mode]",
"groupBy": [ "groupBy": [
{ {
"params": [ "params": [
@@ -1282,6 +1301,8 @@
"measurement": "ip hotspot", "measurement": "ip hotspot",
"orderByTime": "ASC", "orderByTime": "ASC",
"policy": "default", "policy": "default",
"query": "SELECT mean(\"txrate\") FROM \"ip hotspot\" WHERE $timeFilter AND \"active\" = 1 AND \"mode\" != \"\" GROUP BY time($__interval), \"name\", \"mode\" fill(null)",
"rawQuery": true,
"refId": "A", "refId": "A",
"resultFormat": "time_series", "resultFormat": "time_series",
"select": [ "select": [
@@ -1350,7 +1371,8 @@
"datasource": "${DS_INFLUXDB_KEENETIC}", "datasource": "${DS_INFLUXDB_KEENETIC}",
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"custom": {} "custom": {},
"links": []
}, },
"overrides": [] "overrides": []
}, },
@@ -1364,6 +1386,7 @@
}, },
"hiddenSeries": false, "hiddenSeries": false,
"id": 2, "id": 2,
"interval": "",
"legend": { "legend": {
"alignAsTable": true, "alignAsTable": true,
"avg": false, "avg": false,
@@ -1381,9 +1404,10 @@
"linewidth": 1, "linewidth": 1,
"nullPointMode": "null", "nullPointMode": "null",
"options": { "options": {
"dataLinks": [] "alertThreshold": true
}, },
"percentage": false, "percentage": false,
"pluginVersion": "7.4.3",
"pointradius": 2, "pointradius": 2,
"points": false, "points": false,
"renderer": "flot", "renderer": "flot",
@@ -1393,7 +1417,7 @@
"steppedLine": false, "steppedLine": false,
"targets": [ "targets": [
{ {
"alias": "$tag_name", "alias": "$tag_name [$tag_mode]",
"groupBy": [ "groupBy": [
{ {
"params": [ "params": [
@@ -1417,6 +1441,8 @@
"measurement": "ip hotspot", "measurement": "ip hotspot",
"orderByTime": "ASC", "orderByTime": "ASC",
"policy": "default", "policy": "default",
"query": "SELECT mean(\"signal\") FROM \"ip hotspot\" WHERE $timeFilter AND \"active\" = 1 GROUP BY time($__interval), \"name\", \"mode\" fill(null)",
"rawQuery": true,
"refId": "A", "refId": "A",
"resultFormat": "time_series", "resultFormat": "time_series",
"select": [ "select": [
@@ -1485,7 +1511,8 @@
"datasource": "${DS_INFLUXDB_KEENETIC}", "datasource": "${DS_INFLUXDB_KEENETIC}",
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"custom": {} "custom": {},
"links": []
}, },
"overrides": [] "overrides": []
}, },
@@ -1513,9 +1540,10 @@
"linewidth": 1, "linewidth": 1,
"nullPointMode": "null", "nullPointMode": "null",
"options": { "options": {
"dataLinks": [] "alertThreshold": true
}, },
"percentage": false, "percentage": false,
"pluginVersion": "7.4.3",
"pointradius": 2, "pointradius": 2,
"points": false, "points": false,
"renderer": "flot", "renderer": "flot",
@@ -1535,7 +1563,7 @@
}, },
{ {
"params": [ "params": [
"linear" "null"
], ],
"type": "fill" "type": "fill"
} }
@@ -1613,7 +1641,8 @@
"datasource": "${DS_INFLUXDB_KEENETIC}", "datasource": "${DS_INFLUXDB_KEENETIC}",
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"custom": {} "custom": {},
"links": []
}, },
"overrides": [] "overrides": []
}, },
@@ -1642,9 +1671,10 @@
"linewidth": 1, "linewidth": 1,
"nullPointMode": "null", "nullPointMode": "null",
"options": { "options": {
"dataLinks": [] "alertThreshold": true
}, },
"percentage": false, "percentage": false,
"pluginVersion": "7.4.3",
"pointradius": 2, "pointradius": 2,
"points": false, "points": false,
"renderer": "flot", "renderer": "flot",
@@ -1672,7 +1702,7 @@
"measurement": "system", "measurement": "system",
"orderByTime": "ASC", "orderByTime": "ASC",
"policy": "default", "policy": "default",
"query": "SELECT mean(\"memtotal\") - mean(\"memfree\") FROM \"system\" WHERE $timeFilter GROUP BY time($__interval) fill(none)", "query": "SELECT mean(\"memtotal\") - mean(\"memfree\") FROM \"system\" WHERE $timeFilter GROUP BY time($__interval) fill(null)",
"rawQuery": true, "rawQuery": true,
"refId": "A", "refId": "A",
"resultFormat": "time_series", "resultFormat": "time_series",
@@ -1742,7 +1772,8 @@
"datasource": "${DS_INFLUXDB_KEENETIC}", "datasource": "${DS_INFLUXDB_KEENETIC}",
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"custom": {} "custom": {},
"links": []
}, },
"overrides": [] "overrides": []
}, },
@@ -1773,9 +1804,10 @@
"linewidth": 1, "linewidth": 1,
"nullPointMode": "null", "nullPointMode": "null",
"options": { "options": {
"dataLinks": [] "alertThreshold": true
}, },
"percentage": false, "percentage": false,
"pluginVersion": "7.4.3",
"pointradius": 2, "pointradius": 2,
"points": false, "points": false,
"renderer": "flot", "renderer": "flot",
@@ -1878,7 +1910,8 @@
"datasource": "${DS_INFLUXDB_KEENETIC}", "datasource": "${DS_INFLUXDB_KEENETIC}",
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"custom": {} "custom": {},
"links": []
}, },
"overrides": [] "overrides": []
}, },
@@ -1907,9 +1940,10 @@
"linewidth": 1, "linewidth": 1,
"nullPointMode": "null", "nullPointMode": "null",
"options": { "options": {
"dataLinks": [] "alertThreshold": true
}, },
"percentage": false, "percentage": false,
"pluginVersion": "7.4.3",
"pointradius": 2, "pointradius": 2,
"points": false, "points": false,
"renderer": "flot", "renderer": "flot",
@@ -2015,7 +2049,8 @@
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"custom": { "custom": {
"align": null "align": null,
"filterable": false
}, },
"decimals": 2, "decimals": 2,
"mappings": [], "mappings": [],
@@ -2097,7 +2132,7 @@
} }
] ]
}, },
"pluginVersion": "7.0.2", "pluginVersion": "7.4.3",
"targets": [ "targets": [
{ {
"groupBy": [ "groupBy": [
@@ -2167,7 +2202,8 @@
"defaults": { "defaults": {
"custom": { "custom": {
"align": null, "align": null,
"displayMode": "color-background" "displayMode": "color-background",
"filterable": false
}, },
"mappings": [ "mappings": [
{ {
@@ -2263,7 +2299,7 @@
} }
] ]
}, },
"pluginVersion": "7.0.2", "pluginVersion": "7.4.3",
"targets": [ "targets": [
{ {
"groupBy": [ "groupBy": [
@@ -2323,14 +2359,14 @@
} }
], ],
"refresh": false, "refresh": false,
"schemaVersion": 25, "schemaVersion": 27,
"style": "dark", "style": "dark",
"tags": [], "tags": [],
"templating": { "templating": {
"list": [] "list": []
}, },
"time": { "time": {
"from": "now-6h", "from": "now-24h",
"to": "now" "to": "now"
}, },
"timepicker": { "timepicker": {
@@ -2349,5 +2385,5 @@
"timezone": "", "timezone": "",
"title": "Keenetic", "title": "Keenetic",
"uid": "rufORtVGk", "uid": "rufORtVGk",
"version": 77 "version": 87
} }