diff --git a/Cargo.lock b/Cargo.lock index a856dd6..4a4204f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -270,7 +270,7 @@ checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d" [[package]] name = "cm-dashboard" -version = "0.1.35" +version = "0.1.37" dependencies = [ "anyhow", "chrono", @@ -291,7 +291,7 @@ dependencies = [ [[package]] name = "cm-dashboard-agent" -version = "0.1.35" +version = "0.1.37" dependencies = [ "anyhow", "async-trait", @@ -314,7 +314,7 @@ dependencies = [ [[package]] name = "cm-dashboard-shared" -version = "0.1.35" +version = "0.1.37" dependencies = [ "chrono", "serde", diff --git a/agent/Cargo.toml b/agent/Cargo.toml index a25a58b..9028566 100644 --- a/agent/Cargo.toml +++ b/agent/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cm-dashboard-agent" -version = "0.1.37" +version = "0.1.38" edition = "2021" [dependencies] diff --git a/agent/src/collectors/systemd.rs b/agent/src/collectors/systemd.rs index 6604c60..d379adf 100644 --- a/agent/src/collectors/systemd.rs +++ b/agent/src/collectors/systemd.rs @@ -555,10 +555,8 @@ impl SystemdCollector { for (site_name, url) in &sites { match self.check_site_latency(url) { Ok(latency_ms) => { - let status = if latency_ms < 500.0 { + let status = if latency_ms < self.config.nginx_latency_critical_ms { Status::Ok - } else if latency_ms < 2000.0 { - Status::Warning } else { Status::Critical }; diff --git a/agent/src/config/mod.rs b/agent/src/config/mod.rs index ed56f87..baabc12 100644 --- a/agent/src/config/mod.rs +++ b/agent/src/config/mod.rs @@ -108,6 +108,7 @@ pub struct SystemdConfig { pub nginx_check_interval_seconds: u64, pub http_timeout_seconds: u64, pub http_connect_timeout_seconds: u64, + pub nginx_latency_critical_ms: f32, } diff --git a/agent/src/config/validation.rs b/agent/src/config/validation.rs index c420bb3..3c7618d 100644 --- a/agent/src/config/validation.rs +++ b/agent/src/config/validation.rs @@ -83,6 +83,13 @@ pub fn validate_config(config: &AgentConfig) -> Result<()> { } } + // Validate systemd configuration + if config.collectors.systemd.enabled { + if config.collectors.systemd.nginx_latency_critical_ms <= 0.0 { + bail!("Nginx latency critical threshold must be positive"); + } + } + // Validate SMTP configuration if config.notifications.enabled { if config.notifications.smtp_host.is_empty() { diff --git a/dashboard/Cargo.toml b/dashboard/Cargo.toml index f02e645..0160183 100644 --- a/dashboard/Cargo.toml +++ b/dashboard/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cm-dashboard" -version = "0.1.37" +version = "0.1.38" edition = "2021" [dependencies] diff --git a/shared/Cargo.toml b/shared/Cargo.toml index 8595567..fe088f0 100644 --- a/shared/Cargo.toml +++ b/shared/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cm-dashboard-shared" -version = "0.1.37" +version = "0.1.38" edition = "2021" [dependencies]