Last active
August 29, 2015 14:06
-
-
Save infoslack/9bb5a5d4ebd5b5d29c05 to your computer and use it in GitHub Desktop.
LXC: ressources statistics
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # https://blog.deimos.fr/2014/06/16/lxc-ressources-statistics/ | |
| for i in * ; do | |
| if [ -d $i ] ; then | |
| echo "===== $i =====" | |
| echo "CPU, cap: " $(cat /sys/fs/cgroup/lxc/$i/cpuset.cpus) | |
| echo "CPU, shares: " $(cat /sys/fs/cgroup/lxc/$i/cpu.shares) | |
| awk '{ printf "RAM, limit usage: %sM\n", $1/ 1024/1024 }' /sys/fs/cgroup/lxc/$i/memory.limit_in_bytes | |
| awk '{ printf "RAM+SWAP, limit usage: %sM\n", $1/ 1024/1024 }' /sys/fs/cgroup/lxc/$i/memory.memsw.limit_in_bytes | |
| awk '{ printf "RAM, current usage: %sM\n", $1/ 1024/1024 }' /sys/fs/cgroup/lxc/$i/memory.usage_in_bytes | |
| awk '{ printf "RAM+SWAP, current usage: %sM\n", $1/ 1024/1024 }' /sys/fs/cgroup/lxc/$i/memory.memsw.usage_in_bytes | |
| awk '{ printf "RAM, max usage: %sM\n", $1/ 1024/1024 }' /sys/fs/cgroup/lxc/$i/memory.max_usage_in_bytes | |
| awk '{ printf "RAM+SWAP, max usage: %sM\n", $1/ 1024/1024 }' /sys/fs/cgroup/lxc/$i/memory.memsw.max_usage_in_bytes | |
| echo "DISK I/O weight: " $(cat /sys/fs/cgroup/lxc/$i/blkio.weight) | |
| echo "" | |
| fi | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment