Skip to content

Commit a2f5a5d

Browse files
committed
fix: added disk_type
1 parent 5ea2761 commit a2f5a5d

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/sensors/mod.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ pub mod utils;
1212
#[cfg(target_os = "linux")]
1313
use procfs::{CpuInfo, CpuTime, KernelStats};
1414
use std::{collections::HashMap, error::Error, fmt, mem::size_of_val, str, time::Duration};
15-
use sysinfo::DiskExt;
1615
#[allow(unused_imports)]
1716
use sysinfo::{CpuExt, Pid, System, SystemExt};
17+
use sysinfo::{DiskExt, DiskType};
1818
use utils::{current_system_time_since_epoch, IProcess, ProcessTracker};
1919

2020
// !!!!!!!!!!!!!!!!! Sensor !!!!!!!!!!!!!!!!!!!!!!!
@@ -572,6 +572,17 @@ impl Topology {
572572
if let Some(mount_point) = d.mount_point().to_str() {
573573
attributes.insert(String::from("disk_mount_point"), String::from(mount_point));
574574
}
575+
match d.type_() {
576+
DiskType::SSD => {
577+
attributes.insert(String::from("disk_type"), String::from("SSD"));
578+
}
579+
DiskType::HDD => {
580+
attributes.insert(String::from("disk_type"), String::from("HDD"));
581+
}
582+
DiskType::Unknown(_) => {
583+
attributes.insert(String::from("disk_type"), String::from("Unknown"));
584+
}
585+
}
575586
attributes.insert(
576587
String::from("disk_is_removable"),
577588
d.is_removable().to_string(),

0 commit comments

Comments
 (0)