From 198dc6eb2e6fbae638f033e9d490b62143092971 Mon Sep 17 00:00:00 2001 From: Robert Rapp Date: Tue, 3 Nov 2026 18:20:33 +0100 Subject: [PATCH] Arlo-Kameras: Pushgateway (v1.11.5, :9091), Scrape-Job, 4 Alerts + Healer-notify, Dashboard arlo-kameras Kiosk-Watchdog gode-pc-02 schiebt 4x taeglich Akku, Online-Status, Preview-Streaming und Verbrauchsmodell (job=arlo). Freigabe R. Rapp 03.11. --- config/healer-rules.yaml | 21 + deploy/compose/infra/docker-compose.yml | 17 + deploy/grafana/dashboards/arlo-kameras.json | 712 ++++++++++++++++++ .../provisioning/dashboards/knaster.yml | 1 + deploy/prometheus/alerts.yml | 30 + deploy/prometheus/prometheus.yml | 6 + 6 files changed, 787 insertions(+) create mode 100644 deploy/grafana/dashboards/arlo-kameras.json diff --git a/config/healer-rules.yaml b/config/healer-rules.yaml index f1aff71..31a3c10 100644 --- a/config/healer-rules.yaml +++ b/config/healer-rules.yaml @@ -72,3 +72,24 @@ rules: match: {alertname: K3sContainerMemoryNearLimit} ladder: - {action: notify, params: {text: "{namespace}/{pod} ({container}) über 90 % des Speicherlimits", severity: warning}, attempts: 1} + + # Arlo-Kameras (03.11.): nur melden; Akku tauschen/laden geht nur vor Ort + - id: arlo-battery-low + match: {alertname: ArloBatteryLow} + ladder: + - {action: notify, params: {text: "Arlo {camera}: Akku unter 20 % – Laden/Tausch planen (Dashboard arlo-kameras)", severity: warning}, attempts: 1} + + - id: arlo-camera-offline + match: {alertname: ArloCameraOffline} + ladder: + - {action: notify, params: {text: "Arlo {camera} seit über 2 h offline – Akku/LTE prüfen", severity: warning}, attempts: 1} + + - id: arlo-battery-drain-high + match: {alertname: ArloBatteryDrainHigh} + ladder: + - {action: notify, params: {text: "Arlo {camera} verbraucht deutlich mehr Akku als erwartet (24 h)", severity: warning}, attempts: 1} + + - id: arlo-measurement-stale + match: {alertname: ArloMeasurementStale} + ladder: + - {action: notify, params: {text: "Akku-Messung von {instance} ausgeblieben – Kiosk-Watchdog gode-pc-02 prüfen", severity: warning}, attempts: 1} diff --git a/deploy/compose/infra/docker-compose.yml b/deploy/compose/infra/docker-compose.yml index 8ee4fbd..5521c01 100644 --- a/deploy/compose/infra/docker-compose.yml +++ b/deploy/compose/infra/docker-compose.yml @@ -87,6 +87,22 @@ services: resources: limits: {cpus: "0.5", memory: 64M} + # Arlo-Kameras (03.11.): Der Kiosk-Watchdog auf gode-pc-02 schiebt 4× täglich Akkustand, Online-Status, + # Preview-Streaming und das Verbrauchsmodell hierher (PUT, Gruppe job=arlo/instance=gode-pc-02). So braucht der + # PC keinen offenen Port. Nur LAN, ohne Anmeldung wie Prometheus. /pushgateway gehört im Image nobody. + pushgateway: + <<: *restart + image: prom/pushgateway:v1.11.5 + command: + - --persistence.file=/pushgateway/metrics.db + - --persistence.interval=5m + volumes: + - pushgateway:/pushgateway + ports: ["9091:9091"] + deploy: + resources: + limits: {cpus: "0.25", memory: 64M} + alertmanager: <<: *restart image: prom/alertmanager:v0.34.1 @@ -151,3 +167,4 @@ volumes: prometheus: {} alertmanager: {} grafana: {} + pushgateway: {} diff --git a/deploy/grafana/dashboards/arlo-kameras.json b/deploy/grafana/dashboards/arlo-kameras.json new file mode 100644 index 0000000..429406f --- /dev/null +++ b/deploy/grafana/dashboards/arlo-kameras.json @@ -0,0 +1,712 @@ +{ + "uid": "arlo-kameras", + "title": "Arlo-Kameras – Akku und Verbrauch", + "tags": [ + "knaster", + "arlo", + "kiosk" + ], + "description": "Akku, Verbrauch und Prognose der Arlo-Kameras (Messung durch den Kiosk-Watchdog auf gode-pc-02, seit 03.11.2026)", + "timezone": "browser", + "schemaVersion": 39, + "version": 1, + "editable": false, + "refresh": "5m", + "time": { + "from": "now-7d", + "to": "now" + }, + "templating": { + "list": [] + }, + "annotations": { + "list": [] + }, + "panels": [ + { + "id": 1, + "type": "text", + "title": "Hinweise", + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "gridPos": { + "x": 0, + "y": 0, + "w": 24, + "h": 3 + }, + "targets": [], + "options": { + "mode": "markdown", + "content": "Der Kiosk-Watchdog auf **gode-pc-02** liest den Akku der Online-Kameras **4× täglich** aus (07:45, 12:15, 17:45, 03:00): Zahnrad, dann *Device Settings*, dann *Battery*. Danach schiebt er die Werte an den Pushgateway auf infra. Offline-Kameras erscheinen nur in der Statusliste. **Tag** = 07:45–17:45, **Nacht** = 17:45–07:45. **Erwartet** rechnet mit dem Grundverbrauch aus Abschnitten ohne Streaming plus den Kosten je Minute Preview-Streaming. Das Modell wird aus den Messungen gelernt, die älter als 24 h sind, und erst nach ein paar Tagen belastbar. Live-Ansehen von Hand wird nicht gezählt und taucht deshalb als Mehrverbrauch auf. Quelle: `C:\\Android\\arlo-battery.csv` auf gode-pc-02." + } + }, + { + "id": 2, + "type": "bargauge", + "title": "Akkustand jetzt", + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "gridPos": { + "x": 0, + "y": 3, + "w": 12, + "h": 8 + }, + "targets": [ + { + "refId": "A", + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "expr": "arlo_battery_percent{job=\"arlo\"}", + "legendFormat": "{{camera}}", + "instant": true, + "range": false + } + ], + "options": { + "orientation": "horizontal", + "displayMode": "gradient", + "showUnfilled": true, + "valueMode": "color", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + } + }, + "fieldConfig": { + "defaults": { + "unit": "percent", + "min": 0, + "max": 100, + "decimals": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "red", + "value": null + }, + { + "color": "orange", + "value": 20 + }, + { + "color": "green", + "value": 40 + } + ] + } + }, + "overrides": [] + } + }, + { + "id": 3, + "type": "stat", + "title": "Akku leer am (Prognose, Verbrauch 7 Tage)", + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "gridPos": { + "x": 12, + "y": 3, + "w": 8, + "h": 8 + }, + "targets": [ + { + "refId": "A", + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "expr": "(time() + arlo_battery_percent{job=\"arlo\"} / (arlo_battery_drain_percent_per_day{job=\"arlo\"} > 0.05) * 86400) * 1000", + "legendFormat": "{{camera}}", + "instant": true, + "range": false + } + ], + "description": "Linear: aktueller Akkustand geteilt durch den mittleren Verbrauch der letzten 7 Tage (Ladevorgänge ausgenommen). Leer = noch kein messbarer Verbrauch.", + "options": { + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "orientation": "horizontal", + "textMode": "value_and_name", + "colorMode": "value", + "graphMode": "none", + "justifyMode": "auto" + }, + "fieldConfig": { + "defaults": { + "unit": "dateTimeAsLocalNoDateIfToday", + "color": { + "mode": "fixed", + "fixedColor": "text" + } + }, + "overrides": [] + } + }, + { + "id": 4, + "type": "stat", + "title": "Letzte Messung vor", + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "gridPos": { + "x": 20, + "y": 3, + "w": 4, + "h": 8 + }, + "targets": [ + { + "refId": "A", + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "expr": "time() - push_time_seconds{job=\"arlo\"}", + "legendFormat": "gode-pc-02", + "instant": true, + "range": false + } + ], + "description": "Zeit seit dem letzten Push von gode-pc-02. Die längste planmäßige Lücke ist 17:45 → 03:00 (9 h 15 min). Rot ab 13 h.", + "options": { + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "colorMode": "background", + "graphMode": "none", + "textMode": "value" + }, + "fieldConfig": { + "defaults": { + "unit": "s", + "decimals": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 46800 + } + ] + } + }, + "overrides": [] + } + }, + { + "id": 5, + "type": "timeseries", + "title": "Akkustand Verlauf", + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "gridPos": { + "x": 0, + "y": 11, + "w": 24, + "h": 9 + }, + "targets": [ + { + "refId": "A", + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "expr": "arlo_battery_percent{job=\"arlo\"}", + "legendFormat": "{{camera}}" + } + ], + "fieldConfig": { + "defaults": { + "unit": "percent", + "min": 0, + "max": 100, + "custom": { + "lineInterpolation": "stepAfter", + "lineWidth": 2, + "showPoints": "never", + "spanNulls": true + }, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "red", + "value": null + }, + { + "color": "transparent", + "value": 20 + } + ] + }, + "color": { + "mode": "palette-classic" + } + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "table", + "placement": "right", + "calcs": [ + "lastNotNull", + "min" + ] + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + } + }, + { + "id": 6, + "type": "bargauge", + "title": "Verbrauch Tag / Nacht (% je Stunde, 7 Tage)", + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "gridPos": { + "x": 0, + "y": 20, + "w": 10, + "h": 9 + }, + "targets": [ + { + "refId": "A", + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "expr": "arlo_battery_drain_percent_per_hour{job=\"arlo\"}", + "legendFormat": "{{camera}} {{period}}", + "instant": true, + "range": false + } + ], + "description": "Akkuabnahme je Stunde, getrennt nach Tag (07:45–17:45) und Nacht (17:45–07:45). Abschnitte mit Laden werden nicht gezählt.", + "options": { + "orientation": "horizontal", + "displayMode": "basic", + "showUnfilled": true, + "valueMode": "color", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + } + }, + "fieldConfig": { + "defaults": { + "unit": "percent", + "decimals": 2, + "min": 0, + "color": { + "mode": "fixed", + "fixedColor": "blue" + } + }, + "overrides": [] + } + }, + { + "id": 7, + "type": "bargauge", + "title": "Erwartet vs. tatsächlich (letzte 24 h, % Akku)", + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "gridPos": { + "x": 10, + "y": 20, + "w": 9, + "h": 9 + }, + "targets": [ + { + "refId": "A", + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "expr": "arlo_battery_24h_actual_percent{job=\"arlo\"}", + "legendFormat": "{{camera}} tatsächlich", + "instant": true, + "range": false + }, + { + "refId": "B", + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "expr": "arlo_battery_24h_expected_percent{job=\"arlo\"}", + "legendFormat": "{{camera}} erwartet", + "instant": true, + "range": false + } + ], + "description": "Erwartet = Grundverbrauch × Stunden + Kosten je Streaming-Minute × Minuten Preview-Streaming. Das Modell lernt nur aus Messungen, die älter als 24 h sind. Fehlt der Balken, sind es noch zu wenige Daten.", + "options": { + "orientation": "horizontal", + "displayMode": "basic", + "showUnfilled": true, + "valueMode": "color", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + } + }, + "fieldConfig": { + "defaults": { + "unit": "percent", + "decimals": 1, + "min": 0, + "color": { + "mode": "fixed", + "fixedColor": "text" + } + }, + "overrides": [ + { + "matcher": { + "id": "byRegexp", + "options": ".*tatsächlich" + }, + "properties": [ + { + "id": "color", + "value": { + "mode": "fixed", + "fixedColor": "orange" + } + } + ] + }, + { + "matcher": { + "id": "byRegexp", + "options": ".*erwartet" + }, + "properties": [ + { + "id": "color", + "value": { + "mode": "fixed", + "fixedColor": "blue" + } + } + ] + } + ] + } + }, + { + "id": 8, + "type": "stat", + "title": "Mehrverbrauch 24 h", + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "gridPos": { + "x": 19, + "y": 20, + "w": 5, + "h": 9 + }, + "targets": [ + { + "refId": "A", + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "expr": "arlo_battery_24h_actual_percent{job=\"arlo\"} - arlo_battery_24h_expected_percent{job=\"arlo\"}", + "legendFormat": "{{camera}}", + "instant": true, + "range": false + } + ], + "description": "Tatsächlich minus erwartet. Orange ab 1 %, rot ab 3 % Akku über der Erwartung, z. B. durch viel Live-Ansehen von Hand, Bewegungsaufnahmen, schwaches LTE oder einen alternden Akku.", + "options": { + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "colorMode": "background", + "graphMode": "none", + "textMode": "value_and_name", + "orientation": "horizontal" + }, + "fieldConfig": { + "defaults": { + "unit": "percent", + "decimals": 1, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "orange", + "value": 1 + }, + { + "color": "red", + "value": 3 + } + ] + } + }, + "overrides": [] + } + }, + { + "id": 9, + "type": "stat", + "title": "Kameras", + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "gridPos": { + "x": 0, + "y": 29, + "w": 8, + "h": 8 + }, + "targets": [ + { + "refId": "A", + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "expr": "arlo_camera_online{job=\"arlo\"}", + "legendFormat": "{{camera}}", + "instant": true, + "range": false + } + ], + "description": "Stand der letzten Messung. Offline-Kameras sind grau und lösen keine Warnung aus.", + "options": { + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "colorMode": "background", + "graphMode": "none", + "textMode": "value_and_name", + "orientation": "horizontal", + "justifyMode": "auto" + }, + "fieldConfig": { + "defaults": { + "mappings": [ + { + "type": "value", + "options": { + "0": { + "text": "offline", + "color": "#4a4a4a" + }, + "1": { + "text": "online", + "color": "green" + } + } + } + ], + "color": { + "mode": "thresholds" + }, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "#4a4a4a", + "value": null + }, + { + "color": "green", + "value": 1 + } + ] + } + }, + "overrides": [] + } + }, + { + "id": 10, + "type": "bargauge", + "title": "Preview-Streaming (Sekunden, 24 h)", + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "gridPos": { + "x": 8, + "y": 29, + "w": 8, + "h": 8 + }, + "targets": [ + { + "refId": "A", + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "expr": "increase(arlo_preview_stream_seconds_total{job=\"arlo\"}[24h])", + "legendFormat": "{{camera}}", + "instant": true, + "range": false + } + ], + "description": "Streaming-Sekunden, die der Preview-Refresh (alle 90 min, 08:00–17:30) je Kamera verursacht hat.", + "options": { + "orientation": "horizontal", + "displayMode": "basic", + "showUnfilled": true, + "valueMode": "color", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + } + }, + "fieldConfig": { + "defaults": { + "unit": "s", + "decimals": 0, + "min": 0, + "color": { + "mode": "fixed", + "fixedColor": "purple" + } + }, + "overrides": [] + } + }, + { + "id": 11, + "type": "bargauge", + "title": "Modell: Grundverbrauch (% je Tag)", + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "gridPos": { + "x": 16, + "y": 29, + "w": 8, + "h": 8 + }, + "targets": [ + { + "refId": "A", + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "expr": "arlo_battery_model_base_percent_per_day{job=\"arlo\"}", + "legendFormat": "{{camera}} Grund", + "instant": true, + "range": false + }, + { + "refId": "B", + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "expr": "arlo_battery_model_stream_percent_per_minute{job=\"arlo\"}", + "legendFormat": "{{camera}} je Stream-Min.", + "instant": true, + "range": false + } + ], + "description": "Gelernte Werte: Grundverbrauch aus Abschnitten ohne Streaming, Zusatz je Minute Preview-Streaming.", + "options": { + "orientation": "horizontal", + "displayMode": "basic", + "showUnfilled": false, + "valueMode": "color", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + } + }, + "fieldConfig": { + "defaults": { + "unit": "percent", + "decimals": 2, + "min": 0, + "color": { + "mode": "fixed", + "fixedColor": "blue" + } + }, + "overrides": [] + } + } + ] +} diff --git a/deploy/grafana/provisioning/dashboards/knaster.yml b/deploy/grafana/provisioning/dashboards/knaster.yml index 47c606c..6c3e426 100644 --- a/deploy/grafana/provisioning/dashboards/knaster.yml +++ b/deploy/grafana/provisioning/dashboards/knaster.yml @@ -5,6 +5,7 @@ # nvidia-gpu.json ID 14574 „Nvidia GPU Metrics“ Revision 15 (für utkuozdemir/nvidia_gpu_exporter) # knaster-uebersicht.json eigenes Dashboard (Startseite, für den Kiosk in Task 5.3) # k3s-pods.json eigenes Dashboard (Task 6.5): Pods je Namespace (Vorgabe nex), kube-state-metrics + cAdvisor +# arlo-kameras.json eigenes Dashboard (03.11.): Akku/Verbrauch der Arlo-Kameras (Pushgateway, Kiosk gode-pc-02) apiVersion: 1 providers: - name: knaster diff --git a/deploy/prometheus/alerts.yml b/deploy/prometheus/alerts.yml index 13738af..0ff5ffa 100644 --- a/deploy/prometheus/alerts.yml +++ b/deploy/prometheus/alerts.yml @@ -57,6 +57,36 @@ groups: labels: {severity: warning} annotations: {summary: "Hindsight-Gate (LXC hindsight, 192.168.100.185:8888/health) antwortet nicht"} + # Arlo-Kameras (03.11.): Werte vom Kiosk-Watchdog gode-pc-02 über den Pushgateway, 4× täglich. Nur melden + # (Healer-Aktion notify). Offline-Kameras, die nie online gemessen wurden (BAC 01, KOE), haben keine + # offline_since-Reihe und lösen nichts aus. + - name: knaster-arlo + rules: + - alert: ArloBatteryLow + expr: arlo_battery_percent{job="arlo"} < 20 and on (camera) arlo_camera_online{job="arlo"} == 1 + for: 10m + labels: {severity: warning} + annotations: {summary: "Arlo {{ $labels.camera }}: Akku {{ $value }} % – laden/tauschen planen"} + + - alert: ArloCameraOffline + expr: (time() - arlo_camera_offline_since_timestamp_seconds{job="arlo"}) > 7200 + for: 10m + labels: {severity: warning} + annotations: {summary: "Arlo {{ $labels.camera }} seit über 2 h offline"} + + - alert: ArloBatteryDrainHigh + expr: (arlo_battery_24h_actual_percent{job="arlo"} - arlo_battery_24h_expected_percent{job="arlo"}) > 3 + for: 10m + labels: {severity: warning} + annotations: {summary: "Arlo {{ $labels.camera }}: {{ $value | printf \"%.1f\" }} % Akku mehr verbraucht als erwartet (24 h)"} + + - alert: ArloMeasurementStale + # längste planmäßige Lücke 17:45 → 03:00 = 9 h 15 min + expr: (time() - push_time_seconds{job="arlo"}) > 46800 + for: 10m + labels: {severity: warning} + annotations: {summary: "Akku-Messung von {{ $labels.instance }} seit über 13 h ausgeblieben – Kiosk-Watchdog prüfen"} + # k3s (Task 6.5): nur melden, der Healer greift nicht ein (config/healer-rules.yaml, Aktion notify) - name: knaster-k3s rules: diff --git a/deploy/prometheus/prometheus.yml b/deploy/prometheus/prometheus.yml index ff4c539..129a76d 100644 --- a/deploy/prometheus/prometheus.yml +++ b/deploy/prometheus/prometheus.yml @@ -64,6 +64,12 @@ scrape_configs: - targets: ["host.docker.internal:9100"] labels: {instance: infra} + # Arlo-Kameras (03.11.): Werte, die der Kiosk-Watchdog auf gode-pc-02 4× täglich an den Pushgateway schiebt. + # honor_labels, damit job=arlo, instance=gode-pc-02 und camera aus dem Push erhalten bleiben. Dashboard arlo-kameras. + - job_name: pushgateway + honor_labels: true + static_configs: [{targets: ["pushgateway:9091"]}] + # prometheus-pve-exporter: jeder Knoten liefert die Cluster-Sicht (cluster=1) und seine eigenen Werte (node=1). # Alle fünf als Ziel, damit die Cluster-Sicht auch bei einem ausgefallenen Knoten bleibt (Dashboard wählt eine instance). - job_name: proxmox