Files
Mathieu 2b7b6baf02 feat(xo-server-openmetrics): estimate per-VM power consumption from CPU (#10031)
* feat(xo-server-openmetrics): estimate per-VM power consumption from CPU
usage

* refactor(xo-server-openmetrics): move hostPowerWatts undefined guard to
caller

* fix(xo-server-openmetrics): log IPMI power read failure as info
2026-07-15 14:06:49 +02:00

1.8 KiB
Raw Permalink Blame History

Exposes XenServer/XCP-ng metrics in OpenMetrics/Prometheus format.

Like all other xo-server plugins, it can be configured directly via the web interface, see the plugin documentation.

This plugin creates an HTTP server that exposes a /metrics endpoint compatible with Prometheus scraping. All metrics are enriched with human-readable labels (pool_name, host_name, vm_name, etc.) for easy filtering and visualization.

Features:

  • Real-time metrics from all connected pools
  • Host metrics: CPU, memory, network, disk IOPS/throughput/latency
  • Host uptime metric (xcp_host_uptime_seconds)
  • Host status metric (xcp_host_status) with power_state and enabled labels, including non-running hosts
  • VM status metric (xcp_vm_status) with power_state label, including non-running VMs
  • VM uptime metric (xcp_vm_uptime_seconds) for running VMs
  • VM metrics: CPU, memory, network, disk, runstate
  • Host power metric (xcp_host_power_consumption_watts) read from IPMI, carrying a source="ipmi" label
  • Estimated per-VM power metric (xcp_vm_power_consumption_watts, label estimate="true"): each running guest's share of its host's power, split proportionally to CPU load (cpu_usage × vCPUs); dom0 is excluded and the per-host total is preserved; flagged data_complete="false" when a VM's cpu_usage is missing
  • is_control_domain label on all VM metrics to distinguish dom0 from user VMs
  • tags label on host, VM and SR metrics carrying the XO tags of the object (comma-separated, sorted), enabling selective monitoring with regex matchers such as {tags=~"(^|.*,)production(,.*|$)"}
  • VDI disk size metrics: virtual size and physical usage per VDI (xcp_vdi_virtual_size_bytes, xcp_vdi_physical_usage_bytes)
  • Bearer token authentication
  • OpenMetrics format with EOF marker