Telegraf container netstat and net of host

Hello,
I’m running Telegraf in a container and configured the volumes and environment variables as follows:

volumes:
  - "/:/hostfs:ro"
  - "/run/udev:/run/udev:ro"
  - "/var/run/docker.sock:/var/run/docker.sock:ro"
  - "$PWD/../conf/telegraf:/etc/telegraf/"
  - "$PWD/../logs/telegraf:/var/log"
networks:
  - backend
environment:
  - HOST_ETC=/hostfs/etc
  - HOST_PROC=/hostfs/proc
  - HOST_SYS=/hostfs/sys
  - HOST_VAR=/hostfs/var
  - HOST_RUN=/hostfs/run
  - HOST_MOUNT_PREFIX=/hostfs

It looks like the net plugin is only monitoring “eth0” which is possibly that of the container itself and not the actual host which is connected wirelessly and using wlan0.

Is it possible to get the host net stats without running the container on the “host” network? I would like to run Telegraf behind a reverse proxy and to have direct access to the Influxdb container within the docker environment.

Hi, I have the same issue

Did you solve this problem ?

hx in advance

Micka

Hi,

Was this working in previous versions? I’m starting to wonder if something in gopsutil changed.

In either case, adding --net host to get the container in the same network namespace as the host should make this work. See my previous comment around this topic.

Thanks!