From a7d8c4fb33e2c2369cbb4b2bbe0f2e5417cde447 Mon Sep 17 00:00:00 2001 From: donpat1to Date: Tue, 29 Jul 2025 11:36:02 +0200 Subject: [PATCH] deleted duplicate in .toml --- WatcherAgent/Cargo.toml | 4 ++-- WatcherAgent/src/main.rs | 15 ++++----------- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/WatcherAgent/Cargo.toml b/WatcherAgent/Cargo.toml index 52e323a..708a8c3 100644 --- a/WatcherAgent/Cargo.toml +++ b/WatcherAgent/Cargo.toml @@ -8,11 +8,11 @@ license = "MIT" [dependencies] serde = { version = "1.0", features = ["derive"] } -serde_json = "1" +serde_json = "1.0" tokio = { version = "1.37", features = ["full"] } local-ip-address = "0.5" reqwest = { version = "0.11", default-features = false, features = ["json", "blocking", "cookies", "rustls-tls"] } -sysinfo = "0.30" +sysinfo = "0.29" metrics = "0.24.2" chrono = "0.4" nvml-wrapper = "0.10" \ No newline at end of file diff --git a/WatcherAgent/src/main.rs b/WatcherAgent/src/main.rs index df7deed..16c371d 100644 --- a/WatcherAgent/src/main.rs +++ b/WatcherAgent/src/main.rs @@ -3,9 +3,7 @@ use nvml_wrapper::Nvml; use reqwest::Client; use serde::{Deserialize, Serialize}; use std::{error::Error, fs, process::Command, time::Duration}; -use sysinfo::{ - CpuExt, CpuRefreshKind, DiskExt, MacAddr, MemoryRefreshKind, RefreshKind, System, SystemExt, -}; +use sysinfo::{CpuExt, DiskExt, System, SystemExt}; use tokio::time::{interval, sleep}; // Shared data structures @@ -67,12 +65,7 @@ struct HardwareInfo { impl HardwareInfo { async fn collect() -> Result> { - let mut sys = System::new_with_specifics( - RefreshKind::new() - .with_cpu(CpuRefreshKind::everything()) - .with_memory(MemoryRefreshKind::everything()), - ); - + let mut sys = System::new(); sys.refresh_cpu(); sys.refresh_memory(); @@ -223,7 +216,7 @@ struct MetricsCollector { impl MetricsCollector { fn new(server_id: i32) -> Self { Self { - sys: System::new_all(), + sys: System::new(), nvml: Nvml::init().ok(), server_id, } @@ -309,7 +302,7 @@ impl MetricsCollector { gpu_vram_size: vram_total, gpu_vram_usage: vram_used, ram_load, - ram_size: (total_memory as f32 / 1024.0) as u32, + ram_size: (total_memory / 1024) as u32, disk_size: disk_size as u32, disk_usage: disk_used, disk_temp: 0.0,