all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Lukas Wagner <l.wagner@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [PATCH datacenter-manager v3 09/11] pdm-api-types: add PDM host metric fields
Date: Mon, 13 Apr 2026 10:58:14 +0200	[thread overview]
Message-ID: <20260413085816.143591-10-l.wagner@proxmox.com> (raw)
In-Reply-To: <20260413085816.143591-1-l.wagner@proxmox.com>

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
Reviewed-by: Arthur Bied-Charreton <a.bied-charreton@proxmox.com>
Tested-by: Arthur Bied-Charreton <a.bied-charreton@proxmox.com>
---
 lib/pdm-api-types/src/rrddata.rs | 72 +++++++++++++++++++++++++++++++-
 server/src/api/nodes/rrddata.rs  | 55 ++++++++++++++++++++++--
 2 files changed, 122 insertions(+), 5 deletions(-)

diff --git a/lib/pdm-api-types/src/rrddata.rs b/lib/pdm-api-types/src/rrddata.rs
index 6eaaff3c..452597a8 100644
--- a/lib/pdm-api-types/src/rrddata.rs
+++ b/lib/pdm-api-types/src/rrddata.rs
@@ -233,13 +233,81 @@ pub struct PbsDatastoreDataPoint {
 }
 
 #[api]
-#[derive(Serialize, Deserialize, Default)]
+#[derive(Serialize, Deserialize, Default, Debug)]
 #[serde(rename_all = "kebab-case")]
 /// RRD datapoint for statistics about the metric collection loop.
 pub struct PdmNodeDatapoint {
     /// Timestamp (UNIX epoch)
     pub time: u64,
-
+    /// Current CPU utilization
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub cpu_current: Option<f64>,
+    /// Current IO wait
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub cpu_iowait: Option<f64>,
+    /// CPU utilization, averaged over the last minute
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub cpu_avg1: Option<f64>,
+    /// CPU utilization, averaged over the last five minutes
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub cpu_avg5: Option<f64>,
+    /// CPU utilization, averaged over the last fifteen minutes
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub cpu_avg15: Option<f64>,
+    /// Total root disk size
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub disk_total: Option<f64>,
+    /// Total root disk usage
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub disk_used: Option<f64>,
+    /// Root disk read IOPS
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub disk_read_iops: Option<f64>,
+    /// Root disk write IOPS
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub disk_write_iops: Option<f64>,
+    /// Root disk read rate
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub disk_read: Option<f64>,
+    /// Root disk write rate
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub disk_write: Option<f64>,
+    /// Root disk IO ticks
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub disk_io_ticks: Option<f64>,
+    /// Total memory size
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub mem_total: Option<f64>,
+    /// Currently used memory
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub mem_used: Option<f64>,
+    /// Total swap size
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub swap_total: Option<f64>,
+    /// Current swap usage
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub swap_used: Option<f64>,
+    /// Inbound network data rate
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub net_in: Option<f64>,
+    /// Outbound network data rate
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub net_out: Option<f64>,
+    /// Average 'some' CPU pressure over the last 10 minutes.
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub cpu_pressure_some_avg10: Option<f64>,
+    /// Average 'some' memory pressure over the last 10 minutes.
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub mem_pressure_some_avg10: Option<f64>,
+    /// Average 'full' memory pressure over the last 10 minutes.
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub mem_pressure_full_avg10: Option<f64>,
+    /// Average 'some' IO pressure over the last 10 minutes.
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub io_pressure_some_avg10: Option<f64>,
+    /// Average 'full' IO pressure over the last 10 minutes.
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub io_pressure_full_avg10: Option<f64>,
     /// Total time in milliseconds needed for full metric collection run.
     #[serde(skip_serializing_if = "Option::is_none")]
     pub metric_collection_total_time: Option<f64>,
diff --git a/server/src/api/nodes/rrddata.rs b/server/src/api/nodes/rrddata.rs
index 00c4eee0..8ba11a5f 100644
--- a/server/src/api/nodes/rrddata.rs
+++ b/server/src/api/nodes/rrddata.rs
@@ -18,12 +18,61 @@ impl DataPoint for PdmNodeDatapoint {
     }
 
     fn fields() -> &'static [&'static str] {
-        &["metric-collection-total-time"]
+        &[
+            "cpu-current",
+            "cpu-iowait",
+            "cpu-avg1",
+            "cpu-avg5",
+            "cpu-avg15",
+            "cpu-pressure-some-avg10",
+            "disk-total",
+            "disk-used",
+            "disk-read-iops",
+            "disk-write-iops",
+            "disk-read",
+            "disk-write",
+            "disk-io-ticks",
+            "io-pressure-some-avg10",
+            "io-pressure-full-avg10",
+            "mem-total",
+            "mem-used",
+            "mem-pressure-some-avg10",
+            "mem-pressure-full-avg10",
+            "swap-total",
+            "swap-used",
+            "net-in",
+            "net-out",
+            "metric-collection-total-time",
+        ]
     }
 
     fn set_field(&mut self, name: &str, value: f64) {
-        if name == "metric-collection-total-time" {
-            self.metric_collection_total_time = Some(value);
+        match name {
+            "cpu-current" => self.cpu_current = Some(value),
+            "cpu-iowait" => self.cpu_iowait = Some(value),
+            "cpu-avg1" => self.cpu_avg1 = Some(value),
+            "cpu-avg5" => self.cpu_avg5 = Some(value),
+            "cpu-avg15" => self.cpu_avg15 = Some(value),
+            "cpu-pressure-some-avg10" => self.cpu_pressure_some_avg10 = Some(value),
+            "disk-total" => self.disk_total = Some(value),
+            "disk-used" => self.disk_used = Some(value),
+            "disk-read-iops" => self.disk_read_iops = Some(value),
+            "disk-write-iops" => self.disk_write_iops = Some(value),
+            "disk-read" => self.disk_read = Some(value),
+            "disk-write" => self.disk_write = Some(value),
+            "disk-io-ticks" => self.disk_io_ticks = Some(value),
+            "io-pressure-some-avg10" => self.io_pressure_some_avg10 = Some(value),
+            "io-pressure-full-avg10" => self.io_pressure_full_avg10 = Some(value),
+            "mem-total" => self.mem_total = Some(value),
+            "mem-used" => self.mem_used = Some(value),
+            "mem-pressure-some-avg10" => self.mem_pressure_some_avg10 = Some(value),
+            "mem-pressure-full-avg10" => self.mem_pressure_full_avg10 = Some(value),
+            "swap-total" => self.swap_total = Some(value),
+            "swap-used" => self.swap_used = Some(value),
+            "net-in" => self.net_in = Some(value),
+            "net-out" => self.net_out = Some(value),
+            "metric-collection-total-time" => self.metric_collection_total_time = Some(value),
+            _ => log::error!("setting invalid field '{name}' in PdmNodeDatapoint"),
         }
     }
 }
