From d5ce36ee18b4a419fb31c4c5e405a156d0c06b92 Mon Sep 17 00:00:00 2001 From: Christoffer Martinsson Date: Tue, 25 Nov 2025 11:53:08 +0100 Subject: [PATCH] Add support for additional SMART attributes - Support Temperature_Case attribute for Intel SSDs - Support Media_Wearout_Indicator attribute for wear percentage - Parse wear value from column 3 (VALUE) for Media_Wearout_Indicator - Fixes temperature and wear display for Intel PHLA847000FL512DGN drives --- Cargo.lock | 6 +++--- agent/Cargo.toml | 2 +- agent/src/collectors/disk.rs | 12 ++++++++++-- dashboard/Cargo.toml | 2 +- shared/Cargo.toml | 2 +- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 34643e4..9dca1f2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -279,7 +279,7 @@ checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d" [[package]] name = "cm-dashboard" -version = "0.1.157" +version = "0.1.158" dependencies = [ "anyhow", "chrono", @@ -301,7 +301,7 @@ dependencies = [ [[package]] name = "cm-dashboard-agent" -version = "0.1.157" +version = "0.1.158" dependencies = [ "anyhow", "async-trait", @@ -324,7 +324,7 @@ dependencies = [ [[package]] name = "cm-dashboard-shared" -version = "0.1.157" +version = "0.1.158" dependencies = [ "chrono", "serde", diff --git a/agent/Cargo.toml b/agent/Cargo.toml index d1e6fb2..8092f54 100644 --- a/agent/Cargo.toml +++ b/agent/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cm-dashboard-agent" -version = "0.1.157" +version = "0.1.158" edition = "2021" [dependencies] diff --git a/agent/src/collectors/disk.rs b/agent/src/collectors/disk.rs index ffb31b7..6ba79b8 100644 --- a/agent/src/collectors/disk.rs +++ b/agent/src/collectors/disk.rs @@ -471,7 +471,7 @@ impl DiskCollector { } // Temperature parsing for different drive types - if line.contains("Temperature_Celsius") || line.contains("Airflow_Temperature_Cel") { + if line.contains("Temperature_Celsius") || line.contains("Airflow_Temperature_Cel") || line.contains("Temperature_Case") { // Traditional SATA drives: attribute table format if let Some(temp_str) = line.split_whitespace().nth(9) { if let Ok(temp) = temp_str.parse::() { @@ -489,7 +489,15 @@ impl DiskCollector { } // Wear level parsing for SSDs - if line.contains("Wear_Leveling_Count") || line.contains("SSD_Life_Left") { + if line.contains("Media_Wearout_Indicator") { + // Media_Wearout_Indicator stores remaining life % in column 3 (VALUE) + if let Some(wear_str) = line.split_whitespace().nth(3) { + if let Ok(remaining) = wear_str.parse::() { + wear_percent = Some(100.0 - remaining); // Convert remaining life to wear + } + } + } else if line.contains("Wear_Leveling_Count") || line.contains("SSD_Life_Left") { + // Other wear attributes store value in column 9 (RAW_VALUE) if let Some(wear_str) = line.split_whitespace().nth(9) { if let Ok(wear) = wear_str.parse::() { wear_percent = Some(100.0 - wear); // Convert remaining life to wear diff --git a/dashboard/Cargo.toml b/dashboard/Cargo.toml index c474a29..21b0888 100644 --- a/dashboard/Cargo.toml +++ b/dashboard/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cm-dashboard" -version = "0.1.157" +version = "0.1.158" edition = "2021" [dependencies] diff --git a/shared/Cargo.toml b/shared/Cargo.toml index e3cadb5..7c3cdf9 100644 --- a/shared/Cargo.toml +++ b/shared/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cm-dashboard-shared" -version = "0.1.157" +version = "0.1.158" edition = "2021" [dependencies]