# 🛡️ 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