feat: implement Phase 5 — Alerting & Monitoring

Backend:
- AlertEvaluationService: evaluates metrics against AlertRules after each heartbeat
  - Supports cpu_usage_percent and memory_usage_percent metric paths
  - Operators: >, >=, <, <=, ==
  - 15-minute dedup window to prevent alert spam
- AlertRulesController: full CRUD for alert rules (GET/POST/PUT/DELETE)
- AlertsController: list with acknowledged filter + POST acknowledge endpoint
- IRmmHubClient: added AlertTriggered push method
- Program.cs: AlertEvaluationService registered as Scoped

Frontend:
- AlertsPage: two-tab layout (active alerts + rules)
  - Alerts tab: severity badges, acknowledge button, all/unack/ack filter
  - Rules tab: condition display, enabled toggle, delete with confirm
  - Create rule modal with MetricPath/Operator/Threshold/Severity selects
- api/types.ts: AlertRule, AlertItem, CreateAlertRuleRequest types
- api/client.ts: alertRulesApi and alertsApi
- useAgentSignalR: handles AlertTriggered → invalidates alerts query
- App.tsx: Alerts nav item with Bell icon

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Claude Agent
2026-03-19 14:00:19 +01:00
parent d17df20f5e
commit eb114f68e2
11 changed files with 815 additions and 3 deletions

View File

@@ -13,4 +13,7 @@ public interface IRmmHubClient
/// <summary>Command-Ergebnis verfügbar (an agent-Gruppe gepusht)</summary>
Task CommandResultUpdated(string taskId, string agentId, bool success, int exitCode);
/// <summary>Neuer Alert ausgelöst (an alle Clients gepusht)</summary>
Task AlertTriggered(string agentId, string agentHostname, string ruleName, string message, string severity);
}