Module alerting

Module alerting 

Source
Expand description

Alerting system with configurable thresholds.

This module provides a comprehensive alerting system for monitoring various metrics and triggering alerts when thresholds are exceeded.

§Features

  • Multiple severity levels (Info, Warning, Error, Critical)
  • Configurable thresholds for various metrics
  • Alert suppression to prevent alert fatigue
  • Alert history tracking
  • Customizable alert handlers

§Example

use chie_core::alerting::{AlertManager, AlertSeverity, ThresholdConfig, AlertMetric};

let mut manager = AlertManager::new();

// Configure a threshold for high storage usage
let threshold = ThresholdConfig {
    metric: AlertMetric::StorageUsagePercent,
    warning_threshold: 75.0,
    error_threshold: 90.0,
    critical_threshold: 95.0,
    check_interval_secs: 60,
};
manager.add_threshold(threshold);

// Check a metric value
manager.check_metric(AlertMetric::StorageUsagePercent, 92.0);

// Get active alerts
let alerts = manager.get_active_alerts();
for alert in alerts {
    println!("Alert: {:?} - {}", alert.severity, alert.message);
}

Structs§

Alert
An alert triggered by a threshold violation.
AlertManager
Alert manager for threshold-based monitoring.
ThresholdConfig
Configuration for threshold-based alerting.

Enums§

AlertMetric
Alert metric types that can be monitored.
AlertSeverity
Alert severity levels.