mirror of
https://github.com/csehviktor/status-monitor.git
synced 2026-04-28 08:17:35 +02:00
56 lines
1.1 KiB
Rust
56 lines
1.1 KiB
Rust
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct Metrics {
|
|
pub system_info: SystemInfo,
|
|
pub cpu: CPU,
|
|
pub disk: Disk,
|
|
pub memory: Memory,
|
|
pub network: Network,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
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, Clone, Serialize, Deserialize)]
|
|
pub struct CPU {
|
|
pub usage: f32,
|
|
pub threads: usize,
|
|
pub breakdown: CpuBreakdown,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
|
|
pub struct CpuBreakdown {
|
|
pub system: f32,
|
|
pub user: f32,
|
|
pub idle: f32,
|
|
pub steal: f32,
|
|
pub iowait: f32,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct Disk {
|
|
pub free: u64,
|
|
pub total: u64,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct Memory {
|
|
pub used: u64,
|
|
pub total: u64,
|
|
pub swap_used: u64,
|
|
pub swap_total: u64,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct Network {
|
|
pub down: u64,
|
|
pub up: u64,
|
|
}
|