Docker Community Forums

Share and learn in the Docker community.

Possible to make a container refers to the host's /proc/net/dev instead of its own?

Hi,

I am trying out node-exporter in Docker, and I would like to acquire the node_network_receive_bytes_total of my host machine (This is simply a statistics which is used for measuring how much data are flowing into the machine). Right now, node_network_receive_bytes_total is possibly referring to the virtual eth0 of the containerized node-exporter and not the actual host machine itself. I have tried wget on the host, and node_network_receive_bytes_total does not move at all. But when I tried wget in the containerized node-exporter, node_network_receive_bytes_total increases with respect to the amount of incoming bytes.

node_network_receive_bytes_total refers to the value from /proc/net/dev (src: https://github.com/prometheus/node_exporter/issues/1849 )

Right now, for convenient-sake, I am using Docker-Compose which contains Prometheus, Grafana, Node-Exporter, etc. and deploy everything in one go. In this case, is it possible to instruct node-exporter to refer to the host machine’s /proc/net/dev? Or make it so node-exporter is deployed on the host and not in the container while still using Docker-compose?

Thank you

Very good information Need to ask for advice

lavagame

netdata already supports option -s /path and configuration option [global].host access prefix = /path.

/path will be used to prefix all /proc and /sys filenames.

So, /proc/net/dev will become /path/proc/net/dev.

netdata uses several files:

egrep -o ‘/(proc|sys)/[a-z0-9/]+"’ src/*.c | cut -d ‘:’ -f 2 | sort -u

/proc/1/mountinfo"
/proc/diskstats"
/proc/interrupts"
/proc/loadavg"
/proc/meminfo"
/proc/net/dev"
/proc/net/netstat"
/proc/net/rpc/nfs"
/proc/net/rpc/nfsd"
/proc/net/snmp"
/proc/net/snmp6"
/proc/net/stat/conntrack"
/proc/net/stat/synproxy"
/proc/self/mountinfo"
/proc/softirqs"
/proc/stat"
/proc/vmstat"
/sys/fs/cgroup/blkio"
/sys/fs/cgroup/cpuacct"
/sys/fs/cgroup/devices"
/sys/fs/cgroup/memory"
/sys/kernel/mm/ksm"