added docker registration dto

This commit is contained in:
2025-10-09 10:39:52 +02:00
parent 711083daa0
commit c7bce926e9
3 changed files with 94 additions and 16 deletions

View File

@@ -189,26 +189,28 @@ pub struct Acknowledgment {
pub struct DockerRegistrationDto {
/// Unique server identifier (integer)
pub server_id: u16,
/// Number of currently running containers
pub container_count: usize,
/// json stringified array of DockerContainer
///
///
/// ## Json Example
/// json format: [{"id":"234dsf234","image":"nginx:latest","name":"webserver"},...]
///
///
/// ## Fields
/// id: unique container ID (first 12 hex digits)
/// image: docker image name
/// name: container name
pub containers: String // Vec<DockerContainer>,
pub containers: String, // Vec<DockerContainer>,
}
#[derive(Debug, Serialize, Clone)]
pub struct DockerMetricDto {
pub server_id: u16,
/// json stringified array of DockerContainer
///
///
/// ## Json Example
/// json format: [{"id":"234dsf234","status":"running","image":"nginx:latest","name":"webserver","network":{"net_in":1024,"net_out":2048},"cpu":{"cpu_load":12.5},"ram":{"ram_load":10.0}},...]
///
///
/// ## Fields
/// id: unique container ID (first 12 hex digits)
/// status: "running";"stopped";others
@@ -217,7 +219,33 @@ pub struct DockerMetricDto {
/// network: network stats
/// cpu: cpu stats
/// ram: ram stats
pub containers: String // Vec<DockerContainerInfo>,
pub containers: String, // Vec<DockerContainerInfo>,
}
#[derive(Debug, Serialize, Clone)]
pub struct DockerCollectMetricDto {
pub id: String,
pub cpu: DockerContainerCpuDto,
pub ram: DockerContainerRamDto,
pub network: DockerContainerNetworkDto,
}
#[derive(Debug, Serialize, Clone)]
pub struct DockerContainerCpuDto {
pub cpu_load: Option<f64>,
}
#[derive(Debug, Serialize, Clone)]
pub struct DockerContainerRamDto {
pub cpu_load: Option<f64>,
}
#[derive(Debug, Serialize, Clone)]
pub struct DockerContainerNetworkDto {
pub net_in: Option<f64>,
pub net_out: Option<f64>,
}
#[derive(Debug, Serialize, Clone)]
@@ -234,4 +262,4 @@ pub struct DockerContainer {
pub id: String,
pub image: Option<String>,
pub name: Option<String>,
}
}