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 loginSave 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 itThen 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 | jqdocker run -p 8000 --env-file /tmp/rivian-creds ghcr.io/oxo42/rivian_exporter
curl http://localhost:8000Instead 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_tokenREFRESH_TOKEN_FILE=>/run/secrets/refresh_tokenUSER_SESSION_TOKEN_FILE=>/run/secrets/user_session_tokenVIN_FILE=>/run/secrets/vin
- Add metrics into the collector
- Split
RivianCollectorintoRivianGaugeandRivianInfo- The
Infocollector needs to take things from multiple fields, e.g. version havingotaCurrentVersionandotaCurrentVersionGitHash. This is a prometheus thing that I want to lean into
- The
- Add a
get-vehiclesCLI to help with setup
Run the app with
poetry run python -m rivian_exporter --help
# or
bin/rivian_exporter --helpTests
poetry run pytest