-- 
2.47.3





  parent reply	other threads:[~2026-04-13  8:57 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-13  8:58 [PATCH datacenter-manager/proxmox-yew-comp v3 00/11] metric collection for the PDM host Lukas Wagner
2026-04-13  8:58 ` [PATCH proxmox-yew-comp v3 01/11] node status panel: add `children` property Lukas Wagner
2026-04-13  8:58 ` [PATCH proxmox-yew-comp v3 02/11] RRDGrid: fix size observer by attaching node reference to rendered container Lukas Wagner
2026-04-13  8:58 ` [PATCH proxmox-yew-comp v3 03/11] RRDGrid: add padding and increase gap between elements Lukas Wagner
2026-04-13  8:58 ` [PATCH datacenter-manager v3 04/11] metric collection: clarify naming for remote metric collection Lukas Wagner
2026-04-13  8:58 ` [PATCH datacenter-manager v3 05/11] metric collection: fix minor typo in error message Lukas Wagner
2026-04-13  8:58 ` [PATCH datacenter-manager v3 06/11] metric collection: collect PDM host metrics in a new collection task Lukas Wagner
2026-04-15  8:47   ` Shannon Sterz
2026-04-13  8:58 ` [PATCH datacenter-manager v3 07/11] api: fix /nodes/localhost/rrddata endpoint Lukas Wagner
2026-04-13  8:58 ` [PATCH datacenter-manager v3 08/11] pdm: node rrd data: rename 'total-time' to 'metric-collection-total-time' Lukas Wagner
2026-04-13  8:58 ` Lukas Wagner [this message]
2026-04-13  8:58 ` [PATCH datacenter-manager v3 10/11] ui: node status: add RRD graphs for PDM host metrics Lukas Wagner
2026-04-15  8:47   ` Shannon Sterz
2026-04-15 12:20     ` Lukas Wagner
2026-04-13  8:58 ` [PATCH datacenter-manager v3 11/11] ui: lxc/qemu/node: use RRD value render helpers Lukas Wagner
2026-04-14 14:08 ` [PATCH datacenter-manager/proxmox-yew-comp v3 00/11] metric collection for the PDM host Michael Köppl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260413085816.143591-10-l.wagner@proxmox.com \
    --to=l.wagner@proxmox.com \
    --cc=pdm-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal