Add status command (roadmap v0.8: status --json)

Add `enodia-sentinel status [--json]` — a local health and alert
summary: daemon running state, heartbeat freshness, per-severity alert
counts, last alert time, and eBPF state. Reuses web.daemon_status (the
same data behind /api/status), so the CLI and dashboard never diverge.

Exit code reflects health (0 = running and fresh, 1 = down or stale), so
it doubles as a cron/monitoring probe. Three CLI tests drive it against a
temp log_dir; no daemon or root needed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Luna 2026-06-10 05:17:29 -07:00
parent 9ebc355936
commit f2d896a2d7
4 changed files with 99 additions and 2 deletions

View file

@ -182,6 +182,23 @@ Exit code:
## Evidence and Operator Commands
### `status`
```bash
enodia-sentinel status
enodia-sentinel status --json
```
Prints a local health and alert summary: daemon running state, heartbeat age and
staleness, total alerts with per-severity counts, last alert time, and eBPF
monitor state. `--json` emits the same data as the dashboard `/api/status`
endpoint, for cron/monitoring.
Exit code:
- `0`: daemon is running and the heartbeat is fresh.
- `1`: daemon is down or the heartbeat is stale.
### `web`
```bash
@ -238,7 +255,6 @@ does not require pip or a virtualenv.
The roadmap reserves these command shapes:
```bash
enodia-sentinel status --json
enodia-sentinel incident list
enodia-sentinel incident show <incident-id>
enodia-sentinel incident export <incident-id>