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.
This commit is contained in:
Christoffer Martinsson 2025-10-23 12:57:10 +02:00
parent da6f3c3855
commit 7607e971b8

View File

@ -127,6 +127,7 @@ impl SystemdCollector {
/// Auto-discover interesting services to monitor
fn discover_services(&self) -> Result<Vec<String>> {
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)
}