Remove hardcoded /tmp autodetection and implement proper tmpfs monitoring

- Remove /tmp autodetection from disk collector (57 lines removed)
- Add tmpfs monitoring to memory collector with get_tmpfs_metrics() method
- Generate memory_tmp_* metrics for proper RAM-based tmpfs monitoring
- Fix type annotations in tmpfs parsing for compilation
- System widget now correctly displays tmpfs usage in RAM section
This commit is contained in:
2025-10-23 14:26:15 +02:00
parent 39fc9cd22f
commit 9e80d6b654
3 changed files with 95 additions and 75 deletions

View File

@@ -202,7 +202,10 @@ impl SystemWidget {
}
}
self.storage_pools = pools.into_values().collect();
// Convert to sorted vec for consistent ordering
let mut pool_list: Vec<StoragePool> = pools.into_values().collect();
pool_list.sort_by(|a, b| a.name.cmp(&b.name)); // Sort alphabetically by name
self.storage_pools = pool_list;
}
/// Extract pool name from disk metric name
@@ -354,21 +357,6 @@ impl Widget for SystemWidget {
self.memory_total_gb = Some(total);
}
}
"disk_tmp_usage_percent" => {
if let MetricValue::Float(usage) = metric.value {
self.tmp_usage_percent = Some(usage);
}
}
"disk_tmp_used_gb" => {
if let MetricValue::Float(used) = metric.value {
self.tmp_used_gb = Some(used);
}
}
"disk_tmp_total_gb" => {
if let MetricValue::Float(total) = metric.value {
self.tmp_total_gb = Some(total);
}
}
_ => {}
}
}
@@ -430,8 +418,7 @@ impl Widget for SystemWidget {
// Storage section with tree structure
lines.extend(self.render_storage());
let paragraph = Paragraph::new(Text::from(lines))
.block(Block::default().borders(Borders::ALL).title("System"));
let paragraph = Paragraph::new(Text::from(lines));
frame.render_widget(paragraph, area);
}