infrapuzzle/k8s/monitoring/dashboards/grafana-dashboard-wireguard...

225 lines
7.8 KiB
YAML

apiVersion: v1
kind: ConfigMap
metadata:
name: grafana-dashboard-wireguard
namespace: monitoring
labels:
grafana_dashboard: '1'
annotations:
grafana_dashboard_folder: 🏠 Home
data:
wireguard.json: |
{
"uid": "wireguard",
"title": "🛡️ WireGuard VPN",
"tags": ["network", "vpn", "infrastructure", "prometheus"],
"timezone": "browser",
"schemaVersion": 39,
"version": 2,
"refresh": "10s",
"editable": false,
"graphTooltip": 2,
"time": {
"from": "now-24h",
"to": "now"
},
"panels": [
{
"title": "⚡ VPN Status",
"type": "row",
"gridPos": {"h": 1, "w": 24, "x": 0, "y": 0},
"collapsed": false
},
{
"title": "Exporter Status",
"type": "stat",
"datasource": {"type": "prometheus", "uid": "prometheus"},
"gridPos": {"h": 4, "w": 6, "x": 0, "y": 1},
"fieldConfig": {
"defaults": {
"mappings": [
{"type": "value", "options": {"0": {"text": "OFFLINE", "color": "red"}, "1": {"text": "ONLINE", "color": "green"}}}
],
"color": {"mode": "thresholds"}
}
},
"options": {
"graphMode": "none",
"colorMode": "background",
"textMode": "auto",
"reduceOptions": {"values": false, "calcs": ["lastNotNull"]}
},
"targets": [
{"expr": "up{job=\"wireguard-exporter\"}", "legendFormat": "Exporter Connectivity", "refId": "A"}
]
},
{
"title": "Interface wg0",
"type": "stat",
"datasource": {"type": "prometheus", "uid": "prometheus"},
"gridPos": {"h": 4, "w": 6, "x": 6, "y": 1},
"fieldConfig": {
"defaults": {
"mappings": [
{"type": "value", "options": {"0": {"text": "DOWN", "color": "red"}, "1": {"text": "UP", "color": "green"}}}
],
"color": {"mode": "thresholds"}
}
},
"options": {
"graphMode": "none",
"colorMode": "background",
"textMode": "auto",
"reduceOptions": {"values": false, "calcs": ["lastNotNull"]}
},
"targets": [
{"expr": "count(wireguard_sent_bytes_total{interface=\"wg0\"}) or on() vector(0)", "legendFormat": "wg0 Status", "refId": "A"}
]
},
{
"title": "FritzBox Peer Status",
"type": "stat",
"datasource": {"type": "prometheus", "uid": "prometheus"},
"gridPos": {"h": 4, "w": 6, "x": 12, "y": 1},
"fieldConfig": {
"defaults": {
"mappings": [
{"type": "value", "options": {"0": {"text": "DISCONNECTED", "color": "red"}, "1": {"text": "CONNECTED", "color": "green"}}}
],
"color": {"mode": "thresholds"}
}
},
"options": {
"graphMode": "none",
"colorMode": "background",
"textMode": "auto",
"reduceOptions": {"values": false, "calcs": ["lastNotNull"]}
},
"targets": [
{"expr": "(time() - wireguard_latest_handshake_seconds{interface=\"wg0\"} < 300) or on() vector(0)", "legendFormat": "Peer Connectivity", "refId": "A"}
]
},
{
"title": "FritzBox Last Handshake",
"type": "stat",
"datasource": {"type": "prometheus", "uid": "prometheus"},
"gridPos": {"h": 4, "w": 6, "x": 18, "y": 1},
"fieldConfig": {
"defaults": {
"unit": "s",
"color": {"mode": "thresholds"},
"thresholds": {
"mode": "absolute",
"steps": [
{"color": "green", "value": null},
{"color": "orange", "value": 300},
{"color": "red", "value": 600}
]
}
}
},
"options": {
"graphMode": "none",
"colorMode": "value",
"textMode": "auto",
"reduceOptions": {"values": false, "calcs": ["lastNotNull"]}
},
"targets": [
{"expr": "time() - wireguard_latest_handshake_seconds{interface=\"wg0\"}", "legendFormat": "Handshake Delay", "refId": "A"}
]
},
{
"title": "📊 Traffic & Performance",
"type": "row",
"gridPos": {"h": 1, "w": 24, "x": 0, "y": 5},
"collapsed": false
},
{
"title": "FritzBox Traffic Rate",
"type": "timeseries",
"datasource": {"type": "prometheus", "uid": "prometheus"},
"gridPos": {"h": 10, "w": 24, "x": 0, "y": 6},
"fieldConfig": {
"defaults": {
"unit": "Bps",
"custom": {
"lineWidth": 2,
"fillOpacity": 10,
"spanNulls": true,
"showPoints": "never"
}
},
"overrides": [
{
"matcher": {"id": "byName", "options": "Received (Rx)"},
"properties": [
{"id": "color", "value": {"fixedColor": "#4CAF50", "mode": "fixed"}}
]
},
{
"matcher": {"id": "byName", "options": "Sent (Tx)"},
"properties": [
{"id": "color", "value": {"fixedColor": "#2196F3", "mode": "fixed"}}
]
}
]
},
"options": {
"legend": {"displayMode": "table", "placement": "bottom", "calcs": ["lastNotNull", "mean", "max"]},
"tooltip": {"mode": "multi", "sort": "desc"}
},
"targets": [
{"expr": "rate(wireguard_received_bytes_total{interface=\"wg0\"}[5m])", "legendFormat": "Received (Rx)", "refId": "A"},
{"expr": "rate(wireguard_sent_bytes_total{interface=\"wg0\"}[5m])", "legendFormat": "Sent (Tx)", "refId": "B"}
]
},
{
"title": "Total Data Transferred",
"type": "stat",
"datasource": {"type": "prometheus", "uid": "prometheus"},
"gridPos": {"h": 5, "w": 12, "x": 0, "y": 16},
"fieldConfig": {
"defaults": {
"unit": "bytes",
"color": {"mode": "palette-classic"}
}
},
"options": {
"graphMode": "none",
"colorMode": "value",
"textMode": "auto",
"reduceOptions": {"values": true, "calcs": ["lastNotNull"]}
},
"targets": [
{"expr": "wireguard_received_bytes_total{interface=\"wg0\"}", "legendFormat": "Total Received (Rx)", "refId": "A"},
{"expr": "wireguard_sent_bytes_total{interface=\"wg0\"}", "legendFormat": "Total Sent (Tx)", "refId": "B"}
]
},
{
"title": "Handshake Delay History",
"type": "timeseries",
"datasource": {"type": "prometheus", "uid": "prometheus"},
"gridPos": {"h": 5, "w": 12, "x": 12, "y": 16},
"fieldConfig": {
"defaults": {
"unit": "s",
"custom": {
"lineWidth": 2,
"fillOpacity": 5,
"spanNulls": true,
"showPoints": "never"
},
"color": {"mode": "fixed", "fixedColor": "#FF9800"}
}
},
"options": {
"legend": {"displayMode": "list", "placement": "bottom", "calcs": ["lastNotNull", "max"]},
"tooltip": {"mode": "single"}
},
"targets": [
{"expr": "time() - wireguard_latest_handshake_seconds{interface=\"wg0\"}", "legendFormat": "Handshake Delay", "refId": "A"}
]
}
]
}