Show all Docker containers as sub-services with active/inactive status
All checks were successful
Build and Release / build-and-release (push) Successful in 1m9s
All checks were successful
Build and Release / build-and-release (push) Successful in 1m9s
Agent changes: - Use docker ps -a to show ALL containers (running and stopped) - Map container status: Up -> active, Exited/Created -> inactive, other -> failed - Display Docker containers as sub-services under the docker service - Each container shown with proper status indicator Example display: ● docker active 139M 1MB ├─ ● docker_gitea active ├─ ○ docker_old-app inactive └─ ● docker_immich active Updated to version 0.1.173
This commit is contained in:
@@ -117,8 +117,20 @@ impl SystemdCollector {
|
||||
}
|
||||
}
|
||||
|
||||
// Docker containers are now collected as top-level services below
|
||||
// Keeping nginx as sub-services for now
|
||||
if service_name.contains("docker") && active_status == "active" {
|
||||
let docker_containers = self.get_docker_containers();
|
||||
for (container_name, container_status) in docker_containers {
|
||||
// For now, docker containers have no additional metrics
|
||||
// Future: could add memory_mb, cpu_percent, restart_count, etc.
|
||||
let metrics = Vec::new();
|
||||
|
||||
sub_services.push(SubServiceData {
|
||||
name: container_name.clone(),
|
||||
service_status: self.calculate_service_status(&container_name, &container_status),
|
||||
metrics,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Create complete service data
|
||||
let service_data = ServiceData {
|
||||
@@ -140,21 +152,6 @@ impl SystemdCollector {
|
||||
}
|
||||
}
|
||||
|
||||
// Collect Docker containers as top-level services
|
||||
let docker_containers = self.get_docker_containers();
|
||||
for (container_name, container_status) in docker_containers {
|
||||
let service_data = ServiceData {
|
||||
name: container_name.clone(),
|
||||
memory_mb: 0.0, // TODO: Could add container memory via docker stats
|
||||
disk_gb: 0.0, // TODO: Could add container disk usage
|
||||
user_stopped: false,
|
||||
service_status: self.calculate_service_status(&container_name, &container_status),
|
||||
sub_services: Vec::new(),
|
||||
};
|
||||
agent_data.services.push(service_data.clone());
|
||||
complete_service_data.push(service_data);
|
||||
}
|
||||
|
||||
// Update cached state
|
||||
{
|
||||
let mut state = self.state.write().unwrap();
|
||||
|
||||
Reference in New Issue
Block a user