diff --git a/src/sensors/utils.rs b/src/sensors/utils.rs index 2ba070ab..651db8a2 100644 --- a/src/sensors/utils.rs +++ b/src/sensors/utils.rs @@ -246,7 +246,7 @@ impl ProcessTracker { #[cfg(feature = "containers")] let regex_cgroup_docker = Regex::new(r"^.*/docker.*$").unwrap(); #[cfg(feature = "containers")] - let regex_cgroup_kubernetes = Regex::new(r"^/kubepods.*$").unwrap(); + let regex_cgroup_kubernetes = Regex::new(r"/kubepods.*$").unwrap(); #[cfg(feature = "containers")] let regex_cgroup_containerd = Regex::new("/system.slice/containerd.service/.*$").unwrap(); @@ -429,6 +429,12 @@ impl ProcessTracker { if container_id.contains("cri-containerd") { container_id = container_id.split(':').last().unwrap().to_string(); } + if container_id.starts_with("cri-containerd-") { + container_id = container_id + .strip_prefix("cri-containerd-") + .unwrap() + .to_string(); + } Ok(container_id) }