Better charts + grafana dashboard

This commit is contained in:
Michael Wyraz 2021-11-19 23:04:28 +01:00
parent 4d922104cd
commit e533d466d1
7 changed files with 543 additions and 81 deletions

View File

@ -34,7 +34,7 @@ Ein kleines Programm (https://github.com/genofire/meshviewer-collector), welches
Umgebungsvariablen:
* keine
* TODO: externe Karten konfigurierbar machen
* TODO: externe Node-Quellen konfigurierbar machen
### meshviewer

View File

@ -95,7 +95,7 @@ services:
renderer-proxy:
image: nginx:1.21-alpine
volumes:
- ./renderer-proxy:/etc/nginx/conf.d/:ro
- ./renderer/nginx.conf:/etc/nginx/conf.d/default.conf:ro
labels:
traefik.enable: "true"
traefik.http.routers.renderer.rule: Host(`${MAPSERVER_DOMAIN:?MAPSERVER_DOMAIN is required}`) && PathPrefix(`/render`)
@ -108,10 +108,14 @@ services:
image: lomik/prometheus-png:v0.5.0
network_mode: "service:renderer-proxy"
command:
- -config
- /etc/config.toml
- -prometheus
- http://victoriametrics:8428
depends_on:
- renderer-proxy
restart: unless-stopped
volumes:
- ./renderer/config.toml:/etc/config.toml:ro
# 650x350

View File

@ -22,7 +22,7 @@
"fiscalYearStartMonth": 0,
"gnetId": null,
"graphTooltip": 0,
"iteration": 1637104630864,
"iteration": 1637358897801,
"links": [],
"liveNow": false,
"panels": [
@ -31,38 +31,221 @@
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
"mode": "palette-classic"
},
"custom": {
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 9,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
"spanNulls": 1800000,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"decimals": 0,
"mappings": [],
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"unit": "binBps"
},
"overrides": []
},
"gridPos": {
"h": 3,
"h": 8,
"w": 12,
"x": 0,
"y": 0
},
"id": 4,
"interval": null,
"maxDataPoints": 1,
"id": 5,
"options": {
"legend": {
"calcs": [
"min",
"max",
"mean",
"lastNotNull"
],
"displayMode": "table",
"placement": "bottom"
},
"tooltip": {
"mode": "single"
}
},
"targets": [
{
"exemplar": true,
"expr": "max_over_time(irate(node_traffic.forward.bytes{nodeid=\"$node_id\"})[2m])",
"hide": false,
"interval": "",
"legendFormat": "Traffic (forward)",
"refId": "Aa"
},
{
"exemplar": true,
"expr": "max_over_time(irate(node_traffic.rx.bytes{nodeid=\"$node_id\"})[2m])",
"interval": "",
"legendFormat": "Traffic (rx)",
"refId": "A"
},
{
"exemplar": true,
"expr": "max_over_time(irate(node_traffic.tx.bytes{nodeid=\"$node_id\"})[2m])",
"hide": false,
"interval": "",
"legendFormat": "Traffic (tx)",
"refId": "C"
}
],
"title": "Traffic - $node_id - $hostname -",
"type": "timeseries"
},
{
"datasource": null,
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisLabel": "",
"axisPlacement": "auto",
"axisSoftMax": 5,
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 20,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "smooth",
"lineWidth": 2,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
"spanNulls": 1800000,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"decimals": 0,
"mappings": [],
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
},
"unit": "short"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 0
},
"id": 2,
"options": {
"legend": {
"calcs": [
"min",
"max",
"mean",
"lastNotNull"
],
"displayMode": "table",
"placement": "bottom"
},
"tooltip": {
"mode": "single"
}
},
"targets": [
{
"exemplar": true,
"expr": "max_over_time(node_clients.total{nodeid=\"$node_id\"}[10m])",
"interval": "",
"legendFormat": "clients",
"refId": "A"
}
],
"title": "Clients",
"type": "timeseries"
},
{
"datasource": null,
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [],
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
},
"unit": "bytes"
},
"overrides": []
},
"gridPos": {
"h": 7,
"w": 12,
"x": 0,
"y": 8
},
"id": 11,
"options": {
"colorMode": "value",
"graphMode": "none",
"justifyMode": "auto",
"justifyMode": "center",
"orientation": "auto",
"reduceOptions": {
"calcs": [
@ -71,22 +254,63 @@
"fields": "",
"values": false
},
"text": {},
"textMode": "name"
"text": {
"titleSize": 30
},
"textMode": "value_and_name"
},
"pluginVersion": "8.2.3",
"repeat": null,
"targets": [
{
"exemplar": false,
"expr": "node_clients.total{nodeid=\"$node_id\"}[1y]",
"format": "time_series",
"instant": true,
"exemplar": true,
"expr": "increase(node_traffic.forward.bytes{nodeid=\"$node_id\"}[24h])",
"hide": false,
"interval": "",
"legendFormat": "{{hostname}}",
"legendFormat": "forward 24h",
"refId": "A"
},
{
"exemplar": true,
"expr": "increase(node_traffic.rx.bytes{nodeid=\"$node_id\"}[24h])",
"interval": "",
"legendFormat": "rx 24h",
"refId": "B"
},
{
"exemplar": true,
"expr": "increase(node_traffic.tx.bytes{nodeid=\"$node_id\"}[24h])",
"hide": false,
"interval": "",
"legendFormat": "tx 24h",
"refId": "C"
},
{
"exemplar": true,
"expr": "increase(node_traffic.forward.bytes{nodeid=\"$node_id\"}[1h])",
"hide": false,
"interval": "",
"legendFormat": "forward 1h",
"refId": "D"
},
{
"exemplar": true,
"expr": "increase(node_traffic.rx.bytes{nodeid=\"$node_id\"}[1h])",
"hide": false,
"interval": "",
"legendFormat": "rx 1h",
"refId": "E"
},
{
"exemplar": true,
"expr": "increase(node_traffic.tx.bytes{nodeid=\"$node_id\"}[1h])",
"hide": false,
"interval": "",
"legendFormat": "tx 1h",
"refId": "F"
}
],
"title": "hostname",
"title": "Traffic",
"type": "stat"
},
{
@ -109,13 +333,16 @@
"viz": false
},
"lineInterpolation": "linear",
"lineStyle": {
"fill": "solid"
},
"lineWidth": 1,
"pointSize": 5,
"pointSize": 2,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
"spanNulls": false,
"showPoints": "always",
"spanNulls": 600000,
"stacking": {
"group": "A",
"mode": "none"
@ -124,31 +351,42 @@
"mode": "off"
}
},
"decimals": 0,
"mappings": [],
"max": 100,
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"unit": "percent"
},
"overrides": []
},
"gridPos": {
"h": 9,
"h": 22,
"w": 12,
"x": 0,
"y": 3
"x": 12,
"y": 8
},
"id": 2,
"id": 7,
"options": {
"legend": {
"calcs": [],
"displayMode": "hidden",
"calcs": [
"min",
"max",
"mean",
"lastNotNull"
],
"displayMode": "table",
"placement": "bottom"
},
"tooltip": {
@ -158,13 +396,14 @@
"targets": [
{
"exemplar": true,
"expr": "max_over_time(node_clients.total{nodeid=\"$node_id\"}[10m])",
"expr": "link_tq{source.id=\"$node_id\"}",
"interval": "",
"legendFormat": "",
"intervalFactor": 1,
"legendFormat": "to {{target.id}} {{target.hostname}}",
"refId": "A"
}
],
"title": "Connected clients",
"title": "Links zu anderen Knoten",
"type": "timeseries"
},
{
@ -172,28 +411,91 @@
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
"fixedColor": "dark-green",
"mode": "fixed"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "s"
},
"overrides": []
},
"gridPos": {
"h": 3,
"w": 12,
"x": 0,
"y": 15
},
"id": 13,
"options": {
"colorMode": "value",
"graphMode": "none",
"justifyMode": "auto",
"orientation": "auto",
"reduceOptions": {
"calcs": [
"lastNotNull"
],
"fields": "",
"values": false
},
"text": {},
"textMode": "auto"
},
"pluginVersion": "8.2.3",
"targets": [
{
"exemplar": true,
"expr": "vm_app_uptime_seconds{}",
"format": "time_series",
"interval": "",
"legendFormat": "",
"refId": "A"
}
],
"title": "Uptime",
"type": "stat"
},
{
"datasource": null,
"fieldConfig": {
"defaults": {
"color": {
"fixedColor": "orange",
"mode": "fixed"
},
"custom": {
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 0,
"fillOpacity": 20,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"lineInterpolation": "smooth",
"lineWidth": 2,
"pointSize": 1,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
"spanNulls": false,
"showPoints": "auto",
"spanNulls": 3600000,
"stacking": {
"group": "A",
"mode": "none"
@ -202,32 +504,41 @@
"mode": "off"
}
},
"decimals": 0,
"mappings": [],
"max": 1,
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "binBps"
}
},
"overrides": []
},
"gridPos": {
"h": 9,
"h": 5,
"w": 12,
"x": 0,
"y": 12
"y": 18
},
"id": 5,
"id": 9,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"calcs": [
"min",
"max",
"mean",
"lastNotNull"
],
"displayMode": "table",
"placement": "bottom"
},
"tooltip": {
@ -237,21 +548,132 @@
"targets": [
{
"exemplar": true,
"expr": "irate(node_traffic.rx.bytes{nodeid=\"$node_id\"})",
"expr": "node_load{nodeid=\"$node_id\"}",
"interval": "",
"legendFormat": "Traffic (in)",
"intervalFactor": 10,
"legendFormat": "load",
"refId": "A"
}
],
"title": "Load",
"type": "timeseries"
},
{
"datasource": null,
"fieldConfig": {
"defaults": {
"color": {
"fixedColor": "orange",
"mode": "fixed"
},
"custom": {
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 20,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "smooth",
"lineWidth": 2,
"pointSize": 1,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "auto",
"spanNulls": 3600000,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "deckbytes"
},
"overrides": [
{
"matcher": {
"id": "byFrameRefID",
"options": "A"
},
"properties": [
{
"id": "custom.fillOpacity",
"value": 0
},
{
"id": "color",
"value": {
"fixedColor": "dark-red",
"mode": "fixed"
}
}
]
}
]
},
"gridPos": {
"h": 7,
"w": 12,
"x": 0,
"y": 23
},
"id": 10,
"options": {
"legend": {
"calcs": [
"min",
"max",
"mean",
"lastNotNull"
],
"displayMode": "table",
"placement": "bottom"
},
"tooltip": {
"mode": "single"
}
},
"targets": [
{
"exemplar": true,
"expr": "node_memory.total{nodeid=\"$node_id\"}",
"interval": "",
"intervalFactor": 10,
"legendFormat": "total",
"refId": "A"
},
{
"exemplar": true,
"expr": "irate(node_traffic.tx.bytes{nodeid=\"$node_id\"})",
"expr": "node_memory.total{nodeid=\"$node_id\"}-node_memory.available{nodeid=\"$node_id\"}",
"hide": false,
"interval": "",
"legendFormat": "Traffic (out)",
"legendFormat": "used",
"refId": "B"
}
],
"title": "Traffic",
"title": "RAM",
"type": "timeseries"
}
],
@ -265,8 +687,8 @@
"allValue": null,
"current": {
"selected": false,
"text": "14cc202b86c0",
"value": "14cc202b86c0"
"text": "30b5c2cb6e20",
"value": "30b5c2cb6e20"
},
"datasource": null,
"definition": "label_values(nodeid)",
@ -285,6 +707,33 @@
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 5,
"type": "query"
},
{
"allValue": null,
"current": {
"selected": false,
"text": "BHC-West02-Outdoor",
"value": "BHC-West02-Outdoor"
},
"datasource": null,
"definition": "query_result( max by (hostname) (node_clients.total{nodeid=\"$node_id\"}[1y]) )",
"description": null,
"error": null,
"hide": 2,
"includeAll": false,
"label": null,
"multi": false,
"name": "hostname",
"options": [],
"query": {
"query": "query_result( max by (hostname) (node_clients.total{nodeid=\"$node_id\"}[1y]) )",
"refId": "StandardVariableQuery"
},
"refresh": 1,
"regex": "/hostname=\"(?<value>[^\"]+)/g",
"skipUrlSync": false,
"sort": 0,
"type": "query"
}
@ -298,5 +747,5 @@
"timezone": "",
"title": "Node (public)",
"uid": "KoKOqJc7k",
"version": 9
"version": 14
}

