telegraf: can not find docker metrics in influxdb, anyone can help?

I start telegraf with the following config

$ more /etc/telegraf/telegraf.d/docker.conf
[[inputs.docker]]
  # Docker Endpoint
  #   To use TCP, set endpoint = "tcp://[ip]:[port]"
  #   To use environment variables (ie, docker-machine), set endpoint = "ENV"
  endpoint = "unix:///var/run/docker.sock"
  # Only collect metrics for these containers, collect all if empty
  container_names = []

and start telegraf by following command:

/usr/bin/telegraf -config /etc/telegraf/telegraf.conf -config-directory /etc/telegraf/telegraf.d  

but can not find any measurements about docker in influxdb:

> show measurements;
name: measurements
------------------
name
cpu
disk
diskio
mem
swap
system

actually, I can see docker datas collected by telegraf

$/usr/bin/telegraf -config /etc/telegraf/telegraf.conf -config-directory /etc/telegraf/telegraf.d  -input-filter docker -test
* Plugin: docker, Collection 1
......
> docker_cpu,com.docker.compose.config-hash=2db93f17fb0fdbb2b3be408209d18ac7eb9f44d787af2df58b6f6601771763cf,com.docker.compose.container-number=1,com.docker.compose.oneoff=False,com.docker.compose.project=grafana,com.docker.compose.service=grafana,com.docker.compose.version=1.5.1,cont_id=528cfa640ba2863df3febd0cd28b173527599b8c2d81a26c6965fc3b13b0ea2d,cont_image=grafana/grafana,cont_name=grafana_grafana_1,cpu=cpu1 usage_total=8040078470i 1454561313911620608
......

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 35 (11 by maintainers)

Most upvoted comments

Check the syslogs (tail -f /var/log/syslog). If the error is

Error in plugin [inputs.docker]: Got permission denied while trying to connect to the Docker daemon...

then you have to add telegraf user to docker group, as explained here:

$ sudo usermod -aG docker telegraf

@sporokh I understand you’re also hitting the issue, right? I’d like to have a PR ready by the end of the week…although cannot really promise, little bit short on time this week, but I’ll try.

To anyone looking for a solution on ARM based architecture…

As root open the cmdline.txt file… $ sudo nano /boot/firmware/cmdline.txt

Add the following to the end of the file… cgroup_enable=cpuset cgroup_enable=memory cgroup_memory=1

Reboot the system… $ sudo reboot

Verify that the changes have worked! $ docker stats

Hope this helps.