Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5e08b34280 | |||
| 0d8284b69c | |||
| d84690cb3b |
6
Cargo.lock
generated
6
Cargo.lock
generated
@@ -279,7 +279,7 @@ checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cm-dashboard"
|
name = "cm-dashboard"
|
||||||
version = "0.1.208"
|
version = "0.1.211"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"chrono",
|
"chrono",
|
||||||
@@ -301,7 +301,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cm-dashboard-agent"
|
name = "cm-dashboard-agent"
|
||||||
version = "0.1.208"
|
version = "0.1.211"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
@@ -324,7 +324,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cm-dashboard-shared"
|
name = "cm-dashboard-shared"
|
||||||
version = "0.1.208"
|
version = "0.1.211"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"serde",
|
"serde",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "cm-dashboard-agent"
|
name = "cm-dashboard-agent"
|
||||||
version = "0.1.209"
|
version = "0.1.212"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ impl Agent {
|
|||||||
|
|
||||||
// Set up intervals
|
// Set up intervals
|
||||||
let mut transmission_interval = interval(Duration::from_secs(
|
let mut transmission_interval = interval(Duration::from_secs(
|
||||||
self.config.collection_interval_seconds,
|
self.config.zmq.transmission_interval_seconds,
|
||||||
));
|
));
|
||||||
let mut notification_interval = interval(Duration::from_secs(30)); // Check notifications every 30s
|
let mut notification_interval = interval(Duration::from_secs(30)); // Check notifications every 30s
|
||||||
|
|
||||||
|
|||||||
@@ -135,10 +135,23 @@ impl CpuCollector {
|
|||||||
if let Ok(time_str) = utils::read_proc_file(&time_path) {
|
if let Ok(time_str) = utils::read_proc_file(&time_path) {
|
||||||
if let Ok(time) = utils::parse_u64(time_str.trim()) {
|
if let Ok(time) = utils::parse_u64(time_str.trim()) {
|
||||||
if let Ok(name) = utils::read_proc_file(&name_path) {
|
if let Ok(name) = utils::read_proc_file(&name_path) {
|
||||||
let state_name = name.trim().to_string();
|
let state_name = name.trim();
|
||||||
// Skip POLL state (not real idle)
|
// Skip POLL state (not real idle)
|
||||||
if state_name != "POLL" && time > 0 {
|
if state_name != "POLL" && time > 0 {
|
||||||
cstate_times.push((state_name, time));
|
// Extract "C" + digits pattern (C3, C10, etc.) to reduce JSON size
|
||||||
|
// Handles formats like "C3_ACPI", "C10_MWAIT", etc.
|
||||||
|
let clean_name = if let Some(c_pos) = state_name.find('C') {
|
||||||
|
let rest = &state_name[c_pos + 1..];
|
||||||
|
let digit_count = rest.chars().take_while(|c| c.is_ascii_digit()).count();
|
||||||
|
if digit_count > 0 {
|
||||||
|
state_name[c_pos..c_pos + 1 + digit_count].to_string()
|
||||||
|
} else {
|
||||||
|
state_name.to_string()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
state_name.to_string()
|
||||||
|
};
|
||||||
|
cstate_times.push((clean_name, time));
|
||||||
total_time += time;
|
total_time += time;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ pub struct AgentConfig {
|
|||||||
pub collectors: CollectorConfig,
|
pub collectors: CollectorConfig,
|
||||||
pub cache: CacheConfig,
|
pub cache: CacheConfig,
|
||||||
pub notifications: NotificationConfig,
|
pub notifications: NotificationConfig,
|
||||||
pub collection_interval_seconds: u64,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ZMQ communication configuration
|
/// ZMQ communication configuration
|
||||||
|
|||||||
@@ -11,9 +11,9 @@ pub fn validate_config(config: &AgentConfig) -> Result<()> {
|
|||||||
bail!("ZMQ bind address cannot be empty");
|
bail!("ZMQ bind address cannot be empty");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate collection interval
|
// Validate ZMQ transmission interval
|
||||||
if config.collection_interval_seconds == 0 {
|
if config.zmq.transmission_interval_seconds == 0 {
|
||||||
bail!("Collection interval cannot be 0");
|
bail!("ZMQ transmission interval cannot be 0");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate CPU thresholds
|
// Validate CPU thresholds
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "cm-dashboard"
|
name = "cm-dashboard"
|
||||||
version = "0.1.209"
|
version = "0.1.212"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|||||||
@@ -144,6 +144,7 @@ impl SystemWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Format top 3 C-states with percentages: "C10:79% C8:10% C6:8%"
|
// Format top 3 C-states with percentages: "C10:79% C8:10% C6:8%"
|
||||||
|
// Agent already sends clean names (C3, C10, etc.)
|
||||||
self.cpu_cstates
|
self.cpu_cstates
|
||||||
.iter()
|
.iter()
|
||||||
.map(|cs| format!("{}:{:.0}%", cs.name, cs.percent))
|
.map(|cs| format!("{}:{:.0}%", cs.name, cs.percent))
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "cm-dashboard-shared"
|
name = "cm-dashboard-shared"
|
||||||
version = "0.1.209"
|
version = "0.1.212"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|||||||
Reference in New Issue
Block a user