Implement multi-host autoconnect with consolidated host configuration

- Add DEFAULT_HOSTS constant in config.rs for centralized host management
- Update ZMQ endpoint generation to connect to all configured hosts
- Implement graceful connection handling for unreachable endpoints
- Dashboard now auto-discovers and connects to available agents on cmbox, labbox, simonbox, steambox, srv01
This commit is contained in:
2025-10-14 00:44:38 +02:00
parent c8655bf852
commit dca3642e46
3 changed files with 46 additions and 13 deletions

View File

@@ -249,12 +249,25 @@ fn metrics_blocking_loop(
.set_rcvtimeo(1_000)
.context("failed to configure ZMQ receive timeout")?;
let mut connected_endpoints = 0;
for endpoint in context.endpoints() {
debug!(%endpoint, "connecting to ZMQ endpoint");
socket
.connect(endpoint)
.with_context(|| format!("failed to connect to {endpoint}"))?;
debug!(%endpoint, "attempting to connect to ZMQ endpoint");
match socket.connect(endpoint) {
Ok(()) => {
debug!(%endpoint, "successfully connected to ZMQ endpoint");
connected_endpoints += 1;
}
Err(error) => {
warn!(%endpoint, %error, "failed to connect to ZMQ endpoint, continuing with others");
}
}
}
if connected_endpoints == 0 {
return Err(anyhow!("failed to connect to any ZMQ endpoints"));
}
debug!("connected to {}/{} ZMQ endpoints", connected_endpoints, context.endpoints().len());
if let Some(prefix) = context.subscription() {
socket