added docker management
All checks were successful
Rust Cross-Platform Build / Detect Rust Project (push) Successful in 4s
Rust Cross-Platform Build / Set Tag Name (push) Successful in 4s
Rust Cross-Platform Build / Run Tests (push) Successful in 1m2s
Rust Cross-Platform Build / Build (x86_64-unknown-linux-gnu) (push) Successful in 2m18s
Rust Cross-Platform Build / Build (x86_64-pc-windows-gnu) (push) Successful in 3m25s
Rust Cross-Platform Build / Build and Push Docker Image (push) Successful in 2m0s
Rust Cross-Platform Build / Workflow Summary (push) Successful in 2s
Rust Cross-Platform Build / Create Tag (push) Successful in 5s

This commit is contained in:
2025-10-03 20:42:35 +02:00
parent 2f5e2391f7
commit bfeb43f38a
8 changed files with 668 additions and 255 deletions

View File

@@ -9,6 +9,8 @@
///
/// ## Usage
/// These types are serialized/deserialized for HTTP communication and used throughout the agent for data exchange.
use crate::docker::stats;
use serde::{Deserialize, Serialize};
/// Registration data sent to the backend server.
@@ -23,7 +25,7 @@ use serde::{Deserialize, Serialize};
#[derive(Serialize, Debug)]
pub struct RegistrationDto {
#[serde(rename = "id")]
pub id: i32,
pub server_id: i32,
#[serde(rename = "ipAddress")]
pub ip_address: String,
#[serde(rename = "cpuType")]
@@ -184,12 +186,22 @@ pub struct Acknowledgment {
/// - `_net_out`: Network transmit rate in **bytes per second (B/s)**
/// - `_cpu_load`: CPU usage as a percentage (**0.0100.0**)
#[derive(Debug, Serialize, Clone)]
pub struct DockerContainer {
pub ID: String,
pub image: String,
pub Name: String,
pub Status: String, // "running";"stopped";others
pub _net_in: f64,
pub _net_out: f64,
pub _cpu_load: f64,
pub struct DockerContainerRegistrationDto {
pub server_id: u32,
pub containers: Vec<DockerContainerDto>,
}
#[derive(Debug, Serialize, Clone)]
pub struct DockerContainerDto {
pub id: String,
pub image: String,
pub name: String,
}
#[derive(Debug, Serialize, Clone)]
pub struct DockerContainerMetricDto {
pub id: String,
pub status: String, // "running";"stopped";others
pub network: stats::ContainerNetworkInfo,
pub cpu: stats::ContainerCpuInfo,
}