To find out information about the CPU and memory usage of a Linux container (LXC), you can use the lxc-info
command with the -n
option, followed by the name of the container. The syntax is as follows:
lxc-info -n container_nameSource:www.lautturi.com
This will display information about the container, including the CPU and memory usage.
For example, the output might look something like this:
Name: container_name State: RUNNING CPU use: 1.06 seconds CPU usage: 0.00% Memory use: 94.47 MB Memory limit: 2.00 GB
In this example, the container is running and is using 1.06 seconds of CPU time and 94.47 MB of memory.
Alternatively, you can use the lxc-cgroup
command with the -n
option, followed by the name of the container, to display the CPU and memory usage of the container. The syntax is as follows:
lxc-cgroup -n container_name cpuacct.usage lxc-cgroup -n container_name memory.usage_in_bytes
This will display the CPU usage in microseconds and the memory usage in bytes.
For example, the output might look something like this:
106000 99473920
You can use the lxc-cgroup
command with the -n
option, followed by the name of the container, to display the CPU and memory limits of the container. The syntax is as follows:
lxc-cgroup -n container_name cpuacct.usage_percpu lxc-