Byte count on network interfaces


Is there a way to get byte counts for network interfaces from within a bridges container?
Using nmcli?
Using supervisor API?
Some other way?


Probably the simplest is to read these from /proc directly, here is an example:

You’ll need a label to mount host’s /proc into the container.

1 Like

You could also try using vnstat. I usually install it in containers where I want to track network traffic.
This is for example handy if I have projects where I use a 3G USB dongle and want to monitor the traffic going over the network,

Hi ab77,

We tried to mount the procfs into our container but once we do it systemd stops working. We’re not sure yet why, but suspect it’s maybe overwriting the container’s /proc?? (although we don’t see the correct /proc/net/dev

Any ideas why adding “io.balena.features.procfs: ‘1’” breaks systemd?
Also, is this supposed to replace /proc or will it mount elsewhere?

Thank you!

I noticed these lines in the logs when procfs is enabled:
Jul 13 22:58:34 wellness systemd[1]: Cannot be run in a chroot() environment.
Jul 13 22:58:34 wellness systemd[1]: Freezing execution.
Jul 13 22:58:34 wellness kernel[809]: [ 1249.775377] systemd[1]: Cannot be run in a chroot() environment.
Jul 13 22:58:34 wellness kernel[809]: [ 1249.775476] systemd[1]: Freezing execution.

Hey there, enabling io.balena.features.procfs shouldn’t stop systemd on the host. Are you running systemd in your container, is that what stopped? There would definitely be a conflict in that case, and we normally wouldn’t recommend running systemd in a container.

Yes, we have systemd in the container and it seems to fail to start properly - see error I mentioned above.


Thanks for confirming. Are you following the best practices we have here to run systemd in a container?

Also, to confirm, yes the current behaviour is to mount /proc from the hostOS to the container at /proc. You can see it here

Hope this is helpful