How to find out information about a LXC (Linux container) CPU & Memory Usage
To find information about CPU and memory usage of a Linux Container (LXC), you can use the following commands:
- CPU usage:
lxc-info -n <container_name> | grep 'CPU use'This will show you the percentage of CPU utilization by the container.
- Memory usage:
lxc-info -n <container_name> | grep 'Memory use'This will show you the amount of memory used by the container.
<container_name> with the name of your LXC container.You can also use the lxc-top command to display real-time statistics for CPU, memory, and network usage for all containers on the system:
lxc-topIn addition, you can use the free command inside the container to check its memory usage:
lxc-attach -n <container_name> -- free -mAnd the top command to check CPU usage:
lxc-attach -n <container_name> -- top
