Cześć,
próbuję uruchomić Grafana, InfluxDB i Telegraf z użyciem docker-compose. Kontenery uruchamiają się poprawnie, ale w logach dostaję informacje o braku utwierzytelnienia (401) dla Telegrafa. Dlaczego tak się dzieje i jak prawidłowo powinien skonfigurować połączenie? Poniżej logi i docker-compose.yml.
2022-02-20T17:49:03Z E! [agent] Error writing to outputs.influxdb: could not write any address
2022-02-20T17:49:03Z E! [outputs.influxdb_v2] When writing to [http://influxdb:8086]: failed to write metric (401 Unauthorized): unauthorized: unauthorized access
2022-02-20T17:49:03Z E! [agent] Error writing to outputs.influxdb_v2: failed to write metric (401 Unauthorized): unauthorized: unauthorized access
2022-02-20T17:49:13Z E! [outputs.influxdb] When writing to [http://localhost:8086]: failed doing req: Post "http://localhost:8086/write?db=telegraf": dial tcp 127.0.0.1:8086: connect: connection refused
2022-02-20T17:49:13Z E! [agent] Error writing to outputs.influxdb: could not write any address
2022-02-20T17:49:13Z E! [outputs.influxdb_v2] When writing to [http://influxdb:8086]: failed to write metric (401 Unauthorized): unauthorized: unauthorized access
2022-02-20T17:49:13Z E! [agent] Error writing to outputs.influxdb_v2: failed to write metric (401 Unauthorized): unauthorized: unauthorized access
version: "3.7"
services:
grafana:
image: grafana/grafana:8.4.1-ubuntu
container_name: grafana
ports:
- 3000:3000
volumes:
- grafanadata:/var/lib/grafana
depends_on:
- influxdb
telegraf:
image: telegraf:1.21.4-alpine
container_name: telegraf
environment:
- DOCKER_INFLUXDB_INIT_ORG=myorganization
- DOCKER_INFLUXDB_INIT_BUCKET=mybucket
- DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=mytoken
volumes:
- ./telegraf/mytelegraf.conf:/etc/telegraf/telegraf.conf
depends_on:
- influxdb
influxdb:
image: influxdb:2.1.1-alpine
container_name: influxdb
environment:
- DOCKER_INFLUXDB_INIT_MODE=setup
- DOCKER_INFLUXDB_INIT_USERNAME=telegraf
- DOCKER_INFLUXDB_INIT_PASSWORD=mypasswordpassword
- DOCKER_INFLUXDB_INIT_ORG=myorganization
- DOCKER_INFLUXDB_INIT_BUCKET=mybucket
- DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=mytoken
ports:
- 8086:8086
volumes:
- influxdbdata:/var/lib/influxdb
volumes:
grafanadata:
influxdbdata: