Self-Hosted eBPF Power & Thermal Telemetry: Rack-Level Energy Optimization with RAPL, IPMI, and HWiNFO
Quick Summary (TL;DR)
- Goal: Build a self-hosted telemetry pipeline that correlates per-workload power draw with rack-level thermal data to optimize PUE.
- Data sources: Intel/AMD RAPL (per-CPU package power), IPMI/BMC (PSU, inlet/outlet temps, fan RPM), and HWiNFO (Windows hosts).
- Attribution layer: eBPF (Kepler) maps CPU cycles to processes/containers for per-workload power estimates.
- Stack:
node_exporter+kepler+ipmi_exporter+hwinfo-exporter→ Prometheus → Grafana.- Payoff: Actionable dashboards showing watts per pod, cooling overhead, and a live PUE gauge for your rack.
Introduction: Why Rack-Level Energy Telemetry Matters
A homelab or edge rack is a small data center, and like any data center, the most expensive kilowatt-hour is the one you spend cooling hardware that is idling. Most self-hosters can tell you total power draw from a smart plug, but almost none can answer the questions that actually drive optimization: Which container is burning 40 W? Is my cooling fighting my workload placement? Is my PUE creeping toward 1.8?
This guide builds a complete, self-hosted observability pipeline that answers those questions. We’ll harvest per-CPU power from Intel RAPL, rack-level power and thermal data from your BMC via IPMI, and Windows host telemetry from HWiNFO. Then we’ll use eBPF to attribute power to individual processes and containers, and tie it all together in Prometheus and Grafana so you can calculate and drive down rack-level Power Usage Effectiveness (PUE).
Understanding the Data Sources: RAPL, IPMI, and HWiNFO
Each data source answers a different question. Understanding the boundaries between them is the key to a coherent pipeline.
Intel RAPL: Per-CPU Power Measurement
Running Average Power Limit (RAPL) exposes energy counters via model-specific registers (MSRs) on Intel (and, since Zen 2, AMD) CPUs. The kernel surfaces them through the powercap subsystem at /sys/class/powercap/intel-rapl/. You get energy_uj counters for CPU package, cores, uncore, and DRAM domains. Because these are energy counters (microjoules), the exporter computes power by differentiating over time. RAPL’s superpower is granularity: it tells you what the silicon is doing, which is exactly what you need to attribute power to workloads.
IPMI/BMC: Rack-Level Power and Thermal Sensors
Your Baseboard Management Controller (BMC) speaks IPMI (or increasingly Redfish) and exposes the physical truth of the machine: PSU input power, inlet and exhaust temperatures, fan RPM, and voltage rails. Where RAPL is granular, IPMI is authoritative and physical. It’s the source of truth for total IT power and the thermal state of the rack. It’s also the noisiest to query — IPMI is slow and notoriously insecure, so it must be isolated.
HWiNFO: Windows Host Telemetry
Linux hosts have RAPL natively. Windows hosts do not expose a clean equivalent. HWiNFO reads CPU package power, GPU power, and temperatures directly and can publish them over its built-in HTTP/JSON interface (or via a small bridge). This lets a mixed-OS rack stay fully observable.
Architecture Overview: eBPF-Powered Telemetry Pipeline
The pipeline has three collection tiers feeding a single Prometheus instance, with Grafana on top.
flowchart TD
subgraph Hosts["Linux Hosts (per node)"]
NE[node_exporter<br/>+ RAPL collector]
KP[kepler eBPF<br/>per-process power]
IE[ipmi_exporter]
end
subgraph Win["Windows Node"]
HW[HWiNFO + bridge]
end
subgraph BMC["Out-of-Band"]
BMC1[BMC / Redfish]
end
subgraph Mgmt["Management Node"]
PROM[(Prometheus)]
GRAF[Grafana<br/>PUE + thermal dashboards]
end
NE -->|/metrics| PROM
KP -->|/metrics| PROM
HW -->|/metrics| PROM
IE -->|IPMI over LAN| BMC1
IE -->|/metrics| PROM
PROM --> GRAF
The eBPF layer is what makes this more than a fancy power meter. By tracing sched_switch and perf events, Kepler (Kubernetes Efficient Power Level Exporter) counts CPU cycles per cgroup/process, then multiplies the ratio against RAPL package power to produce per-workload watt estimates.
Step-by-Step Implementation Guide
Step 1: Enable RAPL and IPMI Access on Hosts
First, confirm RAPL is exposed. On most modern kernels it is available out of the box, but the energy_uj files are root-only — and in some hardened setups intel_rapl is blacklisted.
# Verify RAPL domains exist
ls /sys/class/powercap/intel-rapl/
# Read a counter (root required)
sudo cat /sys/class/powercap/intel-rapl:0/energy_uj
If empty, load the module: sudo modprobe intel_rapl_msr intel_rapl_common. For IPMI, ensure the kernel interface is available (sudo modprobe ipmi_devintf ipmi_si) and that you can reach the BMC over a dedicated management VLAN. Create a read-only IPMI user — never reuse the admin account.
Step 2: Deploy eBPF Exporter for Per-Process Power Attribution
The cleanest way to get per-workload power is Kepler, which bundles RAPL reading with eBPF cycle accounting. Run it as a systemd service or container with the privileges it needs (BPF, perf events, and read access to powercap).
# docker-compose excerpt for a single Linux node
services:
kepler:
image: quay.io/sustainable_computing_io/kepler:latest
privileged: true # required for eBPF + perf events
pid: host
volumes:
- /sys:/sys:ro
- /proc:/proc:ro
- /var/lib/kepler:/var/lib/kepler
command:
- "--enable-cgroup-id=true"
- "--kernel-fs-mount-point=/host/proc"
ports:
- "28282:28282" # Prometheus metrics
Kepler exposes metrics like kepler_container_joules_total and kepler_node_cpu_watts. Divide joules by elapsed time to plot watts per container.
Step 3: Configure IPMI Exporter for BMC Metrics
The ipmi_exporter scrapes BMCs on Prometheus’s behalf. Configure targets in a YAML file so you can add racks without touching Prometheus config.
# ipmi_targets.yml
- target: 10.20.0.11
name: rack-a-node1
type: ipmi
username: telemetry
password: <readonly-secret>
collector_type: ipmi
# ipmi_exporter.yml
modules:
default:
collectors:
- ipmi
- bmc
exclude_sensor_ids: []
Run the exporter, then point Prometheus at it with the ipmi_exporter multi-target pattern (/ipmi?target=...). Key metrics: ipmi_dcmi_power_consumption_watts (whole-system power) and ipmi_temperature_celsius{sensor="Inlet_Temp"}.
Step 4: Integrate HWiNFO for Windows Nodes
On the Windows host, enable HWiNFO’s “Report to file / HTTP” option (Settings → Reporting). A tiny bridge (a PowerShell script or a small Go binary) scrapes the JSON and re-exposes it in Prometheus text format on port 9182. Keep it on the management VLAN and protect it with a token. This yields hwinfo_cpu_package_power_watts and hwinfo_gpu_power_watts, matching the schema of your Linux metrics.
Step 5: Set Up Prometheus and Grafana for Correlation
Wire everything into Prometheus with sane scrape intervals. RAPL-derived power needs frequent scrapes (10–15 s); IPMI is slow, so use 30–60 s.
# prometheus.yml excerpt
scrape_configs:
- job_name: node_rapl
scrape_interval: 15s
static_configs:
- targets: ['rack-a-node1:9100', 'rack-a-node2:9100']
- job_name: kepler
scrape_interval: 15s
static_configs:
- targets: ['rack-a-node1:28282']
- job_name: ipmi
scrape_interval: 45s
metrics_path: /ipmi
params:
module: [default]
file_sd_configs:
- files: ['/etc/prometheus/ipmi_targets.yml']
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: ipmi-exporter:9290
Import the community Node Exporter Full dashboard and build a custom panel for kepler_container_cpu_watts.
Step 6: Calculate and Visualize PUE and Cooling Efficiency
PUE = Total Facility Power ÷ IT Equipment Power. In a homelab, “facility power” is what your PDU or UPS reports; “IT power” is the sum of node-level IPMI power. The difference is your cooling, networking, and overhead.
# Rack IT power (sum of node PSU draw)
sum(ipmi_dcmi_power_consumption_watts)
# PUE (facility power from a PDU-exporter metric)
sum(pdu_power_watts) / sum(ipmi_dcmi_power_consumption_watts)
# Cooling overhead in watts
sum(pdu_power_watts) - sum(ipmi_dcmi_power_consumption_watts)
# Thermal delta across the rack
avg(ipmi_temperature_celsius{sensor="Exhaust_Temp"})
- avg(ipmi_temperature_celsius{sensor="Inlet_Temp"})
Plot PUE as a gauge with thresholds at 1.2 (excellent) and 1.5 (needs work). Overlay the inlet/exhaust delta to see whether cooling is keeping up.
Comparison of Telemetry Approaches
| Approach | Granularity | Scope | Best For | Caveats |
|---|---|---|---|---|
| RAPL | Per-CPU package / DRAM | Single host | Per-workload attribution, efficiency tuning | CPU-only; needs root; not whole-system |
| IPMI/BMC | Whole system / PSU | Per node + rack | Total IT power, thermal, PUE | Slow, insecure, sensor-name chaos |
| Redfish | Whole system / PSU | Per node + rack | Modern BMCs, secure API | Not universal; vendor variance |
| HWiNFO | CPU/GPU package | Windows host | Mixed-OS racks | Third-party; needs bridge |
| eBPF (Kepler) | Per process / container | Per host | Watt-per-pod, chargeback | Estimation, not measurement |
| Smart PDU | Per outlet | Rack | Facility power, PUE numerator | Cost; coarse per-node |
The winning strategy is layered: RAPL + eBPF for attribution, IPMI/Redfish for physical truth, PDU for facility power, HWiNFO to close the Windows gap.
Optimizing Rack-Level PUE: Best Practices
- Attack idle power first. An idle rack at 60% load wastes the most. Use RAPL data to find nodes that never sleep; enable aggressive C-states and
powertop --auto-tune. - Right-size cooling to load. Correlate fan RPM with inlet temperature. If fans run at 100% while inlet stays at 20 °C, your fan curve is wrong — fix the BMC fan profile.
- Place hot workloads near cool air. Use exhaust/inlet deltas to detect recirculation and reorder rack units.
- Set power budgets, not just alerts. RAPL supports power capping via
powercap; cap bursty workloads to smooth rack peaks. - Track watts-per-request. Combine Kepler container watts with request counts to build a true efficiency KPI, not just raw power.
- Secure the management plane. IPMI is exploitable; keep BMCs on an isolated VLAN, read-only accounts, and prefer Redfish where available.
Conclusion
You now have a complete, self-hosted pipeline: RAPL for silicon-level truth, eBPF/Kepler for per-workload attribution, IPMI for physical rack reality, and HWiNFO for Windows hosts — all flowing into Prometheus and Grafana with a live PUE gauge. The real value isn’t the dashboard; it’s the feedback loop. Once you can see which workload costs which watts and how much cooling it drags along, optimization stops being guesswork and becomes engineering.
FAQ
What is the difference between RAPL and IPMI power measurements? RAPL provides per-CPU package and DRAM power from the processor via MSRs, offering high granularity for workload attribution. IPMI/BMC sensors measure whole-system or rack-level power at the PSU or PDU, giving aggregate physical power but less granularity. Use RAPL for per-workload breakdown and IPMI for total rack power and PUE.
Can I use eBPF to attribute power consumption to individual processes or containers?
Yes. Combining eBPF CPU-cycle accounting (via sched_switch and perf events) with RAPL package power lets you estimate per-process draw. Kepler does exactly this to expose container-level power metrics to Prometheus.
How do I calculate PUE with these metrics? PUE = Total Facility Power ÷ IT Equipment Power. Use PDU/UPS metrics for facility power and RAPL or IPMI system power for IT power. In a homelab, approximate cooling overhead by subtracting IT power from total rack power measured at the PDU.
Is HWiNFO necessary if I already have RAPL and IPMI? Only if you have Windows hosts. HWiNFO supplies CPU/GPU/system power and temperature data for Windows machines that lack native RAPL or IPMI access. For pure Linux racks, RAPL and IPMI suffice.
What are the security considerations for exposing IPMI metrics? IPMI/BMC interfaces are notoriously insecure. Keep IPMI exporters on a dedicated management VLAN, restrict access with firewall rules, never expose BMCs to the internet, use read-only accounts, and prefer Redfish where supported.