Add exclude_email_metrics configuration option
All checks were successful
Build and Release / build-and-release (push) Successful in 2m34s

- Add exclude_email_metrics field to AgentConfig for filtering email notifications
- Metrics matching excluded names skip notification processing but still appear in dashboard
- Optional field with serde(default) for backward compatibility
- Bump version to 0.1.56
This commit is contained in:
Christoffer Martinsson 2025-11-06 10:31:25 +01:00
parent 2d080a2f51
commit 0e7cf24dbb
5 changed files with 13 additions and 3 deletions

View File

@ -1,6 +1,6 @@
[package] [package]
name = "cm-dashboard-agent" name = "cm-dashboard-agent"
version = "0.1.55" version = "0.1.56"
edition = "2021" edition = "2021"
[dependencies] [dependencies]

View File

@ -201,6 +201,12 @@ impl Agent {
async fn process_metrics(&mut self, metrics: &[Metric]) -> bool { async fn process_metrics(&mut self, metrics: &[Metric]) -> bool {
let mut status_changed = false; let mut status_changed = false;
for metric in metrics { for metric in metrics {
// Filter excluded metrics from email notification processing only
if self.config.exclude_email_metrics.contains(&metric.name) {
debug!("Excluding metric '{}' from email notification processing", metric.name);
continue;
}
if self.host_status_manager.process_metric(metric, &mut self.notification_manager).await { if self.host_status_manager.process_metric(metric, &mut self.notification_manager).await {
status_changed = true; status_changed = true;
} }
@ -226,6 +232,7 @@ impl Agent {
format!("v{}", env!("CARGO_PKG_VERSION")) format!("v{}", env!("CARGO_PKG_VERSION"))
} }
async fn handle_commands(&mut self) -> Result<()> { async fn handle_commands(&mut self) -> Result<()> {
// Try to receive commands (non-blocking) // Try to receive commands (non-blocking)
match self.zmq_handler.try_receive_command() { match self.zmq_handler.try_receive_command() {

View File

@ -17,6 +17,9 @@ pub struct AgentConfig {
pub notifications: NotificationConfig, pub notifications: NotificationConfig,
pub status_aggregation: HostStatusConfig, pub status_aggregation: HostStatusConfig,
pub collection_interval_seconds: u64, pub collection_interval_seconds: u64,
/// List of metric names to exclude from email notifications
#[serde(default)]
pub exclude_email_metrics: Vec<String>,
} }
/// ZMQ communication configuration /// ZMQ communication configuration

View File

@ -1,6 +1,6 @@
[package] [package]
name = "cm-dashboard" name = "cm-dashboard"
version = "0.1.55" version = "0.1.56"
edition = "2021" edition = "2021"
[dependencies] [dependencies]

View File

@ -1,6 +1,6 @@
[package] [package]
name = "cm-dashboard-shared" name = "cm-dashboard-shared"
version = "0.1.55" version = "0.1.56"
edition = "2021" edition = "2021"
[dependencies] [dependencies]