From 539416412365f74e565a0e45149360b5876f8ad7 Mon Sep 17 00:00:00 2001 From: Christoffer Martinsson Date: Mon, 24 Nov 2025 15:03:20 +0100 Subject: [PATCH] Remove agent heartbeat causing dashboard zero dropouts Agent heartbeat was sending empty AgentData every few seconds, causing dashboard to display zero values for all metrics intermittently. Since agent already transmits complete data every 1 second, heartbeat is redundant. Dashboard will detect offline hosts via data timestamps. --- Cargo.lock | 6 +++--- agent/Cargo.toml | 2 +- agent/src/agent.rs | 13 ++----------- dashboard/Cargo.toml | 2 +- shared/Cargo.toml | 2 +- 5 files changed, 8 insertions(+), 17 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c07cd76..c6063c1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -279,7 +279,7 @@ checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d" [[package]] name = "cm-dashboard" -version = "0.1.134" +version = "0.1.135" dependencies = [ "anyhow", "chrono", @@ -301,7 +301,7 @@ dependencies = [ [[package]] name = "cm-dashboard-agent" -version = "0.1.134" +version = "0.1.135" dependencies = [ "anyhow", "async-trait", @@ -324,7 +324,7 @@ dependencies = [ [[package]] name = "cm-dashboard-shared" -version = "0.1.134" +version = "0.1.135" dependencies = [ "chrono", "serde", diff --git a/agent/Cargo.toml b/agent/Cargo.toml index 6498806..2dd1dbb 100644 --- a/agent/Cargo.toml +++ b/agent/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cm-dashboard-agent" -version = "0.1.135" +version = "0.1.136" edition = "2021" [dependencies] diff --git a/agent/src/agent.rs b/agent/src/agent.rs index 862e1e0..a3d8721 100644 --- a/agent/src/agent.rs +++ b/agent/src/agent.rs @@ -78,11 +78,10 @@ impl Agent { info!("Initial metric collection completed - all data cached and ready"); } - // Separate intervals for collection, transmission, heartbeat, and email notifications + // Separate intervals for collection, transmission, and email notifications let mut collection_interval = interval(Duration::from_secs(self.config.collection_interval_seconds)); let mut transmission_interval = interval(Duration::from_secs(self.config.zmq.transmission_interval_seconds)); - let mut heartbeat_interval = interval(Duration::from_secs(self.config.zmq.heartbeat_interval_seconds)); let mut notification_interval = interval(Duration::from_secs(self.config.notifications.aggregation_interval_seconds)); loop { @@ -99,12 +98,6 @@ impl Agent { error!("Failed to broadcast metrics: {}", e); } } - _ = heartbeat_interval.tick() => { - // Send standalone heartbeat for host connectivity detection - if let Err(e) = self.send_heartbeat().await { - error!("Failed to send heartbeat: {}", e); - } - } _ = notification_interval.tick() => { // Process batched email notifications (separate from dashboard updates) if let Err(e) = self.host_status_manager.process_pending_notifications(&mut self.notification_manager).await { @@ -187,9 +180,7 @@ impl Agent { let version_metric = self.get_agent_version_metric(); metrics.push(version_metric); - // Add heartbeat metric for host connectivity detection - let heartbeat_metric = self.get_heartbeat_metric(); - metrics.push(heartbeat_metric); + // Heartbeat removed - dashboard detects connectivity via regular transmission timestamps // Check for user-stopped services that are now active and clear their flags self.clear_user_stopped_flags_for_active_services(&metrics); diff --git a/dashboard/Cargo.toml b/dashboard/Cargo.toml index c5c0236..69e62fd 100644 --- a/dashboard/Cargo.toml +++ b/dashboard/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cm-dashboard" -version = "0.1.135" +version = "0.1.136" edition = "2021" [dependencies] diff --git a/shared/Cargo.toml b/shared/Cargo.toml index bc1c9f9..54b3b07 100644 --- a/shared/Cargo.toml +++ b/shared/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cm-dashboard-shared" -version = "0.1.135" +version = "0.1.136" edition = "2021" [dependencies]