scaphandre 0.1.0

Electrical power consumption measurement agent.
Documentation

Scaphandre


Scaphandre 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 those data in a convenient form, sending it though any monitoring or data analysis toolchain.

Scaphandre means heavy diving suit in :fr:. 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 focussed decisions, and then show the metrics to their clients to allow them to do the same.

This project is 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.

Fmt+Clippy


Features

  • 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 exploit 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

Getting started

Installation steps are described here.

Here are some examples.

To show power consumption metrics in your terminal, run:

scaphandre stdout

To expose power consumption metrics as a prometheus exporter (as an http endpoint):

scaphandre prometheus

Metrics are now available on http://localhost:8080/metrics.

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

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:

Installation

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.

Virtual Machines & Cloud

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 meaningfull for that virtual machine and the one on the VM exploit those metrics to allow its user to exploit the data as if he had access to power metrics in the first place (as if he was on a bare metal machine).

This allows to break opacity in a virtualization, if you have access to the virtualization hosts and can install this tool, or cloud context if the provider uses scaphandre on his hypervisors. Please refer to the qemu exporter documentation.

Contributing

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.

Structure

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 those 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.

Roadmap

The ongoing roadmap can be seen here. Any feature request are welcome, please join us.

Footprint

In opposition to its name, scaphandre aims to be as light and clean as possible. One of the main focus of the project is to come as close as possible to a 0 overhead, both about resources consumption and power consumption.

Documentation

Code documentation is here.

Users documentation is here.