View File

@ -1,9 +0,0 @@
FROM golang:1.16-alpine as builder
RUN go get -v -u github.com/itskoko/prometheus-renderer@v0.0.5
FROM alpine:3.14
COPY --from=builder /go/bin/renderd /bin/renderd
ENTRYPOINT ["/bin/renderd"]

View File

@ -1,13 +0,0 @@
server {
listen 80;
server_name localhost;
location ~ /render/clients/(.*) {
proxy_pass "http://127.0.0.1:8080/?g0.expr=max_over_time(node_clients.total%7Bnodeid=%22$1%22%7D[30m])&width=650&height=350&g0.legend=Clients%20(total)";
}
location ~ /render/traffic/(.*) {
proxy_pass "http://127.0.0.1:8080/?g0.expr=irate(node_traffic.tx.bytes%7Bnodeid=%22$1%22%7D)&g1.expr=irate(node_traffic.rx.bytes%7Bnodeid=%22$1%22%7D)&width=650&height=350&g0.legend=Traffic%20(out)&g1.legend=Traffic%20(in)";
}
}

View File

@ -0,0 +1,18 @@
[main]
listen = ":8080"
prometheus-addr = "http://127.0.0.1:9090"
prometheus-path = "/api/v1/query_range"
timeout = "10s"
[template.default]
areaAlpha = "0.09"
areaMode = "all"
bgcolor = "ffffff"
fgcolor = "171819"
colorList = "7EB26D,EAB839,6ED0E0,EF843C,E24D42,1F78C1,BA43A9,705DA0,508642,CCA300,447EBC,C15C17,890F02,0A437C,6D1F62,584477,B7DBAB,F4D598,70DBED,F9BA8F,F29191,82B5D8,E5A8E2,AEA2E0,629E51,E5AC0E,64B0C8,E0752D,BF1B00,0A50A1,962D82,614D93,9AC48A,F2C96D,65C5DB,F9934E,EA6460,5195CE,D683CE,806EB7,3F6833,967302,2F575E,99440A,58140C,052B51,511749,3F2B5B,E0F9D7,FCEACA,CFFAFF,F9E2D2,FCE2DE,BADFF4,F9D9F9,DEDAF7"
fontName = "Roboto"
majorGridLineColor = "666666"
minorGridLineColor = "666666"
fontSize = "12.0"
lineWidth = "2.0"
xFormat = "%H:%M"

View File

@ -0,0 +1,13 @@
server {
listen 80;
server_name localhost;
location ~ /render/clients/(.*) {
proxy_pass "http://127.0.0.1:8080/?g0.expr=max_over_time(node_clients.total%7Bnodeid=%22$1%22%7D[30m])&width=507&height=250&g0.legend=Clients%20(total)&yMin=0.0&yMin=0.0&minorY=0&yStep=1&valueLabels=none";
}
location ~ /render/traffic/(.*) {
proxy_pass "http://127.0.0.1:8080/?g0.expr=irate(node_traffic.forward.bytes%7Bnodeid=%22$1%22%7D)&g1.expr=irate(node_traffic.rx.bytes%7Bnodeid=%22$1%22%7D)&g2.expr=irate(node_traffic.tx.bytes%7Bnodeid=%22$1%22%7D)&width=507&height=250&g0.legend=Traffic%20(forward)&g1.legend=Traffic%20(rx)&g2.legend=Traffic%20(tx)&unitSystem=binary";
}
}