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 318701FF16B for ; Tue, 15 Jul 2025 16:32:52 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id CD09B8028; Tue, 15 Jul 2025 16:32:34 +0200 (CEST) From: Aaron Lauterer To: pve-devel@lists.proxmox.com Date: Tue, 15 Jul 2025 16:32:17 +0200 Message-Id: <20250715143218.1548306-34-a.lauterer@proxmox.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250715143218.1548306-1-a.lauterer@proxmox.com> References: <20250715143218.1548306-1-a.lauterer@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.018 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_MSPIKE_H2 0.001 Average reputation (+2) SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH container v3 1/2] metrics: add pressures to metrics X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" From: Folke Gleumes Originally-by: Folke Gleumes [AL: * rebased on current master * switch to new, more generic read_cgroup_pressure function * add pressures to return properties ] Signed-off-by: Aaron Lauterer --- Notes: changes since: v2: * add return properties for pressures * reorder to run before cpu info collection, otherwise that might trigger 'next', skipping the pressure collection. For example when using `pvesh` for the 'current' API endpoint src/PVE/LXC.pm | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm index ffedcb9..2932c77 100644 --- a/src/PVE/LXC.pm +++ b/src/PVE/LXC.pm @@ -227,6 +227,32 @@ our $vmstatus_return_properties = { optional => 1, default => 0, }, + pressurecpusome => { + description => "CPU Some pressure average over the last 10 seconds.", + type => 'number', + optional => 1, + }, + pressureiosome => { + description => "IO Some pressure average over the last 10 seconds.", + type => 'number', + optional => 1, + }, + pressureiofull => { + description => "IO Full pressure average over the last 10 seconds.", + type => 'number', + optional => 1, + }, + pressurememorysome => { + description => "Memory Some pressure average over the last 10 seconds.", + type => 'number', + optional => 1, + }, + pressurememoryfull => { + description => "Memory Full pressure average over the last 10 seconds.", + type => 'number', + optional => 1, + }, + }; sub vmstatus { @@ -329,6 +355,14 @@ sub vmstatus { $d->{diskwrite} = 0; } + my $pressures = PVE::ProcFSTools::read_cgroup_pressure("lxc/${vmid}"); + $d->{pressurecpusome} = $pressures->{cpu}{some}{avg10}; + $d->{pressurecpufull} = $pressures->{cpu}{full}{avg10}; + $d->{pressureiosome} = $pressures->{io}{some}{avg10}; + $d->{pressureiofull} = $pressures->{io}{full}{avg10}; + $d->{pressurememorysome} = $pressures->{memory}{some}{avg10}; + $d->{pressurememoryfull} = $pressures->{memory}{full}{avg10}; + if (defined(my $cpu = $cgroups->get_cpu_stat())) { # Total time (in milliseconds) used up by the cpu. my $used_ms = $cpu->{utime} + $cpu->{stime}; -- 2.39.5 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel