A Prometheus exporter for live electricity consumption data from Octopus Energy, using the Kraken GraphQL API.
Find a file
dependabot[bot] f4557c7a2f
chore(deps): bump the actions group with 7 updates (#14)
Bumps the actions group with 7 updates:

| Package | From | To |
| --- | --- | --- |
| [actions/checkout](https://github.com/actions/checkout) | `4` | `6` |
| [actions/setup-go](https://github.com/actions/setup-go) | `5` | `6` |
| [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) | `6` | `9` |
| [docker/setup-qemu-action](https://github.com/docker/setup-qemu-action) | `3` | `4` |
| [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) | `3` | `4` |
| [docker/login-action](https://github.com/docker/login-action) | `3` | `4` |
| [docker/build-push-action](https://github.com/docker/build-push-action) | `6` | `7` |


Updates `actions/checkout` from 4 to 6
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4...v6)

Updates `actions/setup-go` from 5 to 6
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](https://github.com/actions/setup-go/compare/v5...v6)

Updates `golangci/golangci-lint-action` from 6 to 9
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](https://github.com/golangci/golangci-lint-action/compare/v6...v9)

Updates `docker/setup-qemu-action` from 3 to 4
- [Release notes](https://github.com/docker/setup-qemu-action/releases)
- [Commits](https://github.com/docker/setup-qemu-action/compare/v3...v4)

Updates `docker/setup-buildx-action` from 3 to 4
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](https://github.com/docker/setup-buildx-action/compare/v3...v4)

Updates `docker/login-action` from 3 to 4
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](https://github.com/docker/login-action/compare/v3...v4)

Updates `docker/build-push-action` from 6 to 7
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: actions/setup-go
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: golangci/golangci-lint-action
  dependency-version: '9'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: docker/setup-qemu-action
  dependency-version: '4'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: docker/setup-buildx-action
  dependency-version: '4'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: docker/login-action
  dependency-version: '4'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: docker/build-push-action
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Rasmus "Pez" Wejlgaard <pez@pez.sh>
2026-05-20 21:03:33 +01:00
.github chore(deps): bump the actions group with 7 updates (#14) 2026-05-20 21:03:33 +01:00
cmd/octopus_exporter feat: making things a lot more proper (#11) 2026-05-20 20:57:06 +01:00
.gitignore feat: making things a lot more proper (#11) 2026-05-20 20:57:06 +01:00
.golangci.yml feat: making things a lot more proper (#11) 2026-05-20 20:57:06 +01:00
Dockerfile feat: making things a lot more proper (#11) 2026-05-20 20:57:06 +01:00
go.mod feat: making things a lot more proper (#11) 2026-05-20 20:57:06 +01:00
go.sum initial 2026-04-22 20:33:31 +01:00
README.md feat: making things a lot more proper (#11) 2026-05-20 20:57:06 +01:00

octopus_exporter

A Prometheus exporter for Octopus Energy smart meter data, using the Kraken GraphQL API.

Metrics

Electricity

Metric Source Description
octopus_electricity_demand_watts GraphQL Live electricity demand in watts
octopus_electricity_last_read_timestamp GraphQL Unix timestamp of last electricity reading
octopus_electricity_consumption_kwh REST Latest half-hourly consumption in kWh
octopus_electricity_consumption_interval_timestamp REST Unix timestamp of the start of the latest consumption interval
octopus_electricity_unit_rate_pence GraphQL / REST Current unit rate in pence per kWh (Agile customers get the live half-hourly rate from the REST API)
octopus_electricity_standing_charge_pence GraphQL Current standing charge in pence per day

Gas

Gas metrics are only exposed if a smart gas meter is found on the account.

Metric Source Description
octopus_gas_demand_watts GraphQL Live gas demand in watts
octopus_gas_last_read_timestamp GraphQL Unix timestamp of last gas reading
octopus_gas_consumption_kwh REST Latest half-hourly consumption in kWh
octopus_gas_consumption_interval_timestamp REST Unix timestamp of the start of the latest gas consumption interval
octopus_gas_unit_rate_pence GraphQL Current unit rate in pence per kWh
octopus_gas_standing_charge_pence GraphQL Current standing charge in pence per day

Account

Metric Source Description
octopus_account_balance_pence GraphQL Account balance in pence (positive = credit, negative = debit)

Exporter health

Metric Description
octopus_up 1 if the last poll cycle completed without errors, 0 otherwise
octopus_last_poll_timestamp Unix timestamp of the last completed poll cycle
octopus_poll_errors_total Total number of collector errors across all poll cycles
octopus_token_refreshes_total Total number of successful JWT token refreshes
octopus_rate_limit_retries_total Total number of 429 rate-limit retries
octopus_build_info{version,commit} Build metadata (always 1)

Metrics are refreshed every POLL_INTERVAL (default 60 seconds).

Configuration

Variable Required Description
OCTOPUS_API_KEY Yes Your Octopus Energy API key
OCTOPUS_MPAN No Filter electricity meter by MPAN
OCTOPUS_SERIAL No Filter electricity meter by serial number
OCTOPUS_DEVICE_ID No Use a specific electricity smart device ID directly
OCTOPUS_GAS_MPRN No Filter gas meter by MPRN
OCTOPUS_GAS_SERIAL No Filter gas meter by serial number
OCTOPUS_GAS_DEVICE_ID No Use a specific gas smart device ID directly
PORT No Port to expose metrics on (default: 9359)
POLL_INTERVAL No How often to poll Octopus APIs (Go duration, default: 60s)

If no filter variables are set, the exporter auto-discovers the first smart meter of each type found on the account. Use OCTOPUS_MPAN / OCTOPUS_MPRN to pin to a specific meter on accounts with multiple meters.

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

Docker Compose

services:
  octopus-exporter:
    image: rwejlgaard/octopus_exporter:latest
    restart: unless-stopped
    environment:
      OCTOPUS_API_KEY: sk_live_...
      OCTOPUS_MPAN: "1234567890123"   # optional, auto-discovered if omitted
    ports:
      - "9359:9359"

Running from source

Requires Go 1.24+.

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 .