At the time those lines are written, this sensor works only on:
- OS: GNU/Linux
- Intel and AMD x86 CPUs, produced after 2012 (or some laptop cpu prior to 2012)
It needs the following kernel modules to be present and running:
On kernels 5.0 or later:
On kernel prior 5.0:
Energy consumption data can be directly collected on a physical machine only.
To collect energy consumption on a virtual machine, you may first collect power consumption data from the hypervisor thanks to the qemu exporter and then collect those metrics in the virtual machine thanks to this sensor, with
--vm flag enabled.
To explicitely call the powercap_rapl sensor from the command line use:
scaphandre -s powercap_rapl EXPORTER # EXPORTER being the exporter name you want to use
You can see arguments available from the cli for this sensors with:
scaphandre -s powercap_rapl -h
If running in a virtual machine:
scaphandre --vm -s powercap_rapl EXPORTER
Please refer to doc.rs code documentation for more details.
sensor-buffer-per-socket-max-kB: Maximum memory size allowed, in KiloBytes, for storing energy consumption for each socket
sensor-buffer-per-domain-max-kB: Maximum memory size allowed, in KiloBytes, for storing energy consumption for each domain
--vm mode, you want to read metrics from another path than the default
/var/scaphandre, set env var
SCAPHANDRE_POWERCAP_PATH with the desired path.
Since linux kernel package 5.4.0-53.59 in debian/ubuntu, powercap attributes are only accessible by root:
linux (5.4.0-53.59) focal; urgency=medium * CVE-2020-8694 - powercap: make attributes only readable by root
Therefor, the user running scaphandre needs to have read access to energy_uj files in
You can run the init.sh script to apply appropriate permissions to the required files.