9b18b11f32
Add token- and IP-protected ingest.php, boka status checks in monitor.php, and document the two-repo push workflow. Todo 04 marked complete. Co-authored-by: Cursor <cursoragent@cursor.com>
62 lines
2.0 KiB
Markdown
62 lines
2.0 KiB
Markdown
# 04 — Monitoring Push (boka → Webspace)
|
|
|
|
**Priorität:** medium
|
|
**Status:** erledigt (2026-06-12)
|
|
**Abhängigkeiten:** 01, 03 (ingest + stale-Check)
|
|
**Siehe auch:** [`../MONITORING.md`](../MONITORING.md) Ebene 2
|
|
|
|
## Ziel
|
|
|
|
Interne Metriken von boka an 0012.de pushen; Alarm wenn kein Push seit 15 Min.
|
|
|
|
## Checkliste
|
|
|
|
### Webspace
|
|
|
|
- [x] `public/ingest.php` — POST JSON, Token-Prüfung (`MONITOR_INGEST_TOKEN`) + IP-Whitelist (`BOKA_IP`)
|
|
- [x] Payload speichern: `private/data/boka-status.json` + Timestamp
|
|
- [x] In `monitor.php`: wenn `last_push` > 15 Min → Alarm „boka silent“
|
|
- [x] Schwellen: `disk_percent > 85`, `containers_unhealthy > 0`
|
|
- [x] Backup-Heartbeat-Feld `backup_last_success` — Alarm wenn > 25h alt (nur wenn Feld gesetzt)
|
|
|
|
### boka
|
|
|
|
- [x] Skript `~/server/scripts/push-status.sh`
|
|
- [x] Sammelt: load, disk %, mem, `docker ps` running/unhealthy
|
|
- [x] POST an `INGEST_URL` mit curl
|
|
- [x] Crontab: `*/5 * * * *`
|
|
- [ ] Nach erfolgreichem Backup: Push mit aktualisiertem `backup_last_success` (wenn Backups existieren)
|
|
|
|
### Token
|
|
|
|
- [x] Starkes Token in `.env` / `server.env`
|
|
- [x] Identisch in boka `~/server/config/push.env` (`PUSH_TOKEN`)
|
|
|
|
## Beispiel-Payload
|
|
|
|
```json
|
|
{
|
|
"token": "...",
|
|
"load": [1.2, 0.8, 0.5],
|
|
"disk_percent": 55,
|
|
"mem_available_mb": 4700,
|
|
"containers_running": 38,
|
|
"containers_unhealthy": 0,
|
|
"backup_last_success": "2026-06-10T03:00:00+02:00"
|
|
}
|
|
```
|
|
|
|
## Akzeptanzkriterien
|
|
|
|
- [x] Push von boka aktualisiert JSON auf Webspace (HTTP 200, 2026-06-12)
|
|
- [x] Stale-Alarm — Logik in `monitor-lib.php`; Live-Test bewusst übersprungen
|
|
|
|
## Notizen
|
|
|
|
- Skript liegt im **boka-Repo** (`~/server`); Webspace-Repo: `ingest.php` + `monitor-lib.php`
|
|
- SSH-Sync: `frank@frank-schwenk.de` — push.env, Crontab, `webspace/`-Kopien
|
|
- Bugfix in `push-status.sh`: Env-Vars müssen **vor** `python3` stehen (nicht danach)
|
|
- boka-Agent: verifiziert (grünes Licht)
|
|
- Gitea-Remote für `~/server`: später (User)
|
|
- Backup-Hook in `push-status.sh`: offen bis Backups existieren
|