Implement complete structured data architecture
All checks were successful
Build and Release / build-and-release (push) Successful in 2m10s
All checks were successful
Build and Release / build-and-release (push) Successful in 2m10s
Replace fragile string-based metrics with type-safe JSON data structures. Agent converts all metrics to structured data, dashboard processes typed fields. Changes: - Add AgentData struct with CPU, memory, storage, services, backup fields - Replace string parsing with direct field access throughout system - Maintain UI compatibility via temporary metric bridge conversion - Fix NVMe temperature display and eliminate string parsing bugs - Update protocol to support structured data transmission over ZMQ - Comprehensive metric type coverage: CPU, memory, storage, services, backup Version bump to 0.1.131
This commit is contained in:
@@ -185,42 +185,35 @@ impl Dashboard {
|
||||
|
||||
// Check for new metrics
|
||||
if last_metrics_check.elapsed() >= metrics_check_interval {
|
||||
if let Ok(Some(metric_message)) = self.zmq_consumer.receive_metrics().await {
|
||||
if let Ok(Some(agent_data)) = self.zmq_consumer.receive_agent_data().await {
|
||||
debug!(
|
||||
"Received metrics from {}: {} metrics",
|
||||
metric_message.hostname,
|
||||
metric_message.metrics.len()
|
||||
"Received agent data from {}",
|
||||
agent_data.hostname
|
||||
);
|
||||
|
||||
// Track first contact with host (no command needed - agent sends data every 2s)
|
||||
let is_new_host = !self
|
||||
.initial_commands_sent
|
||||
.contains(&metric_message.hostname);
|
||||
.contains(&agent_data.hostname);
|
||||
|
||||
if is_new_host {
|
||||
info!(
|
||||
"First contact with host {} - data will update automatically",
|
||||
metric_message.hostname
|
||||
agent_data.hostname
|
||||
);
|
||||
self.initial_commands_sent
|
||||
.insert(metric_message.hostname.clone());
|
||||
.insert(agent_data.hostname.clone());
|
||||
}
|
||||
|
||||
// Show raw data if requested (before processing)
|
||||
if self.raw_data {
|
||||
println!("RAW METRICS FROM {}: {} metrics", metric_message.hostname, metric_message.metrics.len());
|
||||
for metric in &metric_message.metrics {
|
||||
println!(" {}: {:?} ({:?})", metric.name, metric.value, metric.status);
|
||||
if let Some(desc) = &metric.description {
|
||||
println!(" └─ {}", desc);
|
||||
}
|
||||
}
|
||||
println!("RAW AGENT DATA FROM {}:", agent_data.hostname);
|
||||
println!("{}", serde_json::to_string_pretty(&agent_data).unwrap_or_else(|e| format!("Serialization error: {}", e)));
|
||||
println!("{}", "─".repeat(80));
|
||||
}
|
||||
|
||||
// Update metric store
|
||||
self.metric_store
|
||||
.update_metrics(&metric_message.hostname, metric_message.metrics);
|
||||
// Update data store
|
||||
self.metric_store.process_agent_data(agent_data);
|
||||
|
||||
// Check for agent version mismatches across hosts
|
||||
if let Some((current_version, outdated_hosts)) = self.metric_store.get_version_mismatches() {
|
||||
|
||||
Reference in New Issue
Block a user