From 9f1848875250d49f13fef983d4c4463550ce4790 Mon Sep 17 00:00:00 2001 From: Christoffer Martinsson Date: Sun, 23 Nov 2025 13:11:05 +0100 Subject: [PATCH] Fix filesystem metric parsing for correct mount point names - Fix extract_filesystem_metric() to handle multi-underscore metric names correctly - Parse known metric suffixes (usage_percent, mount_point, available_gb, etc.) - Prevent incorrect parsing like boot_mount_point -> fs_name='boot_mount', metric_type='point' - Should now correctly show /boot and / instead of /boot/mount and /root/mount --- Cargo.lock | 6 +++--- agent/Cargo.toml | 2 +- dashboard/Cargo.toml | 2 +- dashboard/src/ui/widgets/system.rs | 13 ++++++++----- shared/Cargo.toml | 2 +- 5 files changed, 14 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cf67230..c23c18b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -279,7 +279,7 @@ checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d" [[package]] name = "cm-dashboard" -version = "0.1.104" +version = "0.1.105" dependencies = [ "anyhow", "chrono", @@ -301,7 +301,7 @@ dependencies = [ [[package]] name = "cm-dashboard-agent" -version = "0.1.104" +version = "0.1.105" dependencies = [ "anyhow", "async-trait", @@ -324,7 +324,7 @@ dependencies = [ [[package]] name = "cm-dashboard-shared" -version = "0.1.104" +version = "0.1.105" dependencies = [ "chrono", "serde", diff --git a/agent/Cargo.toml b/agent/Cargo.toml index 9492f46..f856c94 100644 --- a/agent/Cargo.toml +++ b/agent/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cm-dashboard-agent" -version = "0.1.105" +version = "0.1.106" edition = "2021" [dependencies] diff --git a/dashboard/Cargo.toml b/dashboard/Cargo.toml index 5643e8e..f21f704 100644 --- a/dashboard/Cargo.toml +++ b/dashboard/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cm-dashboard" -version = "0.1.105" +version = "0.1.106" edition = "2021" [dependencies] diff --git a/dashboard/src/ui/widgets/system.rs b/dashboard/src/ui/widgets/system.rs index 1f32b2f..26c544d 100644 --- a/dashboard/src/ui/widgets/system.rs +++ b/dashboard/src/ui/widgets/system.rs @@ -384,11 +384,14 @@ impl SystemWidget { if let Some(fs_start) = metric_name.find("_fs_") { let after_fs = &metric_name[fs_start + 4..]; // Skip "_fs_" - // Find the last underscore to separate filesystem name from metric type - if let Some(last_underscore) = after_fs.rfind('_') { - let fs_name = after_fs[..last_underscore].to_string(); - let metric_type = after_fs[last_underscore + 1..].to_string(); - return (Some(fs_name), Some(metric_type)); + // Look for known metric suffixes (these can contain underscores) + let known_suffixes = ["usage_percent", "used_gb", "total_gb", "available_gb", "mount_point"]; + + for suffix in known_suffixes { + if after_fs.ends_with(suffix) { + let fs_name = after_fs[..after_fs.len() - suffix.len() - 1].to_string(); // Remove suffix + underscore + return (Some(fs_name), Some(suffix.to_string())); + } } } } diff --git a/shared/Cargo.toml b/shared/Cargo.toml index b54a037..c43bd45 100644 --- a/shared/Cargo.toml +++ b/shared/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cm-dashboard-shared" -version = "0.1.105" +version = "0.1.106" edition = "2021" [dependencies]