Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7d6b5165c1 |
@@ -430,7 +430,7 @@ pub async fn send_docker_metrics(
|
|||||||
) -> Result<(), Box<dyn Error + Send + Sync>> {
|
) -> Result<(), Box<dyn Error + Send + Sync>> {
|
||||||
let client = Client::new();
|
let client = Client::new();
|
||||||
let url = format!("{}/monitoring/docker-metric", base_url);
|
let url = format!("{}/monitoring/docker-metric", base_url);
|
||||||
|
|
||||||
println!("Docker Metrics: {}", serde_json::to_string_pretty(&docker_metrics)?);
|
println!("Docker Metrics: {}", serde_json::to_string_pretty(&docker_metrics)?);
|
||||||
|
|
||||||
match client.post(&url).json(&docker_metrics).send().await {
|
match client.post(&url).json(&docker_metrics).send().await {
|
||||||
|
|||||||
@@ -238,7 +238,7 @@ impl DockerManager {
|
|||||||
let container_infos: Vec<DockerCollectMetricDto> = container_infos_total
|
let container_infos: Vec<DockerCollectMetricDto> = container_infos_total
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.filter_map(|info| {
|
.filter_map(|info| {
|
||||||
let container = match info.container {
|
let _container = match info.container {
|
||||||
Some(c) => c,
|
Some(c) => c,
|
||||||
None => {
|
None => {
|
||||||
eprintln!("Warning: Container info missing container data, skipping");
|
eprintln!("Warning: Container info missing container data, skipping");
|
||||||
@@ -286,7 +286,7 @@ impl DockerManager {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Some(DockerCollectMetricDto {
|
Some(DockerCollectMetricDto {
|
||||||
id: container.id,
|
server_id: 0,
|
||||||
status: status_dto,
|
status: status_dto,
|
||||||
cpu: cpu_dto,
|
cpu: cpu_dto,
|
||||||
ram: ram_dto,
|
ram: ram_dto,
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ pub struct ServerMessage {
|
|||||||
// Define your message structure here
|
// Define your message structure here
|
||||||
pub message_type: String,
|
pub message_type: String,
|
||||||
pub data: serde_json::Value,
|
pub data: serde_json::Value,
|
||||||
pub message_id: String, // Add an ID for acknowledgment
|
pub message_id: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Acknowledgment payload sent to the backend server for command messages.
|
/// Acknowledgment payload sent to the backend server for command messages.
|
||||||
@@ -225,7 +225,7 @@ pub struct DockerMetricDto {
|
|||||||
#[derive(Debug, Serialize, Clone)]
|
#[derive(Debug, Serialize, Clone)]
|
||||||
|
|
||||||
pub struct DockerCollectMetricDto {
|
pub struct DockerCollectMetricDto {
|
||||||
pub id: String,
|
pub server_id: u16,
|
||||||
pub status: DockerContainerStatusDto,
|
pub status: DockerContainerStatusDto,
|
||||||
pub cpu: DockerContainerCpuDto,
|
pub cpu: DockerContainerCpuDto,
|
||||||
pub ram: DockerContainerRamDto,
|
pub ram: DockerContainerRamDto,
|
||||||
|
|||||||
Reference in New Issue
Block a user