https://community.iotawatt.com/t/getting-started-with-influxdb-and-grafana-using-docker-compose/4981
I thought I would share my docker-compose.yml file in case anyone else was interested in an easy way to get them up and running.
version: '3.6'
services:
influxdb:
image: influxdb:2.5.1-alpine
container_name: influxdb
restart: unless-stopped
networks:
- iotawatt_monitoring
ports:
- '8086:8086'
volumes:
- influxdb_data:/var/lib/influxdb2
grafana:
image: grafana/grafana
container_name: grafana-server
restart: unless-stopped
networks:
- iotawatt_monitoring
depends_on:
- influxdb
environment:
- GF_SECURITY_ADMIN_USER=admin
- GF_SECURITY_ADMIN_PASSWORD=admin1234 #change the password
- GF_INSTALL_PLUGINS=
links:
- influxdb
ports:
- '43000:3000'
volumes:
- grafana_data:/var/lib/grafana
networks:
iotawatt_monitoring:
volumes:
grafana_data:
influxdb_data:
Once I had these up and running, in Influx, I configured the organization and a bucket which are needed for both the Iotawatt and Grafana configurations and can be found under your username and then About.
The API Tokens can be created under the “Load Data” menu:
Be sure to copy the long key, because it can’t be shown again. But don’t worry, it’s easy to create a new one.
Once I had that, I went to IOTAWATT and added a Data Uploader for InfluxDB version 2.
I’m not sure if these are the best settings, but they worked for me. Obviously change your server URL, Bucket, Org ID, and Authorization Token (API Key).
I want to point out that if you have a lot of historical data and you chose to upload from a date that was months or years ago, the upload process can take hours. Check the status under the status page to see how far along the sync has gotten.
In Grafana, we need to add a new data source. Select InfluxDB, and then under those settings, change the query language to Flux (which is needed for v2). Since our docker compose created a network, we can use influxdb as the hostname for the URL so you should be able to use that.
The only other settings to change are under the InfluxDB Details. Add the Org, Token, and default bucket.
Then click save and test.
I’m still working on dashboards. To be continued.
Tidak ada komentar:
Posting Komentar