Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docker-compose example #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add docker-compose example #6

wants to merge 1 commit into from

Conversation

herver
Copy link
Contributor

@herver herver commented Oct 31, 2018

Could be useful for some people deploying this exporter with docker-compose (maybe in conjunction with prometheus and grafana)

@xperimental xperimental self-assigned this Nov 4, 2018
@tom-43
Copy link

tom-43 commented Jul 21, 2023

Docker Compose step by step installation

I wrote a little tutorial on how to create all the containers that are needed using Docker Compose and the new Netatmo authentication:

  1. Create a folder on your system for the Docker containers:
sudo mkdir /docker
sudo mkdir /docker/grafana
sudo mkdir /docker/prometheus
sudo mkdir /docker/netatmo-exporter
  1. Create the file prometheus.yml so that Prometheus can retrieve your data:
sudo nano /docker/prometheus/prometheus.yml
  1. Add the following content to the prometheus.yml file:
global:
  scrape_interval: 5s
  external_labels:
    monitor: 'codelab-monitor'

scrape_configs:
  - job_name: 'prometheus'
    scrape_interval: 5s
    static_configs:
      - targets: ['localhost:9090']
  - job_name: 'netatmo'
    scrape_interval: 45s
    static_configs:
      - targets: ['172.20.20.2:9210']
  1. Create the docker-compose.yml file:
sudo nano /docker/netatmo-exporter/docker-compose.yml
  1. Add the following content to the docker-compose.yml file and don't forget to add your Netatmo client ID, client secret and server IP:
version: '3'

services:
  prometheus:
    image: prom/prometheus:latest
    volumes:
      - /docker/prometheus:/etc/prometheus
    ports:
      - "9090:9090"
    networks:
      netatmo-network:
        ipv4_address: 172.20.20.3

  grafana:
    image: grafana/grafana:latest
    volumes:
      - grafana_data:/var/lib/grafana
    ports:
      - "3000:3000"
    networks:
      netatmo-network:
        ipv4_address: 172.20.20.4
      bridge:

  netatmo-exporter:
    image: ghcr.io/xperimental/netatmo-exporter:latest
    restart: unless-stopped
    environment:
      - NETATMO_CLIENT_ID=
      - NETATMO_CLIENT_SECRET=
      - NETATMO_EXPORTER_EXTERNAL_URL=http://your-server-ip:9210
    ports:
      - "9210:9210"
    networks:
      netatmo-network:
        ipv4_address: 172.20.20.2
      bridge:


  watchtower:
    image: containrrr/watchtower
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /root/.docker/config.json:/config.json


volumes:
  grafana_data:
    driver: local


networks:
  netatmo-network:
    driver: bridge
    ipam:
      config:
        - subnet: 172.20.20.0/24
  bridge:
    driver: bridge
  1. Open the Netatmo-exporter folder and execute the following command to start all containers:
sudo cd /docker/netatmo-exporter
sudo docker compose up -d
  1. Open http://yourserverip:9210 and click on authorizing here and accept that your data may be retrieved:

Bildschirmfoto 2023-07-21 um 11 22 50

Bildschirmfoto 2023-07-21 um 11 23 26

  1. Restart the container:
docker restart netatmo-exporter-netatmo-exporter1

Now you have Netatmo Exporter, Prometheus and Grafana installed to display your Netatmo weather data. Also, with Watchtower all containers are automatically updated when there is a new version.

Grafana can be reached at http://yourserverip:3000.

To add the data to a Grafana dashboard you first need to add Prometheus as a data source. The ip for this is: 172.20.20.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants