Compare commits

..

2 Commits

Author SHA1 Message Date
07422cd0a7 Add debug logging for filesystem discovery
All checks were successful
Build and Release / build-and-release (push) Successful in 1m18s
2025-11-23 15:26:49 +01:00
de30b80219 Fix filesystem metric parsing bounds error in dashboard
All checks were successful
Build and Release / build-and-release (push) Successful in 1m8s
Prevent string slicing panic in extract_filesystem_metric when
parsing individual filesystem metrics. This resolves the issue
where filesystem entries show —% —GB/—GB instead of actual usage.
2025-11-23 15:23:15 +01:00
6 changed files with 17 additions and 8 deletions

6
Cargo.lock generated
View File

@@ -279,7 +279,7 @@ checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d"
[[package]]
name = "cm-dashboard"
version = "0.1.113"
version = "0.1.115"
dependencies = [
"anyhow",
"chrono",
@@ -301,7 +301,7 @@ dependencies = [
[[package]]
name = "cm-dashboard-agent"
version = "0.1.113"
version = "0.1.115"
dependencies = [
"anyhow",
"async-trait",
@@ -324,7 +324,7 @@ dependencies = [
[[package]]
name = "cm-dashboard-shared"
version = "0.1.113"
version = "0.1.115"
dependencies = [
"chrono",
"serde",

View File

@@ -1,6 +1,6 @@
[package]
name = "cm-dashboard-agent"
version = "0.1.113"
version = "0.1.115"
edition = "2021"
[dependencies]

View File

@@ -665,6 +665,11 @@ impl DiskCollector {
});
// Individual filesystem metrics
debug!("Drive {} has {} filesystems", drive_name, drive.filesystems.len());
for filesystem in &drive.filesystems {
debug!("Filesystem {}: {} bytes used / {} bytes total",
filesystem.mount_point, filesystem.used_bytes, filesystem.total_bytes);
}
for filesystem in &drive.filesystems {
let fs_name = if filesystem.mount_point == "/" {
"root".to_string()

View File

@@ -1,6 +1,6 @@
[package]
name = "cm-dashboard"
version = "0.1.113"
version = "0.1.115"
edition = "2021"
[dependencies]

View File

@@ -391,8 +391,12 @@ impl SystemWidget {
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()));
// Safely calculate fs_name length
let suffix_with_underscore = suffix.len() + 1;
if after_fs.len() > suffix_with_underscore {
let fs_name = after_fs[..after_fs.len() - suffix_with_underscore].to_string();
return (Some(fs_name), Some(suffix.to_string()));
}
}
}
}

View File

@@ -1,6 +1,6 @@
[package]
name = "cm-dashboard-shared"
version = "0.1.113"
version = "0.1.115"
edition = "2021"
[dependencies]