From 9c54b96eb7ddafb8e5a51937f248fd052516563d Mon Sep 17 00:00:00 2001 From: donpat1to Date: Thu, 21 Aug 2025 10:14:23 +0200 Subject: [PATCH] compact disk information+ --- WatcherAgent/src/hardware/disk.rs | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/WatcherAgent/src/hardware/disk.rs b/WatcherAgent/src/hardware/disk.rs index 0365bff..8bb4e8c 100644 --- a/WatcherAgent/src/hardware/disk.rs +++ b/WatcherAgent/src/hardware/disk.rs @@ -50,23 +50,19 @@ pub fn get_disk_utitlization() -> Result<(f64, f64, f64, f64), Box> { let disks = Disks::new_with_refreshed_list(); for disk in disks.list() { - // Ignoriere kleine Systempartitionen - + // Only print disks with known kind + if disk.kind() == sysinfo::DiskKind::Unknown(0) { + continue; + } println!( - "Disk_Name: {:?}, Disk_Kind: {}, Total: {}, Available: {}", + "Disk_Name: {:?}:\n---- Disk_Kind: {},\n---- Total: {},\n---- Available: {},\n---- Used: {}, \n---- Mount_Point: {:?}", disk.name(), disk.kind(), disk.total_space(), disk.available_space(), + disk.total_space() - disk.available_space(), + disk.mount_point() ); - println!("[{:?}] {:?}", disk.name(), disk.mount_point()); - if disk.total_space() > 100 * 1024 * 1024 { - // > 100MB - total_size += disk.total_space(); - total_available += disk.available_space(); - total_used += disk.total_space() - disk.available_space(); - count += 1; - } } let components = Components::new_with_refreshed_list(); for component in &components {