diff --git a/agent/src/main.rs b/agent/src/main.rs index 1f7288a..3022eb8 100644 --- a/agent/src/main.rs +++ b/agent/src/main.rs @@ -1,3 +1,4 @@ +use common::MQTT_SEND_INTERVAL; use collector::Collector; use std::time::Duration; use mqtt::MqttHandle; @@ -19,9 +20,6 @@ struct Args { #[arg(long, default_value_t = 1883)] port: u16, - - #[arg(long, short='i', default_value_t = 5)] - interval: u64, } #[tokio::main] @@ -37,6 +35,6 @@ async fn main() -> anyhow::Result<()> { let metrics = collector.collect_all(); client.send_metrics(metrics).await?; - thread::sleep(Duration::from_secs(args.interval)); + thread::sleep(Duration::from_secs(MQTT_SEND_INTERVAL)); } } diff --git a/common/src/lib.rs b/common/src/lib.rs index 9ce5c00..feef517 100644 --- a/common/src/lib.rs +++ b/common/src/lib.rs @@ -6,6 +6,7 @@ use crate::metrics::Metrics; pub mod metrics; pub const MQTT_TOPIC: &str = "system/metrics"; +pub const MQTT_SEND_INTERVAL: u64 = 5; #[derive(Debug, Serialize, Deserialize)] pub struct StatusMessage<'a> {