Implement comprehensive status calculation and notification system

Agent Changes:
• Add CPU status thresholds (warning: ≥5.0, critical: ≥8.0)
• Add memory status thresholds (warning: ≥80%, critical: ≥95%)
• Add service status calculation (critical if failed>0, warning if degraded>0)
• All collectors now calculate and include status in output

Dashboard Changes:
• Update system widget to use agent-calculated cpu_status and memory_status
• Update services widget to use agent-calculated services_status
• Remove client-side status calculations in favor of agent status
• Add status_level_from_agent_status helper function

Notification System:
• Add SMTP email notification system using lettre crate
• Auto-configure notifications: hostname@cmtec.secm@cmtec.se
• Smart change detection with rate limiting (30min cooldown)
• Only notify on transitions to/from warning/critical states
• Rich email formatting with host, component, metric details
This commit is contained in:
2025-10-12 20:04:40 +02:00
parent 59bc3adad5
commit d08d8f306a
5 changed files with 609 additions and 0 deletions

View File

@@ -9,6 +9,7 @@ mod agent;
mod collectors;
mod config;
mod discovery;
mod notifications;
mod scheduler;
use agent::MetricsAgent;