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 A52841FF16B for ; Tue, 15 Jul 2025 16:37:54 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id F2B02907C; Tue, 15 Jul 2025 16:38:52 +0200 (CEST) From: Aaron Lauterer To: pve-devel@lists.proxmox.com Date: Tue, 15 Jul 2025 16:32:13 +0200 Message-Id: <20250715143218.1548306-30-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) RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 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 0.001 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 0.001 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 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [qemuserver.pm] Subject: [pve-devel] [PATCH qemu-server v3 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 d36fd1d..9e2c621 100644 --- a/src/PVE/QemuServer.pm +++ b/src/PVE/QemuServer.pm @@ -2526,6 +2526,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; @@ -2638,6 +2668,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} = { @@ -2662,6 +2700,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