A Python-based Prometheus exporter for collecting power data (Watts, Volts, Amperes) from bare metal servers using the Redfish API. This tool supports multiple vendors (e.g., HPE, Supermicro) and is designed to run cross-platform on Linux and Windows.
I've created this Python script to collect power data to analyse Watts, Volts and Amperes. If there is a better solution or you want more feature, feel free to replace me or expand my prometheus exporter.
- Collects power metrics: Watts, Volts, and Amperes.
- Supports multiple vendors (HPE, Supermicro, etc.).
- Supports grouping.
- Cross-platform compatibility (Linux and Windows).
- Graceful error handling and retry logic.
- Configurable via YAML.
- Docker support.
| Metric | Typ | Description |
|---|---|---|
| redfish_up | Gauge | Status from host (1 = reachable, 0 = not reachable). |
| redfish_psu_input_voltage | Gauge | Volts per powersupply (label: host, psu_serial). |
| redfish_psu_input_watts | Gauge | Watts per powersupply (label: host, psu_serial). |
| redfish_psu_input_amps | Gauge | Amperes per powersupply (label: host, psu_serial). |
| redfish_system_info | Info | Systeminformation (Vendor, Model, Serial, Redfish Version). |
| redfish_request_latency_seconds | Histogram | Latency (label: host). |
| redfish_errors_total | Counter | Number of errors per host and error type (label: host, error). |
usage: python . [-h] [--config CONFIG] [--port PORT]
Redfish Prometheus Exporter
options:
-h, --help Show this help message and exit
--config CONFIG Path to config file
--port PORT Override port from config file
--interval INTERVAL Override interval from config file
--show-deprecated Enable deprecated warnings in log
Install the dependencies using uv:
uv sync --group dev- just (optional)
- python 3.8+
- uv
- see
pyproject.tom
Install the dependencies using uv:
uv sync
source .venv/bin/activate
uv lock --upgrade --refreshCreate config.yaml with following structure:
---
interval: 5
port: 8000
username: user
password: secret
chassis: ["1"]
hosts:
- host1.example.net
- host2.example.net
- host3.example.net
- host4.example.net---
interval: 5
port: 8000
username: user1
password: secret1
chassis: ["1"]
group: development # set default group for all hosts
hosts:
- fqdn: host1.example.net
username: user2
password: secret2
chassis: ["0"]
group: production # use group for specific host
- fqdn: host2.example.net
username: user3
password: secret3
chassis: ["1"]
group: stage
- fqdn: host3.example.net
username: user4
password: secret4
chassis: ["example"]
- fqdn: host4.example.net
username: user5
password: secret5The port, and interval arguments are optional and can be be overridden by command-line arguments. Default values are hardcoded.
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_configs:
- job_name: "prometheus"
static_configs:
- targets: ["localhost:9090"]
- job_name: "redfish_exporter"
static_configs:
- targets: ["localhost:8000"] # Adjust to your config
metrics_path: /metrics
scrape_interval: 15s
To run the Redfish Exporter in a Docker container:
docker buildx build -t redfish_exporter .
docker run -it --rm --name redfish_exporter_app -p 8000:8000 redfish_exporter:latest
mkdir /srv/redfish-exporter
# or
git clone https://github.com/dasbaum-ch/redfish-exporter.git /srv/redfish-exporter
cd /srv/redfish-exporter
uv sync --lockedsudo useradd -r -s /bin/false redfish- Copy the systemd unit file:
sudo cp redfish-exporter.service /etc/systemd/system/redfish-exporter.service- Reload and start the service:
sudo systemctl daemon-reload
sudo systemctl enable --now redfish-exporter.serviceThis project is licensed under the MIT License. See the LICENSE file for details.
Here are some servers that I have successfully tested:
| Vendor | Model | Redfish Version |
|---|---|---|
| Supermicro | AS-5126GS-TNRT2 | 1.21.0 |
| AS-1124US-TNRP | 1.8.0 | |
| HPE | ProLiant DL380 Gen10 | 1.6.0 |
To run tests against a local Redfish environment, use Redfish Interface Emulator. At tests/mock_server is a simple compose.yaml to run a local Redfish server.
Run python . --config config-localdev.yaml to use your local Redfish server.