mirror of
https://github.com/csehviktor/status-monitor.git
synced 2025-08-08 18:06:14 +02:00
init
This commit is contained in:
7
common/Cargo.toml
Normal file
7
common/Cargo.toml
Normal 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
1
common/src/lib.rs
Normal file
@@ -0,0 +1 @@
|
||||
pub mod metrics;
|
||||
47
common/src/metrics.rs
Normal file
47
common/src/metrics.rs
Normal 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,
|
||||
}
|
||||
Reference in New Issue
Block a user