This commit is contained in:
csehviktor
2025-06-29 02:44:39 +02:00
commit c83e5c86e0
11 changed files with 474 additions and 0 deletions

7
common/Cargo.toml Normal file
View File

@@ -0,0 +1,7 @@
[package]
name = "common"
version = "0.1.0"
edition = "2024"
[dependencies]
serde = { version = "1.0.219", features = ["derive"] }

1
common/src/lib.rs Normal file
View File

@@ -0,0 +1 @@
pub mod metrics;

47
common/src/metrics.rs Normal file
View File

@@ -0,0 +1,47 @@
use serde::Serialize;
#[derive(Debug, Serialize)]
pub struct Metrics {
pub system_info: SystemInfo,
pub cpu: CPU,
pub disk: Disk,
pub memory: Memory,
pub network: Network,
}
#[derive(Debug, Serialize)]
pub struct SystemInfo {
pub uptime: u64,
pub host: Option<String>,
pub name: Option<String>,
pub kernel: Option<String>,
pub os_version: Option<String>,
}
#[derive(Debug, Serialize)]
pub struct CPU {
pub brand: String,
pub usage: f32,
pub threads: usize,
}
#[derive(Debug, Serialize)]
pub struct Disk {
pub used: u64,
pub free: u64,
pub total: u64,
}
#[derive(Debug, Serialize)]
pub struct Memory {
pub used: u64,
pub total: u64,
pub swap_used: u64,
pub swap_total: u64,
}
#[derive(Debug, Serialize)]
pub struct Network {
pub down: u64,
pub up: u64,
}