Files
security-alert-center/docs/pilot-2.2-heartbeat-reports.md
T
PTah 38df27cdef feat: host heartbeat status and dashboard metrics (2.2)
Track agent.heartbeat and report.daily.ssh per host; show online/stale
on Hosts UI; dashboard counters and SAC_HEARTBEAT_STALE_MINUTES config.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-27 13:36:17 +10:00

62 lines
2.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Фаза 2.2 — Heartbeat и daily report через SAC
Агент **уже** шлёт в SAC (в т.ч. в `exclusive`):
| Тип | Интервал (ssh-monitor) |
|-----|-------------------------|
| `agent.heartbeat` | каждые **12 ч** |
| `report.daily.ssh` | раз в сутки после `DAILY_REPORT_HOUR` |
SAC отображает их в **События** и на **Dashboard / Хосты**.
---
## UI SAC
- **Dashboard:** счётчики heartbeat/отчётов за 24 ч, хосты с устаревшим heartbeat.
- **Хосты:** колонки *Агент* (`online` / `stale` / `unknown`), время последнего heartbeat и отчёта.
---
## Настройка порога «живости» (сервер SAC)
В `config/sac-api.env`:
```bash
# По умолчанию 780 мин (13 ч) — чуть больше интервала heartbeat агента (12 ч)
SAC_HEARTBEAT_STALE_MINUTES=780
```
После изменения: `sudo systemctl restart sac-api`.
---
## Проверка на пилотном хосте (exclusive)
1. Дождаться heartbeat или ускорить тест: на агенте временно уменьшить интервал нельзя без правки кода — проще подождать или вручную:
```bash
sudo /usr/local/bin/ssh-monitor --dry-run
```
(не шлёт реально; для реального теста — дождаться цикла 12 ч или смотреть уже пришедшие события).
2. В SAC UI → **События**, фильтр `type=agent.heartbeat`.
3. **Хосты** → статус `online` после свежего heartbeat.
4. Ежедневный отчёт: после `DAILY_REPORT_HOUR` — событие `report.daily.ssh`.
---
## Деплой
```bash
sudo /opt/sac-deploy.sh
```
---
## См. также
- [pilot-2.1-exclusive.md](pilot-2.1-exclusive.md)
- [agent-integration.md](agent-integration.md)