2.4 KiB
Garmin-Grafana
This directory contains the configuration for a set of services that fetches data from Garmin Connect, stores it in InfluxDB, and visualizes it with Grafana.
Services
- garmin-fetch-data: A service that fetches data from Garmin Connect.
- influxdb: An InfluxDB database for storing Garmin Connect data.
- grafana: A Grafana instance for visualizing the data.
How to start
-
Create a
.envfile based on the.env.examplefile. -
Set the
GARMINCONNECT_EMAILandGARMINCONNECT_PASSWORD(Base64 encoded) variables in the.envfile. -
If you have 2FA enabled: You must authenticate manually once to generate the session tokens.
docker-compose run --rm garmin-fetch-dataEnter your 2FA code when prompted. The tokens will be saved to the
./garminconnect_tokensfolder.Server Console (Komodo/Portainer): If you can SSH into your server but don't know where Komodo stores the stack files:
- Create a permanent directory for tokens:
mkdir -p /opt/garmin/tokens - Run the generator manually, mounting this directory:
docker run --rm -it -v /opt/garmin/tokens:/home/appuser/.garminconnect thisisarpanghosh/garmin-fetch-data:latest - Enter your 2FA code.
- In Komodo/Portainer, configure your stack's "Environment Variables" to set the
GARMINCONNECT_TOKENSvariable to the path of the tokens folder.
- Create a permanent directory for tokens:
-
Run
docker-compose up -dto start the application.
Setup & Access
After starting the application, you can access the Grafana web interface at http://localhost:3000.
- User:
admin - Password:
admin
Configure a new data source for InfluxDB (URL: http://influxdb:8086, Database: GarminStats) and import the dashboards.
Historical Data Download (Bulk Import)
To download old history, use the MANUAL_START_DATE variable. This will fetch data in reverse chronological order from the current date (or MANUAL_END_DATE) back to the start date.
docker-compose run --rm -e MANUAL_START_DATE=YYYY-MM-DD garmin-fetch-data
Options:
MANUAL_END_DATE=YYYY-MM-DD: Optional end date (defaults to today).FETCH_SELECTION=...: Limit what data is fetched (e.g.,activity,sleep).
Note: Garmin archives intraday data older than 6 months, so very old detailed data (HR, sleep stages) might be missing unless manually refreshed in the Garmin Connect app.