Gathering stats about host from Telegraf running in container

Hi,

Is there any way currently to gather stats from the host of a telegraf running inside a docker container?

From searching it seems like there was a solution via defining an alternate path, but that support has since been deprecated…

@MattC You just need to mount the host volumes that each plugin depends on. I’ve got a good list for most of the basic plugins over in the tick-charts repo. Does that help out?

Thanks for the response. Where should i be defining the host volumes for each plugin? Inside the telegraf config? If you could provide an example that would help. Thanks!

@MattC You need to mount the files from wherever they are on the host into the container then telegraf will just work as intended. That will depend on both your container image and host OS so its a little hard to provide examples. This article on docker volumes should help.

The equivalent docker run command to the manifest I linked in the last post is below.

docker run -it \ 
  -v /var/run/utmp:/var/run/utmp \
  -v /rootfs/proc:/proc \
  -v /rootfs/sys:/sys \
  -v /var/run/docker.sock:/var/run/docker.sock 
  telegraf:alpine