From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id C4ECB1FF15F for ; Sat, 26 Jul 2025 03:08:03 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id BE33932135; Sat, 26 Jul 2025 03:07:35 +0200 (CEST) From: Aaron Lauterer To: pve-devel@lists.proxmox.com Date: Sat, 26 Jul 2025 03:06:21 +0200 Message-Id: <20250726010626.1496866-27-a.lauterer@proxmox.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250726010626.1496866-1-a.lauterer@proxmox.com> References: <20250726010626.1496866-1-a.lauterer@proxmox.com> MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1753491982391 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.015 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 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 qemu-server v4 1/4] metrics: add pressure 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: * added return properties * reordered collection prior to the cpu collection, as it would be skipped, especially when collected via `pvesh` * added '* 1' to make sure we use numbers in the JSON -> an better alternative for numbers that are not integers? src/PVE/QemuServer.pm | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm index 5a4f8120..59b13709 100644 --- a/src/PVE/QemuServer.pm +++ b/src/PVE/QemuServer.pm @@ -2533,6 +2533,36 @@ our $vmstatus_return_properties = { type => 'boolean', optional => 1, }, + pressurecpusome => { + description => "CPU Some pressure average over the last 10 seconds.", + type => 'number', + optional => 1, + }, + pressurecpufull => { + description => "CPU Full 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, + }, }; my $last_proc_pid_stat; @@ -2645,6 +2675,14 @@ sub vmstatus { $d->{mem} = int(($pstat->{rss} / $pstat->{vsize}) * $d->{maxmem}); } + my $pressures = PVE::ProcFSTools::read_cgroup_pressure("qemu.slice/${vmid}.scope"); + $d->{pressurecpusome} = $pressures->{cpu}->{some}->{avg10} * 1; + $d->{pressurecpufull} = $pressures->{cpu}->{full}->{avg10} * 1; + $d->{pressureiosome} = $pressures->{io}->{some}->{avg10} * 1; + $d->{pressureiofull} = $pressures->{io}->{full}->{avg10} * 1; + $d->{pressurememorysome} = $pressures->{memory}->{some}->{avg10} * 1; + $d->{pressurememoryfull} = $pressures->{memory}->{full}->{avg10} * 1; + my $old = $last_proc_pid_stat->{$pid}; if (!$old) { $last_proc_pid_stat->{$pid} = { @@ -2669,6 +2707,7 @@ sub vmstatus { } else { $d->{cpu} = $old->{cpu}; } + } return $res if !$full; -- 2.39.5 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel