Compare commits
No commits in common. "d1634167581e239ebf68162808d14ae89ffe8abf" and "db9ce2b538052ed872685e1982d75c7c3e8499fe" have entirely different histories.
d163416758
...
db9ce2b538
|
|
@ -1,271 +0,0 @@
|
||||||
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": 3,
|
|
||||||
"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": 4, "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": 5, "x": 4, "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": "Tunnel Uptime",
|
|
||||||
"type": "stat",
|
|
||||||
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
|
||||||
"gridPos": {"h": 4, "w": 5, "x": 9, "y": 1},
|
|
||||||
"fieldConfig": {
|
|
||||||
"defaults": {
|
|
||||||
"unit": "s",
|
|
||||||
"color": {"mode": "fixed", "fixedColor": "blue"}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"options": {
|
|
||||||
"graphMode": "none",
|
|
||||||
"colorMode": "value",
|
|
||||||
"textMode": "auto",
|
|
||||||
"reduceOptions": {"values": false, "calcs": ["lastNotNull"]}
|
|
||||||
},
|
|
||||||
"targets": [
|
|
||||||
{"expr": "time() - kube_pod_start_time{namespace=\"wireguard\", pod=~\"wireguard-.*\"}", "legendFormat": "Uptime", "refId": "A"}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"title": "FritzBox Peer Status",
|
|
||||||
"type": "stat",
|
|
||||||
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
|
||||||
"gridPos": {"h": 4, "w": 5, "x": 14, "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": 5, "x": 19, "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": "Interface Status Timeline",
|
|
||||||
"type": "state-timeline",
|
|
||||||
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
|
||||||
"gridPos": {"h": 4, "w": 24, "x": 0, "y": 5},
|
|
||||||
"fieldConfig": {
|
|
||||||
"defaults": {
|
|
||||||
"mappings": [
|
|
||||||
{"type": "value", "options": {"0": {"text": "DOWN", "color": "red"}, "1": {"text": "UP", "color": "green"}}}
|
|
||||||
],
|
|
||||||
"color": {"mode": "thresholds"},
|
|
||||||
"custom": {
|
|
||||||
"fillOpacity": 70,
|
|
||||||
"lineWidth": 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"options": {
|
|
||||||
"showValue": "never",
|
|
||||||
"tooltip": {"mode": "single"},
|
|
||||||
"legend": {"showLegend": true, "displayMode": "list"}
|
|
||||||
},
|
|
||||||
"targets": [
|
|
||||||
{"expr": "count(wireguard_sent_bytes_total{interface=\"wg0\"}) or on() vector(0)", "legendFormat": "wg0 Status", "refId": "A"}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"title": "📊 Traffic & Performance",
|
|
||||||
"type": "row",
|
|
||||||
"gridPos": {"h": 1, "w": 24, "x": 0, "y": 9},
|
|
||||||
"collapsed": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"title": "FritzBox Traffic Rate",
|
|
||||||
"type": "timeseries",
|
|
||||||
"datasource": {"type": "prometheus", "uid": "prometheus"},
|
|
||||||
"gridPos": {"h": 10, "w": 24, "x": 0, "y": 10},
|
|
||||||
"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": 20},
|
|
||||||
"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": 20},
|
|
||||||
"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"}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
@ -7,8 +7,6 @@ metadata:
|
||||||
app: wireguard
|
app: wireguard
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
strategy:
|
|
||||||
type: Recreate
|
|
||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
app: wireguard
|
app: wireguard
|
||||||
|
|
@ -27,7 +25,6 @@ spec:
|
||||||
apk add --no-cache wireguard-tools iptables
|
apk add --no-cache wireguard-tools iptables
|
||||||
cp /config/wg0.conf /etc/wireguard/wg0.conf
|
cp /config/wg0.conf /etc/wireguard/wg0.conf
|
||||||
chmod 600 /etc/wireguard/wg0.conf
|
chmod 600 /etc/wireguard/wg0.conf
|
||||||
wg-quick down wg0 || true
|
|
||||||
wg-quick up wg0
|
wg-quick up wg0
|
||||||
echo "Wireguard is up"
|
echo "Wireguard is up"
|
||||||
trap "wg-quick down wg0" SIGINT SIGTERM
|
trap "wg-quick down wg0" SIGINT SIGTERM
|
||||||
|
|
@ -47,25 +44,6 @@ spec:
|
||||||
- name: lib-modules
|
- name: lib-modules
|
||||||
mountPath: /lib/modules
|
mountPath: /lib/modules
|
||||||
readOnly: true
|
readOnly: true
|
||||||
- name: exporter
|
|
||||||
image: mindflavor/prometheus-wireguard-exporter:latest
|
|
||||||
args:
|
|
||||||
- "-n"
|
|
||||||
- "/config/wg0.conf"
|
|
||||||
ports:
|
|
||||||
- name: http-metrics
|
|
||||||
containerPort: 9586
|
|
||||||
protocol: TCP
|
|
||||||
securityContext:
|
|
||||||
runAsUser: 0
|
|
||||||
capabilities:
|
|
||||||
add:
|
|
||||||
- NET_ADMIN
|
|
||||||
volumeMounts:
|
|
||||||
- name: wg-config
|
|
||||||
mountPath: /config/wg0.conf
|
|
||||||
subPath: wg0.conf
|
|
||||||
readOnly: true
|
|
||||||
volumes:
|
volumes:
|
||||||
- name: wg-config
|
- name: wg-config
|
||||||
secret:
|
secret:
|
||||||
|
|
|
||||||
|
|
@ -7,4 +7,3 @@ resources:
|
||||||
- namespace.yaml
|
- namespace.yaml
|
||||||
- secret.secret.yaml
|
- secret.secret.yaml
|
||||||
- deployment.yaml
|
- deployment.yaml
|
||||||
- monitoring.yaml
|
|
||||||
|
|
|
||||||
|
|
@ -1,71 +0,0 @@
|
||||||
apiVersion: v1
|
|
||||||
kind: Service
|
|
||||||
metadata:
|
|
||||||
name: wireguard-exporter
|
|
||||||
namespace: wireguard
|
|
||||||
labels:
|
|
||||||
app: wireguard
|
|
||||||
spec:
|
|
||||||
ports:
|
|
||||||
- name: http-metrics
|
|
||||||
port: 9586
|
|
||||||
targetPort: 9586
|
|
||||||
protocol: TCP
|
|
||||||
selector:
|
|
||||||
app: wireguard
|
|
||||||
---
|
|
||||||
apiVersion: monitoring.coreos.com/v1
|
|
||||||
kind: ServiceMonitor
|
|
||||||
metadata:
|
|
||||||
name: wireguard
|
|
||||||
namespace: wireguard
|
|
||||||
labels:
|
|
||||||
release: prometheus-operator
|
|
||||||
spec:
|
|
||||||
selector:
|
|
||||||
matchLabels:
|
|
||||||
app: wireguard
|
|
||||||
namespaceSelector:
|
|
||||||
matchNames:
|
|
||||||
- wireguard
|
|
||||||
endpoints:
|
|
||||||
- port: http-metrics
|
|
||||||
path: /metrics
|
|
||||||
interval: 30s
|
|
||||||
scrapeTimeout: 10s
|
|
||||||
---
|
|
||||||
apiVersion: monitoring.coreos.com/v1
|
|
||||||
kind: PrometheusRule
|
|
||||||
metadata:
|
|
||||||
name: wireguard-alerts
|
|
||||||
namespace: wireguard
|
|
||||||
labels:
|
|
||||||
release: prometheus-operator
|
|
||||||
spec:
|
|
||||||
groups:
|
|
||||||
- name: wireguard.rules
|
|
||||||
rules:
|
|
||||||
- alert: WireguardExporterDown
|
|
||||||
expr: up{job="wireguard-exporter"} == 0
|
|
||||||
for: 5m
|
|
||||||
labels:
|
|
||||||
severity: critical
|
|
||||||
annotations:
|
|
||||||
summary: "WireGuard exporter is down"
|
|
||||||
description: "The WireGuard Prometheus exporter is unreachable. The pod may have crashed or is unresponsive."
|
|
||||||
- alert: WireguardInterfaceDown
|
|
||||||
expr: absent(wireguard_sent_bytes_total{interface="wg0"}) == 1
|
|
||||||
for: 5m
|
|
||||||
labels:
|
|
||||||
severity: critical
|
|
||||||
annotations:
|
|
||||||
summary: "WireGuard interface wg0 is down"
|
|
||||||
description: "The WireGuard interface wg0 is not reporting any statistics. The VPN tunnel might be down or inactive."
|
|
||||||
- alert: WireguardPeerOffline
|
|
||||||
expr: (time() - wireguard_latest_handshake_seconds{interface="wg0"}) > 300
|
|
||||||
for: 5m
|
|
||||||
labels:
|
|
||||||
severity: critical
|
|
||||||
annotations:
|
|
||||||
summary: "WireGuard peer {{ $labels.friendly_name }} offline"
|
|
||||||
description: "No handshake received for WireGuard peer {{ $labels.friendly_name }} ({{ $labels.public_key }}) on device {{ $labels.interface }} for more than 5 minutes."
|
|
||||||
Binary file not shown.
|
|
@ -17,7 +17,7 @@ variable "sensor_innen_mac" {
|
||||||
variable "taupunktschwelle" {
|
variable "taupunktschwelle" {
|
||||||
type = number
|
type = number
|
||||||
description = "Dew point difference threshold [°C] to trigger the fan (indoor_dp > outdoor_dp + threshold)"
|
description = "Dew point difference threshold [°C] to trigger the fan (indoor_dp > outdoor_dp + threshold)"
|
||||||
default = 2
|
default = 4
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "mindesttemperatur" {
|
variable "mindesttemperatur" {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue