fix(agent): filtrage CPU/RAM par config + nettoyage commentaires

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Gilles Soulier
2026-05-22 11:49:05 +02:00
parent 12203f453f
commit 331415bbab
2 changed files with 9 additions and 5 deletions
+9 -4
View File
@@ -69,14 +69,19 @@ fn main() {
hostname: hostname.clone(),
ip: ip.clone(),
status: "online".to_string(),
cpu_percent: Some(metrics::cpu::get(&sys)),
..Default::default()
};
if cfg.metrics.cpu.udp || cfg.metrics.cpu.mqtt {
m.cpu_percent = Some(metrics::cpu::get(&sys));
}
let (mem_used, mem_free, mem_total) = metrics::memory::get(&sys);
m.memory_used = Some(mem_used);
m.memory_free = Some(mem_free);
m.memory_total = Some(mem_total);
if cfg.metrics.memory.udp || cfg.metrics.memory.mqtt {
m.memory_used = Some(mem_used);
m.memory_free = Some(mem_free);
m.memory_total = Some(mem_total);
}
if first_medium || now.duration_since(last_medium).as_secs() >= 10 {
networks.refresh();
-1
View File
@@ -1,4 +1,3 @@
// stub — implémenté dans la Task 3
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug, Default)]