hubblo-org / scaphandre

⚡ Energy consumption metrology agent. Let "scaph" dive and bring back the metrics that will help you make your systems and applications more sustainable !
Apache License 2.0
1.53k stars 99 forks source link

Support VMware/ESXi virtual machines #262

Open TheElectronWill opened 1 year ago

TheElectronWill commented 1 year ago

Problem

Scaphandre is able to analyze qemu/KVM virtual machines (if qemu is started in system mode, it doesn't seem to work in user mode. For instance, it doesn't work with a simple vm managed by Gnome Boxes, but it does work with virt-manager). However, the implementation is specific to libvirt and doesn't work with the VMware ESXi hypervisor.

Solution

A method similar to qemu/KVM support (i.e. detecting vms on the host, computing their power consumption and offering a fake interface to the guest OS) could be implemented for VMWare ESXi.

If RAPL isn't available on the hypervisor, maybe we could use the vSphere metrics API.

Alternatives

Never support VMware ESXi, but that would be a bit sad because it's quite popular.

Additional context

The vSphere UI shows power metrics for hosts and for VMs, so that information is available to the hypervisor in some way.

Seraf commented 7 months ago

Since April 2023, on ESXi 8.0 Update 1, they introduced per VM metric on the power usage.

So querying the PerformanceManager we can get the Power (watt) and Energy (joule) for Host and VM.

ArneTR commented 7 months ago

Interesting link. Is it known how this splitting is done on the hypervisor level?