I’ld like to add to this. lxcfs is what enables a container to have its own real values for the cpu load, load average, etc. There are several versions of
lxcfs, and any newer version can properly virtualize more kernel metrics.
Here is the latest version of lxcfs, 3.1.2, LXCFS 3.1.2 has been released Among the new features, is Add support for per-container cpu usage in
/proc/stat and more.
Therefore, the question with monitoring support in a container is converted into a question of Which version of lxcfs am I using in LXC or LXD?, so that I get proper virtualized values for my monitoring tool?
I am running the snap package of LXD, channel
stable. I got the latest version of
$ /snap/lxd/current/bin/lxcfs --version
Therefore, when testing with Debian, make sure you know which version of
lxcfs you are actually using. And consult the documentation (release notes) on what is covered in that version, if it is not the latest.
To figure out which metrics are virtualized in practical terms, you can setup
netdata in a container for testing purposes. Here is how to do it in LXD, https://blog.simos.info/how-to-setup-netdata-in-a-lxd-container-for-real-time-monitoring/ Note that those metrics that are not virtualized in your case, will give you easily visible bogus values.