Prometheus(OpenMetrics) exporter for Oura Ringā .
Oura is deprecating Personal Access Tokens; use OAuth (Authorization Code with PKCE).
http://localhost:8000/callback (it can 404 locally; you just need the code in the URL). Make sure this exact URI is registered in the Oura app.OURA_CLIENT_ID (required)OURA_CLIENT_SECRET (if your app issues one)OURA_REDIRECT_URI (defaults to http://localhost:8000/callback)OURA_SCOPES (optional space-delimited override; defaults to email personal daily heartrate spo2 stress)OURA_TOKEN_PATH (optional token cache path; defaults to ~/.config/oura-exporter/oauth_token.json)OURA_AUTH_CODE (optional, set the one-time code from the OAuth redirect for non-interactive runs)OURA_AUTH_CODE_FILE (optional, path to a file containing that code)code query parameter from the redirected URL into the prompt (or set OURA_AUTH_CODE / OURA_AUTH_CODE_FILE in non-interactive setups). Tokens are refreshed automatically afterward.OURA_ACCESS_TOKEN is still accepted but will stop working when Oura removes PAT support.And check your local TZ identifier.
The simplest way to use it is with Docker.
docker run -p 8000:8000 \
-e OURA_CLIENT_ID="your_client_id" \
-e OURA_CLIENT_SECRET="your_client_secret" \
-e OURA_REDIRECT_URI="http://localhost:8000/callback" \
-e OURA_AUTH_CODE="the_code_from_redirect" \
-e TZ="Asia/Tokyo" \
-it legnoh/oura-exporter
To expose ports when using docker compose run, add --service-ports (or prefer docker compose up -d after the initial auth run).
`OURA_AUTH_CODE` is optional; omit it if you can provide input interactively.
For headless Docker/Compose runs, set `OURA_AUTH_CODE` (or `OURA_AUTH_CODE_FILE`) once with the short-lived code from the redirect URL; tokens are then cached in the mounted volume so subsequent restarts do not need the code. If the container restarts between printing the URL and you supplying the code, reuse the code from that same URLāPKCE verifier is persisted in the volume to allow a second run to exchange it. Use `docker compose run --service-ports` (or `docker compose up -d` after auth) to expose the `/metrics` port on the host.
Alternatively, it can be started from the source.
# clone
git clone https://github.com/legnoh/oura-exporter.git && cd oura-exporter
uv sync
# prepare .env file for your apps
cat << EOS > .env
OURA_CLIENT_ID="your_client_id"
OURA_CLIENT_SECRET="your_client_secret"
OURA_REDIRECT_URI="http://localhost:8000/callback"
# OURA_AUTH_CODE="the_code_from_redirect" # optional non-interactive
TZ="Asia/Tokyo"
EOS
# run exporter
uv run main.py
please check metrics.ymlā or exampleā
Content type
Image
Digest
sha256:cb6495ee2ā¦
Size
103.7 MB
Last updated
2 days ago
docker pull legnoh/oura-exporter