From d34d24a3f8833ea8bd07e4bd9737a9598d7f2f13 Mon Sep 17 00:00:00 2001 From: sascha Date: Wed, 8 Apr 2026 21:43:04 +0200 Subject: [PATCH] =?UTF-8?q?docs:=20README=20f=C3=BCr=20Backup=20Monitor=20?= =?UTF-8?q?(The=20Sentinel)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backup-monitor/README.md | 71 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 backup-monitor/README.md diff --git a/backup-monitor/README.md b/backup-monitor/README.md new file mode 100644 index 0000000..5cbef47 --- /dev/null +++ b/backup-monitor/README.md @@ -0,0 +1,71 @@ +# 🛡️ Backup Monitor – The Sentinel + +Zentrales Backup-Monitoring-Dashboard für Borgmatic-Backups mit MongoDB Backend, Sentinel UI, Prometheus Metrics und Webhook-Alerts. + +## Features + +- **Sentinel Web-UI** – Dashboard, Alert Center, Host Grid, 30-Tage Kalender-Heatmap +- **Prometheus `/metrics`** – Scrape-fähig für Grafana Dashboards +- **Uptime Kuma Push-Forwarding** – Single Point of Contact (Borgmatic → Monitor → Kuma) +- **Webhook Alerts** – Error/Stale Events an n8n, Telegram, etc. +- **Auto-Register** – Hosts registrieren sich automatisch beim ersten Push +- **90 Tage Retention** – MongoDB TTL-Index, automatisch + +## Stack + +- Python 3.12 / Flask / Gunicorn +- MongoDB 8 +- Tailwind CSS, Material 3 Design Tokens, Glassmorphism + +## Deployment + +Läuft als Teil des `monitoring` Stacks auf `10.1.1.111:9999`. + +```yaml +backup-monitor: + build: ./backup-monitor + ports: + - "9999:9999" + environment: + - MONGO_URI=mongodb://backup-mongo:27017 + - STALE_HOURS=26 + - API_KEY= + - WEBHOOK_URLS= + - WEBHOOK_EVENTS=error,stale +``` + +## Borgmatic Integration + +Borgmatic pusht nach jedem Backup via `after_backup` Hook: + +```bash +curl -X POST -H "Content-Type: application/json" \ + -d '{"host":"","status":"ok","duration_sec":123,...}' \ + http://10.1.1.111:9999/api/push +``` + +Template: `roles/borg/templates/borgmatic.yml.j2` im Ansible-Repo. + +## API + +| Method | Endpoint | Auth | Beschreibung | +|--------|----------|------|-------------| +| GET | `/` | ❌ | Web UI | +| GET | `/metrics` | ❌ | Prometheus Metriken | +| GET | `/api/summary` | ❌ | Dashboard-Zusammenfassung | +| GET | `/api/hosts` | ❌ | Alle Hosts mit Status | +| GET | `/api/history/` | ❌ | Backup-History | +| GET | `/api/calendar/` | ❌ | Kalender-Heatmap | +| POST | `/api/push` | 🔑 | Backup-Status pushen | +| POST | `/api/hosts` | 🔑 | Host hinzufügen | +| PUT | `/api/hosts/` | 🔑 | Host bearbeiten | +| DELETE | `/api/hosts/` | 🔑 | Host + History löschen | + +🔑 = benötigt `API_KEY` falls gesetzt (Header `X-API-Key` oder `?api_key=`) + +## Neuen Host hinzufügen + +1. Borgmatic auf dem Host deployen: `./pfannkuchen.sh backup ` +2. Oder manuell über Web-UI: `http://10.1.1.111:9999` → Host hinzufügen +3. Uptime Kuma Push-URL eintragen (optional) +4. Host registriert sich automatisch beim ersten Backup-Push