Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| de30b80219 | |||
| 7d96ca9fad | |||
| 9b940ebd19 | |||
| 6d4da1b7da |
6
Cargo.lock
generated
6
Cargo.lock
generated
@@ -279,7 +279,7 @@ checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cm-dashboard"
|
name = "cm-dashboard"
|
||||||
version = "0.1.109"
|
version = "0.1.114"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"chrono",
|
"chrono",
|
||||||
@@ -301,7 +301,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cm-dashboard-agent"
|
name = "cm-dashboard-agent"
|
||||||
version = "0.1.109"
|
version = "0.1.114"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
@@ -324,7 +324,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cm-dashboard-shared"
|
name = "cm-dashboard-shared"
|
||||||
version = "0.1.109"
|
version = "0.1.114"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"serde",
|
"serde",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "cm-dashboard-agent"
|
name = "cm-dashboard-agent"
|
||||||
version = "0.1.110"
|
version = "0.1.114"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|||||||
@@ -148,8 +148,13 @@ impl DiskCollector {
|
|||||||
let mut filesystem_usage = HashMap::new();
|
let mut filesystem_usage = HashMap::new();
|
||||||
|
|
||||||
for mount_point in mount_devices.keys() {
|
for mount_point in mount_devices.keys() {
|
||||||
if let Ok((total, used)) = self.get_filesystem_info(mount_point) {
|
match self.get_filesystem_info(mount_point) {
|
||||||
filesystem_usage.insert(mount_point.clone(), (total, used));
|
Ok((total, used)) => {
|
||||||
|
filesystem_usage.insert(mount_point.clone(), (total, used));
|
||||||
|
}
|
||||||
|
Err(e) => {
|
||||||
|
debug!("Failed to get filesystem info for {}: {}", mount_point, e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "cm-dashboard"
|
name = "cm-dashboard"
|
||||||
version = "0.1.110"
|
version = "0.1.114"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ impl SystemWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Parse storage metrics into pools and drives
|
/// Parse storage metrics into pools and drives
|
||||||
fn update_storage_from_metrics(&mut self, metrics: &[&Metric]) {
|
fn update_storage_from_metrics(&mut self, metrics: &[&Metric]) {
|
||||||
let mut pools: std::collections::HashMap<String, StoragePool> = std::collections::HashMap::new();
|
let mut pools: std::collections::HashMap<String, StoragePool> = std::collections::HashMap::new();
|
||||||
|
|
||||||
@@ -350,7 +350,9 @@ impl SystemWidget {
|
|||||||
// Find the second-to-last underscore to get pool name
|
// Find the second-to-last underscore to get pool name
|
||||||
let before_suffix = &metric_name[..suffix_pos];
|
let before_suffix = &metric_name[..suffix_pos];
|
||||||
if let Some(drive_start) = before_suffix.rfind('_') {
|
if let Some(drive_start) = before_suffix.rfind('_') {
|
||||||
return Some(metric_name[5..drive_start].to_string()); // Skip "disk_"
|
if drive_start > 5 {
|
||||||
|
return Some(metric_name[5..drive_start].to_string()); // Skip "disk_"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Handle filesystem metrics: disk_{pool}_fs_{filesystem}_{metric}
|
// Handle filesystem metrics: disk_{pool}_fs_{filesystem}_{metric}
|
||||||
@@ -389,8 +391,12 @@ impl SystemWidget {
|
|||||||
|
|
||||||
for suffix in known_suffixes {
|
for suffix in known_suffixes {
|
||||||
if after_fs.ends_with(suffix) {
|
if after_fs.ends_with(suffix) {
|
||||||
let fs_name = after_fs[..after_fs.len() - suffix.len() - 1].to_string(); // Remove suffix + underscore
|
// Safely calculate fs_name length
|
||||||
return (Some(fs_name), Some(suffix.to_string()));
|
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()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "cm-dashboard-shared"
|
name = "cm-dashboard-shared"
|
||||||
version = "0.1.110"
|
version = "0.1.114"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|||||||
Reference in New Issue
Block a user