From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id A97C31FF137 for ; Tue, 31 Mar 2026 15:25:30 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 2ACB31DC26; Tue, 31 Mar 2026 15:25:58 +0200 (CEST) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Tue, 31 Mar 2026 15:25:52 +0200 Message-Id: From: "Daniel Kral" To: "Daniel Kral" , Subject: Re: [PATCH ha-manager v3 20/40] env: pve2: implement dynamic node and service stats X-Mailer: aerc 0.21.0-38-g7088c3642f2c-dirty References: <20260330144101.668747-1-d.kral@proxmox.com> <20260330144101.668747-21-d.kral@proxmox.com> In-Reply-To: <20260330144101.668747-21-d.kral@proxmox.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1774963496812 X-SPAM-LEVEL: Spam detection results: 0 AWL -1.429 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 1 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 1 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 1 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: JS5M633EIYOSVTTF4XP5YNGA4VDRP6XX X-Message-ID-Hash: JS5M633EIYOSVTTF4XP5YNGA4VDRP6XX X-MailFrom: d.kral@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Thomas Lamprecht X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Mon Mar 30, 2026 at 4:30 PM CEST, Daniel Kral wrote: > diff --git a/src/PVE/HA/Env/PVE2.pm b/src/PVE/HA/Env/PVE2.pm > index 04cd1bfe..b2488ddd 100644 > --- a/src/PVE/HA/Env/PVE2.pm > +++ b/src/PVE/HA/Env/PVE2.pm > @@ -588,6 +625,32 @@ sub get_static_node_stats { > return $stats; > } > =20 > +sub get_dynamic_node_stats { > + my ($self) =3D @_; > + > + my $rrd =3D PVE::Cluster::rrd_dump(); > + > + my $stats =3D {}; > + for my $key (keys %$rrd) { > + my ($nodename) =3D $key =3D~ m/^pve-node-9.0\/(\w+)$/; Just noticed this while running on another setup, that `(\w+)` should be replaced with an actual regex for valid nodenames, e.g., `([a-zA-Z0-9]([a-zA-Z0-9\-]*[a-zA-Z0-9])?)` from PVE::JSONSchema or even just a `(\S+)` as we don't need to verify the nodename here. e.g. 'pve-node1' would not work as the char '-' is not element of \w. I'll wait for other test results before sending a v4 for this and the other feedback. > + > + next if !$nodename; > + > + my $rrdentry =3D $rrd->{$key} // []; > + > + my $maxcpu =3D int($rrdentry->[RRD_NODE_INDEX_MAXCPU] || 0); > + > + $stats->{$nodename} =3D { > + maxcpu =3D> $maxcpu, > + cpu =3D> (($rrdentry->[RRD_NODE_INDEX_CPU] || 0.0) + 0.0) * = $maxcpu, > + maxmem =3D> int($rrdentry->[RRD_NODE_INDEX_MAXMEM] || 0), > + mem =3D> int($rrdentry->[RRD_NODE_INDEX_MEM] || 0), > + }; > + } > + > + return $stats; > +} > + > sub get_node_version { > my ($self, $node) =3D @_; > =20