fixed comments

This commit is contained in:
2025-10-01 12:11:34 +02:00
parent 8c49a63a50
commit f78e48900a
11 changed files with 146 additions and 144 deletions

View File

@@ -1,31 +1,31 @@
//! # WatcherAgent
//!
//! **WatcherAgent** is a cross-platform system monitoring agent written in Rust.
//!
//! ## Overview
//! This agent collects real-time hardware metrics (CPU, GPU, RAM, disk, network) and communicates with a backend server for registration, reporting, and remote control. It is designed for deployment in environments where automated monitoring and remote management of system resources is required.
//!
//! ## Features
//! - **Hardware Metrics:** Collects CPU, GPU, RAM, disk, and network statistics using platform-specific APIs.
//! - **Docker Integration:** Detects and manages its own Docker container, supports image updates and container restarts.
//! - **Server Communication:** Registers with a backend server, sends periodic heartbeats, and reports metrics securely.
//! - **Remote Commands:** Listens for and executes commands from the backend (e.g., update image, restart container, stop agent).
//!
//! ## Modules
//! - [`api`]: Handles HTTP communication with the backend server (registration, heartbeat, metrics, commands).
//! - [`hardware`]: Collects hardware metrics from the host system (CPU, GPU, RAM, disk, network).
//! - [`metrics`]: Orchestrates metric collection and reporting.
//! - [`models`]: Defines data structures for server communication and metrics.
//! - [`docker`]: Integrates with Docker for container management and agent lifecycle.
//!
//! ## Usage
//! Run the agent with the backend server URL as an argument:
//! ```sh
//! watcheragent <server-url>
//! ```
//!
//! The agent will register itself, start collecting metrics, and listen for remote commands.
/// # WatcherAgent
///
/// **WatcherAgent** is a cross-platform system monitoring agent written in Rust.
///
/// ## Overview
/// This agent collects real-time hardware metrics (CPU, GPU, RAM, disk, network) and communicates with a backend server for registration, reporting, and remote control. It is designed for deployment in environments where automated monitoring and remote management of system resources is required.
///
/// ## Features
/// - **Hardware Metrics:** Collects CPU, GPU, RAM, disk, and network statistics using platform-specific APIs.
/// - **Docker Integration:** Detects and manages its own Docker container, supports image updates and container restarts.
/// - **Server Communication:** Registers with a backend server, sends periodic heartbeats, and reports metrics securely.
/// - **Remote Commands:** Listens for and executes commands from the backend (e.g., update image, restart container, stop agent).
///
/// ## Modules
/// - [`api`]: Handles HTTP communication with the backend server (registration, heartbeat, metrics, commands).
/// - [`hardware`]: Collects hardware metrics from the host system (CPU, GPU, RAM, disk, network).
/// - [`metrics`]: Orchestrates metric collection and reporting.
/// - [`models`]: Defines data structures for server communication and metrics.
/// - [`docker`]: Integrates with Docker for container management and agent lifecycle.
///
/// ## Usage
/// Run the agent with the backend server URL as an argument:
/// ```sh
/// watcheragent <server-url>
/// ```
///
/// The agent will register itself, start collecting metrics, and listen for remote commands.
pub mod api;
pub mod hardware;
@@ -34,6 +34,8 @@ pub mod models;
pub mod docker;
use tokio::task::JoinHandle;
use bollard::Docker;
use std::env;
use std::error::Error;