i'm currently trying to setup a grafana/influxdb2 interaction for IoT purposes. Both are running insides dockers and they are equally reachable via host machine browser on the respective port
docker run -d -p 3000:3000 `
--name=grafana `
-v ${PWD}:/var/lib/grafana `
-e "GF_SECURITY_ADMIN_PASSWORD=test" `
-e "GF_INSTALL_PLUGINS=grafana-clock-panel,grafana-simple-json-datasource" `
-e "GF_SECURITY_ALLOW_EMBEDDING=true" `
-e "GF_USERS_ALLOW_SIGN_UP=false" `
-e "GF_AUTH_ANONYMOUS_ENABLED=true" `
-e "GF_AUTH_BASIC_ENABLED=false" `
-e "GF_SERVER_PROTOCOL=https" `
-e "GF_SERVER_CERT_FILE=/var/lib/grafana/ssl/grafana.crt" `
-e "GF_SERVER_CERT_KEY=/var/lib/grafana/ssl/grafana.key" `
grafana/grafana
docker run -d -p 8086:8086 `
--name=influxdb2 `
-v ${PWD}/influxdb2:/var/lib/influxdb2 `
-e DOCKER_INFLUXDB_INIT_MODE=setup `
-e DOCKER_INFLUXDB_INIT_USERNAME=admin`
-e DOCKER_INFLUXDB_INIT_PASSWORD=test`
-e DOCKER_INFLUXDB_INIT_ORG=my `
-e DOCKER_INFLUXDB_INIT_BUCKET=PVdb `
-e INFLUXDB_HTTP_HTTPS_ENABLED=true `
-e INFLUXDB_HTTP_HTTPS_CERTIFICATE=/var/lib/ssl/influxdb2.crt`
-e INFLUXDB_HTTP_HTTPS_PRIVATE_KEY=/var/lib/ssl/influxdb2.key `
influxdb:2.0
I'll start listing the issues im facing:
- Influxdb is not running under HTTPS even though i'm passing those -e commands, i guess i'm missing something for sure since the docker log isn't reporting anything. --> Solved, see below
- I browsed through a lot of videos and all the tutorials are showing how you can do
docker exec -it influxdb2 sh
and then
influx
show database
to see the current status but in my case when i type "influx" i'm instead receiving
Influx Client
Usage:
influx [command]
Available Commands:
...
and "show" is not recognized as command. --> See below
What i'm currently missing is a "basic" way to write/read to get confident with the tool
I've also tried using POST commands
curl --request POST "http://localhost:8086/api/v2/write?org=my&bucket=PVdb&precision=s" --header "Authorization: Token myTOKEN" --data-raw "mem,host=host1 used_percent=23.43234543 1556896326"
but curl is not returning anything and i have yet no way to check if the data is present.
- As last issue in grafana when i add the influxdb (Query Language Flux, URL: http://localhost:8086 (Server)) with Organization, Token and Bucket by pressing Save & Test i receive
Error reading InfluxDB
--> Solved, see below
Answer:
- Add this (even though http is still available)
-e INFLUXD_TLS_CERT=/var/lib/influxdb2/ssl/influxdb2.crt `
-e INFLUXD_TLS_KEY=/var/lib/influxdb2/ssl/influxdb2.key `
- I guess all the tutorials are about influxdb 1.8, now the client uses
influx query
altough you can try and use
influx v1 dbrp
- I had to change "localhost" with the "machine local ip" in the URL (e.g. https://192.x.x.x:8086)
Regards