How to attribute energy to a virtual machine
This guide describes one way to attribute a bare-metal server’s measured energy to the virtual machines (VMs) running on it. Alumet collects host and cgroup-related measurements and exposes them in Prometheus format. Chantico scrapes those metrics and uses a coefficient on each VM’s relationship to its host to calculate the VM’s share.
This setup assumes that Chantico and Prometheus are already running, and that the bare-metal server and its upstream energy measurement (for example, a PDU) are represented in Chantico. For information about defining resources and relationships, see the how to register data center resources.
Topology overview
The diagram shows an example hypervisor hosting two VMs. Alumet runs directly on the hypervisor. The Bare Metal server receives power from two PDU sockets.
In the diagram, the two PDU sockets and Alumet running on the bare metal alongside the Hypervisor. The metrics gathered by the Alumet instance running on the baremetal are used to attribute energy to the VMs running on the baremetal.
1. Install Alumet to perform attribution
The Alumet agent needs to be installed on the baremetal that runs the virtual machines (Ie. it needs to be installed alongside the hypervisor). Follow the Alumet installation guide for your operating system and installation method.
2. Configure Alumet
The example enables Alumet’s Prometheus exporter, cgroups, performance events, and procfs plugins for kernel, memory, network, and process metrics. Enable the exporter so Chantico’s Prometheus instance can scrape its endpoint. The endpoint must be reachable from the cluster.
Configure Alumet so it can observe the host’s cgroups and collect the metrics needed for attribution. If you run Alumet in a container, ensure it has the required access to the host’s cgroups and performance events; an isolated container will not observe the host’s VM processes.
Start Alumet using the method for your installation, then check that its
Prometheus exporter is available on port 9091 (or the port you configured).
The exporter must be reachable from Chantico’s Prometheus pod. If the
baremetal is not directly reachable from the cluster, arrange network access
before adding the scrape target.
3. Add the Alumet exporter as a measurement target
Create a PhysicalMeasurement that points to the hypervisor’s Alumet exporter.
Set spec.ip to an address and port reachable from Prometheus:
Apply the manifest:
Chantico adds this target to Prometheus’s exporter scrape configuration. Check that it is ready and that Prometheus can scrape it:
In Prometheus, open Status > Targets and confirm the target is UP. You
can also query a metric shown by the Alumet endpoint to confirm its series and
labels are available.
4. Add VM resources and attribution coefficients
Create a DataCenterResource for each VM and set the bare-metal resource as
its parent. Use a coefficient query that selects the series for that VM and
returns its share of the host’s energy.
The repository includes a basic Proxmox 9 Alumet template in
proxmox_alumet_vm_attribution_basic.yaml.
It uses cpu_percent_alumet_ratio and expects resourceName to match the
bare-metal host’s PhysicalMeasurement name and vmid to match the VM’s
ID in Proxmox. Apply it from the repository root:
If you use a different hypervisor, metric, or label scheme, create your own ConfigMap template with a query that returns a coefficient between 0 and 1. The coefficient represents the proportion of the bare-metal server’s energy attributable to the VM. Change the ConfigMap name in the VM resource to match your own:
Replace datacenterresource-bm-01 with the name of the existing
bare-metal DataCenterResource, and set the VM identifier to match the
ID assigned to that VM by your hypervisor. Under the hood, the Proxmox
template uses this ID to select Alumet metrics for the VM’s cgroup, where
Linux accounts for the VM’s resource usage. Repeat the VM resource with each
VM’s ID. The ConfigMap and resources must be in the same namespace.
Apply the manifest and check the resource status:
Confirm the coefficient expression returns the intended series in Prometheus. If it returns no series, check the metric name, VM ID and corresponding cgroup selector, labels, and that the Alumet exporter is being scraped. A coefficient is evaluated for the VM’s edge to its parent, so ensure the parent resource is the host whose energy is being apportioned.