Scaphandre [skafɑ̃dʁ] is a metrology agent dedicated to electrical power consumption metrics. The goal of the project is to permit to any company or individual to measure the power consumption of its tech services and get this data in a convenient form, sending it through any monitoring or data analysis toolchain.
Scaphandre means heavy diving suit in 🇫🇷. It comes from the idea that tech related services often don't track their power consumption and thus don't expose it to their clients. Most of the time the reason is a presumed bad ROI. Scaphandre makes, for tech providers and tech users, easier and cheaper to go under the surface to bring back the desired power consumption metrics, take better sustainability focused decisions, and then show the metrics to their clients to allow them to do the same.
This project was born from a deep sense of duty from tech workers. Please refer to the why section for know more about its goals.
Warning: this is still a very early stage project. Any feedback or contribution will be highly appreciated. Please refer to the contribution section.
- measuring power consumption on bare metal hosts
- measuring power consumption of qemu/kvm virtual machines from the host
- exposing power consumption metrics of a virtual machine in a way that allows to access those metrics in the VM as if it was a bare metal machine (relies on hypervisor features)
- exposing power consumption metrics as a prometheus HTTP exporter
- showing basic power consumption metrics in the terminal
Installation steps are described here.
Here are some examples.
To show power consumption metrics in your terminal, run:
scaphandre stdout
Details here.
To expose power consumption metrics as a prometheus exporter (as an http endpoint):
scaphandre prometheus
Metrics are now available on http://localhost:8080/metrics. Details here.
To compute metrics of running Qemu/KVM virtual machines on the host, and be able to expose those metrics to the guests, run:
scaphandre qemu
Details here.
General usage is:
scaphandre [-s SENSOR] EXPORTER [OPTIONS]
Available exporters are:
- stdout: displays metrics on the standard output/on your terminal
- prometheus: exposes metrics as an http endpoint, the way prometheus understands
- qemu: computes power consumption of each Qemu/KVM virtual machine running on the host and stores the data in
/var/lib/libvirt/scaphandre/VM_NAME
Available sensors are:
We recommand using this version of the rust toolchain or later:
cargo --version
cargo 1.48.0 (65cbdd2dc 2020-10-14)
rustc --version
rustc 1.48.0 (7eac88abb 2020-11-16)
To be sure to be up to date, you may install rust from the official website instead of your package manager.
Note: On ubuntu 20.04, you may encounter permissions issues. If it is your case you can run the init.sh
script that will apply the right permissions first (details).
Handling of special permissions accross different distributions will be improved in a near future.
You'll find existing releases and packages here.
To hack scaph, or simply be up to date with latest developments, you can download scaphandre from the main branch:
git clone https://github.com/hubblo-org/scaphandre.git
cd scaphandre
cargo build # binary path is target/debug/scaphandre
To use the latest code for a true use case, build for release instead of debug:
cargo build --release
Binary path is target/release/scaphandre
.
A major pain point in measuring power consumption is doing so inside a virtual machine. A virtual machine usually doesn't have access to power metrics. Scaphandre aims at solving that by enabling a communication between a scaphandre instance on the hypervisor host and another one in the virtual machine. The scaphandre agent on the host will compute the metrics meaningful for that virtual machine and the one on the VM accesses those metrics to allow its user to access the data as if they had access to power metrics in the first place (as if they were on a bare metal machine).
This allows to break opacity in a virtualization context, if you have access to the virtualization hosts and can install this tool, or cloud context if the provider uses scaphandre on their hypervisors. Please refer to the qemu exporter documentation.
Feel free to propose pull requests, or open new issues at will. Scaphandre is a collaborative project and all opinions and propositions shall be heard and studied. The contributions will be received with kindness, gratitude and with an open mind. Remember that we are all dwarfs standing on the shoulders of giants. We all have to learn from others and to give back, with due mutual respect.
Discussions and questions about the project are welcome on gitter: gitter or by email.
Here is the code of conduct of the project.
This project intends to use conventionnal commit messages and the gitflow workflow.
Scaphandre is a not only a tool, but a framework. Modules dedicated to collect energy comsumption data from the host are called Sensors. Modules that are dedicated to send this data to a given channel or remote system are called Exporters. New Sensors and Exporters are going to be created and all contributions are welcome.
The ongoing roadmap can be seen here. Feature requests are welcome, please join us.
In opposition to its name, scaphandre aims to be as light and clean as possible. One of the main focus areas of the project is to come as close as possible to a 0 overhead, both about resources consumption and power consumption.
Code documentation is here.
Users documentation is here.