Files
Docker/garmin-grafana

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

  1. Create a .env file based on the .env.example file.

  2. Set the GARMINCONNECT_EMAIL and GARMINCONNECT_PASSWORD (Base64 encoded) variables in the .env file.

  3. If you have 2FA enabled: You must authenticate manually once to generate the session tokens.

    docker-compose run --rm garmin-fetch-data
    

    Enter your 2FA code when prompted. The tokens will be saved to the ./garminconnect_tokens folder.

    Server Console (Komodo/Portainer): If you can SSH into your server but don't know where Komodo stores the stack files:

    1. Create a permanent directory for tokens: mkdir -p /opt/garmin/tokens
    2. Run the generator manually, mounting this directory:
      docker run --rm -it -v /opt/garmin/tokens:/home/appuser/.garminconnect thisisarpanghosh/garmin-fetch-data:latest
      
    3. Enter your 2FA code.
    4. In Komodo/Portainer, configure your stack's "Environment Variables" to set the GARMINCONNECT_TOKENS variable to the path of the tokens folder.
  4. Run docker-compose up -d to 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.