我正在尝试集成 grafana 和 influxdb 以获得一些指标。但不确定当我尝试测试它时,对数据源的身份验证失败。请帮我解决这个问题。
这是下面的 yaml 和 conf 文件。
Docker-compose 文件
version: "3"
services:
grafana:
image: grafana/grafana
container_name: grafana
restart: always
ports:
- 3000:3000
networks:
- monitoring
volumes:
- grafana-volume:/vol01/Docker/monitoring
environment:
- GF_LOG_LEVEL=debug
- GF_DATAPROXY_LOGGING=true
- GF_DATAPROXY_TIMEOUT=60
influxdb:
image: influxdb
container_name: influxdb
restart: always
ports:
- 8086:8086
networks:
- monitoring
volumes:
- influxdb-volume:/vol01/Docker/monitoring
environment:
- INFLUXDB_DB=telegraf
- INFLUXDB_USER=telegraf
- INFLUXDB_ADMIN_ENABLED=true
- INFLUXDB_HTTP_AUTH_ENABLED=false
- INFLUXDB_ADMIN_USER=admin
- INFLUXDB_ADMIN_PASSWORD=Welcome1
- GF_LOG_LEVEL=debug
- GF_DATAPROXY_LOGGING=true
telegraf:
image: telegraf
container_name: telegraf
restart: always
extra_hosts:
- "influxdb:18.216.224.127"
environment:
ST_PROC: /rootfs/proc
HOST_SYS: /rootfs/sys
HOST_ETC: /rootfs/etc
volumes:
- ./telegraf.conf:/etc/telegraf/telegraf.conf:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
- /sys:/rootfs/sys:ro
- /proc:/rootfs/proc:ro
- /etc:/rootfs/etc:ro
networks:
monitoring:
volumes:
grafana-volume:
配置文件
[global_tags]
[agent]
interval = "60s"
round_interval = true
metric_batch_size = 1000
metric_buffer_limit = 10000
collection_jitter = "0s"
flush_interval = "10s"
flush_jitter = "0s"
precision = ""
hostname = "18.216.224.127"
omit_hostname = false
[[outputs.influxdb]]
urls = ["http://18.216.224.127:8086"]
database = "telegraf"
timeout = "5s"
username = "telegraf"
password = "Welcome1"
[[inputs.ping]]
interval = "5s"
urls = ["192.168.0.44", "192.168.0.131", "192.168.0.130", "google.com", "amazon.com", "github.com"]
count = 4
ping_interval = 1.0
timeout = 2.0
[[inputs.cpu]]
percpu = true
totalcpu = true
collect_cpu_time = false
report_active = false
[[inputs.disk]]
ignore_fs = ["tmpfs", "devtmpfs", "devfs", "iso9660", "overlay", "aufs", "squashfs"]
[[inputs.diskio]]
[[inputs.kernel]]
[[inputs.mem]]
[[inputs.processes]]
[[inputs.swap]]
[[inputs.system]]
错误
t=2021-05-08T11:02:29+0000 lvl=info msg="数据源认证失败" logger=data-proxy-log userId=1 orgId=1 uname=admin path=/api/datasources /proxy/1/query remote_addr=108.237.178.97 referer=http://18.216.224.127:3000/datasources/edit/1/ body="{"code":"unauthorized","message":"Unauthorized"}"状态码=401 t=2