[PATCH pve-common/pve-manager/qemu-server 0/3] Fix #5708: Add CPU raw counters

Sascha Westermann sascha.westermann at hl-services.de
Tue Sep 17 07:50:17 CEST 2024


To monitor the CPU utilization of nodes and Qemu VMs at arbitrary
intervals (e.g. every 30 seconds) via the Proxmox API, there are no
suitable endpoints right now:

/api2/json/nodes/{node}/status (cpu): Instant value
/api2/json/nodes/{node}/rrddata?timeframe=hour (cpu): Average values 
per minute

/api2/json/nodes/{node}/qemu (cpu): Instant value
/api2/json/nodes/{node}/qemu/{vmid}/rrddata?timeframe=hour (cpu):
Average values per minute

Instant values have the disadvantage that short-term peaks distort the
value. The average values from rrddata provide usable average values,
but you are restricted to a minute time window and the values can be
up to one minute old.

The following patches add raw counter values to a "cpustat" map in
the corresponding endpoints.

pve-common:

Sascha Westermann (1):
  Add CPU raw counters

 src/PVE/ProcFSTools.pm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

pve-manager:

Sascha Westermann (1):
  Add CPU raw counters

 PVE/API2/Nodes.pm | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

qemu-server:

Sascha Westermann (1):
  Add CPU raw counters

 PVE/QemuServer.pm | 55 +++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 53 insertions(+), 2 deletions(-)

-- 
2.46.0




More information about the pve-devel mailing list