WARNING: This is still a work in progress. Come find me on the Rivian Discord in the #tech-software
channel if you have issues.
This is a prometheus_exporter that is scrapes data from the Rivian GraphAPI thanks to the rivian-python-client.
It is designed to be run as a docker image for the exporter daemon. There are also CLI sub-commands to authenticate and fetch information about vehicles. The intended flow is something like
You can get my dashboard from Grafana. Warning, I'm odd and use miles for distance and celsius for temperature. If you build your own dash, pull request to link it here.
The image is published to ghcr.io/oxo42/rivian_exporter:latest
docker build -t ghcr.io/oxo42/rivian_exporter .
docker run -it ghcr.io/oxo42/rivian_exporter login
Save the last 3 lines to /tmp/rivian-creds
docker run --env-file /tmp/rivian-creds -it ghcr.io/oxo42/rivian_exporter user-info
# add `| jq` to prettify it
Then add VIN=<YourVin>
to the credentials file
This calls the same function the prometheus exporter calls
docker run --env-file /tmp/rivian-creds -it ghcr.io/oxo42/rivian_exporter vehicle-state | jq
docker run -p 8000 --env-file /tmp/rivian-creds ghcr.io/oxo42/rivian_exporter
curl http://localhost:8000
Instead of having all the tokens and VIN as environment variables, you can store each one in a file then use docker secrets to populate those files. You need to specificy the environment variables
ACCESS_TOKEN_FILE
=>/run/secrets/access_token
REFRESH_TOKEN_FILE
=>/run/secrets/refresh_token
USER_SESSION_TOKEN_FILE
=>/run/secrets/user_session_token
VIN_FILE
=>/run/secrets/vin
- Add metrics into the collector
- Split
RivianCollector
intoRivianGauge
andRivianInfo
- The
Info
collector needs to take things from multiple fields, e.g. version havingotaCurrentVersion
andotaCurrentVersionGitHash
. This is a prometheus thing that I want to lean into
- The
- Add a
get-vehicles
CLI to help with setup
Run the app with
poetry run python -m rivian_exporter --help
# or
bin/rivian_exporter --help
Tests
poetry run pytest