From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: Dominik Csapak <d.csapak@proxmox.com>, pdm-devel@lists.proxmox.com
Subject: Re: [PATCH datacenter-manager 1/4] api: return global cpu/memory/storage statistics
Date: Wed, 25 Mar 2026 17:49:35 +0100 [thread overview]
Message-ID: <349c4dde-549c-4a06-a20b-094b6a4cad78@proxmox.com> (raw)
In-Reply-To: <20260323110728.1500528-2-d.csapak@proxmox.com>
Am 23.03.26 um 12:06 schrieb Dominik Csapak:
> Global CPU/memory/storage usage (per remote type) is useful and
> interesting from an administration POV. Calculate and return these so
> we can use them on the dashboards.
>
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
> lib/pdm-api-types/src/lib.rs | 2 +-
> lib/pdm-api-types/src/resource.rs | 27 +++++++++++++
> server/src/api/resources.rs | 65 ++++++++++++++++++++++++-------
> 3 files changed, 80 insertions(+), 14 deletions(-)
>
> diff --git a/lib/pdm-api-types/src/lib.rs b/lib/pdm-api-types/src/lib.rs
> index d4cc7ef0..9bccd50f 100644
> --- a/lib/pdm-api-types/src/lib.rs
> +++ b/lib/pdm-api-types/src/lib.rs
> @@ -191,7 +191,7 @@ pub const PVE_STORAGE_ID_SCHEMA: Schema = StringSchema::new("Storage ID.")
> // Complex type definitions
>
> #[api()]
> -#[derive(Default, Serialize, Deserialize)]
> +#[derive(Default, Serialize, Deserialize, PartialEq, Clone)]
> /// Storage space usage information.
> pub struct StorageStatus {
> /// Total space (bytes).
> diff --git a/lib/pdm-api-types/src/resource.rs b/lib/pdm-api-types/src/resource.rs
> index d2db3b5a..1f74e09c 100644
> --- a/lib/pdm-api-types/src/resource.rs
> +++ b/lib/pdm-api-types/src/resource.rs
> @@ -666,6 +668,18 @@ pub struct SdnZoneCount {
> pub unknown: u64,
> }
>
> +#[api]
> +#[derive(Default, Serialize, Deserialize, Clone, PartialEq)]
> +/// Statistics for CPU utilization
> +pub struct CpuStatistics {
> + /// Amount of threads utilized
> + pub used: f64,
> + /// Amount of physically available cpu threads
> + pub max: f64,
> + /// Currently allocated cores of running guests (only on PVE)
> + pub allocated: Option<f64>,
> +}
> +
> #[api(
> properties: {
> "failed_remotes_list": {
> @@ -697,6 +711,19 @@ pub struct ResourcesStatus {
> pub pbs_nodes: NodeStatusCount,
> /// Status of PBS Datastores
> pub pbs_datastores: PbsDatastoreStatusCount,
> + /// Combined CPU statistics for all PVE remotes
> + pub pve_cpu_stats: CpuStatistics,
> + /// Combined CPU statistics for all PBS remotes
> + pub pbs_cpu_stats: CpuStatistics,
> + /// Combined Memory statistics for all PVE remotes
> + pub pve_memory_stats: StorageStatus,
> + /// Combined Memory statistics for all PBS remotes
> + pub pbs_memory_stats: StorageStatus,
should above two memory fields also use a type named MemoryStatus or the
like, or is this reused because the fields are basically the same anyway?
A type alias might still make sense to have in the latter case for more
clarity that this is on purpose and nothing against dedicated types even
if they got the same fields, as they refer to different things nonetheless,
as e.g. a hypothetical Display impl would likely differ (IEC vs SI units).
> + /// Combined Storage statistics for all PVE remotes (shared storages are only counted once per
> + /// remote).
> + pub pve_storage_stats: StorageStatus,
> + /// Combined Storage statistics for all PBS remotes
> + pub pbs_storage_stats: StorageStatus,
> /// List of the failed remotes including type and error
> #[serde(default, skip_serializing_if = "Vec::is_empty")]
> pub failed_remotes_list: Vec<FailedRemote>,
next prev parent reply other threads:[~2026-03-25 16:49 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-23 11:03 [PATCH datacenter-manager 0/4] add resource gauge panels to dashboard/views Dominik Csapak
2026-03-23 11:03 ` [PATCH datacenter-manager 1/4] api: return global cpu/memory/storage statistics Dominik Csapak
2026-03-25 16:49 ` Thomas Lamprecht [this message]
2026-03-26 7:59 ` Dominik Csapak
2026-03-23 11:03 ` [PATCH datacenter-manager 2/4] ui: css: use mask for svg icons Dominik Csapak
2026-03-23 11:03 ` [PATCH datacenter-manager 3/4] ui: dashboard: add new gauge panels widget type Dominik Csapak
2026-03-23 11:03 ` [PATCH datacenter-manager 4/4] ui: dashboard: add resource gauges to default dashboard Dominik Csapak
2026-03-24 10:25 ` [PATCH datacenter-manager 0/4] add resource gauge panels to dashboard/views Lukas Wagner
2026-03-25 11:48 ` Thomas Lamprecht
2026-03-25 13:12 ` Dominik Csapak
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=349c4dde-549c-4a06-a20b-094b6a4cad78@proxmox.com \
--to=t.lamprecht@proxmox.com \
--cc=d.csapak@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.