我尝试使用Telegraf收集一些关于我的Docker集装箱的指标。我已经安装了Docker sock,但我仍然收到错误消息。我错过了什么?
volumes:
- ./data/telegraf:/etc/telegraf
- /var/run/docker.sock:/var/run/docker.sock
2021-10-29T20:11:30Z E! [inputs.docker] Error in plugin: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get "http:///var/run/docker.sock/v1.21/containers/json?filters={"status":["running"]}&limit=0": dial unix /var/run/docker.so
[[inputs.docker]]
endpoint = "unix:///var/run/docker.sock"
gather_services = false
container_names = []
source_tag = false
container_name_include = []
container_name_exclude = []
timeout = "5s"
perdevice = true
total = false
docker_label_include = []
docker_label_exclude = []
tag_env = ["JAVA_HOME", "HEAP_SIZE"]
1条答案
按热度按时间iklwldmw1#
Telegraf Docker映像现在以
telegraf
用户/组的身份运行telegraf进程,而不再以root
用户的身份运行。为了监视传统上由root:docker group
拥有的Docker套接字,您需要将组传递给telegraf用户。这可以通过以下方式实现: