mirror of
https://github.com/RWejlgaard/octopus_exporter.git
synced 2026-05-06 04:14:44 +00:00
A Prometheus exporter for live electricity consumption data from Octopus Energy, using the Kraken GraphQL API.
* major: PR check and release tweaks * add context * dockerfile shenanigans * lol let's actually add the code |
||
|---|---|---|
| .github/workflows | ||
| cmd/octopus_exporter | ||
| .gitignore | ||
| Dockerfile | ||
| go.mod | ||
| go.sum | ||
| README.md | ||
octopus_exporter
A Prometheus exporter for live electricity consumption data from Octopus Energy, using the Kraken GraphQL API.
Metrics
| Metric | Description |
|---|---|
octopus_live_consumption |
Live electricity demand in watts |
octopus_live_consumption_last_read |
Timestamp of the last meter reading (Unix epoch) |
Metrics are updated every 60 seconds.
Configuration
| Variable | Required | Description |
|---|---|---|
OCTOPUS_API_KEY |
Yes | Your Octopus Energy API key |
OCTOPUS_MPAN |
No | Filter by MPAN (recommended if you have multiple meters) |
OCTOPUS_SERIAL |
No | Filter by meter serial number |
OCTOPUS_DEVICE_ID |
No | Use a specific smart device ID directly |
PORT |
No | Port to expose metrics on (default: 9359) |
If none of OCTOPUS_MPAN, OCTOPUS_SERIAL, or OCTOPUS_DEVICE_ID are set, the exporter will automatically select the first smart meter found on your account. For accounts with multiple meters, use OCTOPUS_MPAN or OCTOPUS_SERIAL to pin to a specific one.
Your API key can be found in the Octopus Energy developer dashboard.
Docker
docker run -d \
-e OCTOPUS_API_KEY=sk_live_... \
-e OCTOPUS_MPAN=1234567890123 \
-p 9359:9359 \
rwejlgaard/octopus_exporter
Running from source
Requires Go 1.22+.
git clone https://github.com/rwejlgaard/octopus_exporter
cd octopus_exporter
OCTOPUS_API_KEY=sk_live_... go run ./cmd/octopus_exporter
Prometheus configuration
scrape_configs:
- job_name: octopus
static_configs:
- targets: ['localhost:9359']
Building
go build ./cmd/octopus_exporter
docker build -t rwejlgaard/octopus_exporter .