Get SWAP information for your LXD containers
If you use LXD and you have SWAP enabled on your host machine you may want to know the SWAP usage of some containers.
To do that, you must first enable the SWAP accounting in Linux, that can be done by adding a kernel parameter at boot time. If you use GRUB, you just need to edit the line
GRUB_CMDLINE_LINUX_DEFAULT= and add
update-grub && reboot.
You can then have some stats with
$ lxc info toots [...] Memory usage: Memory (current): 860.96MiB Memory (peak): 1.64GiB Swap (current): 563.36MiB Swap (peak): 87.00MiB [...]
Looks like it is a little buggy though, peak value behind under current value.