netatmo-exporter
netatmo-exporter copied to clipboard
Add docker-compose example
Could be useful for some people deploying this exporter with docker-compose (maybe in conjunction with prometheus and grafana)
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:
- 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
- Create the file prometheus.yml so that Prometheus can retrieve your data:
sudo nano /docker/prometheus/prometheus.yml
- 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']
- Create the docker-compose.yml file:
sudo nano /docker/netatmo-exporter/docker-compose.yml
- 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
- Open the Netatmo-exporter folder and execute the following command to start all containers:
sudo cd /docker/netatmo-exporter
sudo docker compose up -d
- Open http://yourserverip:9210 and click on authorizing here and accept that your data may be retrieved:
- 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