Can't see all host machine network adapters

I’m running docker on a Synology NAS which has two (non loopback) network adapters, eth0 and eth1. Only eth1 is in use, eth0 port isn’t connected to anything at all.

I recently set up telegraf and influxdbv2 to pull some metrics from the NAS. My telegraf.conf has [[inputs.net]] uncommented. I originally left it at that, but when clicking through the bucket in influx, only eth0 was visible as an option to select (either if I filter by interface or click through everything from the _measurement option). I tried setting the interfaces = ["eth1"] but that didn’t actually change anything.

I realise that this may be something to do with docker’s link to the NAS rather than telegraf/influx specifically, but I’ve been searching for info online on and off for maybe 2 weeks and I’ve not been able to find anything that looks even remotely close to what I might need, so any help or pointers would be greatly appreciated.

Hi,

My guess is your container does not know about or have access to your host’s network adapters. Recall when a container starts up, it is in a different namespace as your host and will not have access to the host’s network devices. It will have its own eth0 device, which is what you probably see results from.

The simple way to get stats is to add --net=host which will use the system’s namespace for networking:

docker run -it --net host -v $PWD/config.toml:/etc/telegraf/telegraf.conf telegraf

Hey thanks for taking the time. You’re right. Forgot a pretty basic thing.

No worries, you are not the first to ask this very question :slight_smile:

1 Like