You may know that I really like LXC and the major problem when you want to use that solution in production is: how do you monitor memory and CPU?
Regarding the CPU side, I do not have an easy answer for the moment :-(. However regarding the memory, I’ve made a Nagios/Naemon check which will check the memory (RAM) and SWAP of a container. Here is how to use it:
Usage : check_lxc_resources -h <container> -n <namespace> -w <warning%> -c <critical%> [-d]
-h : set container name
-n : set container namespace to check (memory|swap)
-w : set warning percent alert
-c : set critical percent alert
-d : debug mode
-help : print this message
Output will looks like this for memory:
memory usage is 42.95% (219M/512M) / 292M free / 177M cached
And like this for swap:
swap usage is 0.02% (0M/464M) / 463M free
If you want to know more about this check or simply use it, you can find it on my GitHub. I hope you’ll like it.