changed Dtos and Docker structs

This commit is contained in:
2025-10-04 22:05:28 +02:00
parent bb55b46c34
commit b35cac0dbe
8 changed files with 73 additions and 38 deletions

View File

@@ -308,7 +308,7 @@ pub async fn listening_to_server(
///
/// # Returns
/// * `Result<(), Box<dyn Error + Send + Sync>>` - Ok if acknowledgment is sent successfully.
async fn send_acknowledgment(
pub async fn send_acknowledgment(
client: &reqwest::Client,
base_url: &str,
message_id: &str,
@@ -339,3 +339,27 @@ async fn send_acknowledgment(
Ok(())
}
pub async fn send_docker_metrics(
base_url: &str,
docker_metrics: &MetricDto,
) -> Result<(), Box<dyn Error + Send + Sync>> {
let client = Client::new();
let url = format!("{}/monitoring/docker-metric", base_url);
println!("Metrics: {:?}", docker_metrics);
match client.post(&url).json(&docker_metrics).send().await {
Ok(res) => println!(
"✅ Sent metrics for server {} | Status: {}",
docker_metrics.server_id,
res.status()
),
Err(err) => eprintln!("❌ Failed to send metrics: {}", err),
}
Ok(())
}
pub async fn broadcast_docker_containers() {
// Placeholder for future implementation
}