Telegraf cannot collecting docker metrics

telegraf

#1

Hi, All:
I installed telegraf(version is 1.7.4) on my CentOS7 to collect docker metrics. I configure telegraf to turning on docker input And I configure telegraf to turning on a file output.
In the output file only the system metrics have be written , this is no docker metrics. but when I exec “telegraf -config /etc/telegraf/telegraf.conf -input-filter docker -test” in the command line. And there is some docker data returned. such as:

docker_container_blkio,annotation.io.kubernetes.container.hash=c42fdbe,annotation.io.kubernetes.container.restartCount=9,annotation.io.kubernetes.container.terminationMessagePath=/dev/…

someone who can help me?


#2

Can you share your complete config file, please?


#3

thank you for help. I checked every log file In the ‘/var/log/’ directory
and finally get the problem that is about the Permission from the ‘messages’ log file. then i add telegraf user to docker group, as explained here

$ sudo usermod -aG docker telegraf

Finally it works。