A Prometheus exporter for live electricity consumption data from Octopus Energy, using the Kraken GraphQL API.
Find a file
Rasmus "Pez" Wejlgaard 36f8003435
major: PR check and release tweaks (#3)
* major: PR check and release tweaks

* add context

* dockerfile shenanigans

* lol let's actually add the code
2026-04-22 21:09:24 +01:00
.github/workflows major: PR check and release tweaks (#3) 2026-04-22 21:09:24 +01:00
cmd/octopus_exporter major: PR check and release tweaks (#3) 2026-04-22 21:09:24 +01:00
.gitignore major: PR check and release tweaks (#3) 2026-04-22 21:09:24 +01:00
Dockerfile major: PR check and release tweaks (#3) 2026-04-22 21:09:24 +01:00
go.mod initial 2026-04-22 20:33:31 +01:00
go.sum initial 2026-04-22 20:33:31 +01:00
README.md initial 2026-04-22 20:33:31 +01:00

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 .