From 7607e971b8b828933d0693fe999c7fee8e9c4010 Mon Sep 17 00:00:00 2001 From: Christoffer Martinsson Date: Thu, 23 Oct 2025 12:57:10 +0200 Subject: [PATCH] Add debug logging to diagnose Phase 4 service discovery issue Add detailed debug logging to track: - Service discovery start - Individual service parsing - Final service count and list - Empty results indication This will help identify why cmbox disappeared from dashboard. --- agent/src/collectors/systemd.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/agent/src/collectors/systemd.rs b/agent/src/collectors/systemd.rs index 2d64bc3..7879af1 100644 --- a/agent/src/collectors/systemd.rs +++ b/agent/src/collectors/systemd.rs @@ -127,6 +127,7 @@ impl SystemdCollector { /// Auto-discover interesting services to monitor fn discover_services(&self) -> Result> { + debug!("Starting systemd service discovery with status caching"); // Get all services (includes inactive, running, failed - everything) let units_output = Command::new("systemctl") .arg("list-units") @@ -175,6 +176,7 @@ impl SystemdCollector { }); all_service_names.insert(service_name.to_string()); + debug!("Parsed service: {} (load:{}, active:{}, sub:{})", service_name, load_state, active_state, sub_state); } } @@ -219,6 +221,11 @@ impl SystemdCollector { state.service_status_cache = status_cache; } + debug!("Service discovery completed: found {} matching services: {:?}", services.len(), services); + if services.is_empty() { + debug!("No services found matching the configured filters - this may indicate a parsing issue"); + } + Ok(services) }