Last active
August 29, 2015 14:03
-
-
Save briansorahan/63a62be1f14f1775fd5e to your computer and use it in GitHub Desktop.
peek at the cgroup stats in sysfs for a docker container
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 | |
# | |
# Get docker container sysfs info | |
# | |
# Usage | |
# ./container-stats.bash <docker container id> | |
# | |
# Docker container id's can be found using | |
# docker ps -notrunc | |
# | |
function main { | |
local container_id="$1"; shift | |
local cgroup=/sys/fs/cgroup | |
for resource in cpu memory; do | |
local d=$cgroup/$resource/docker/$container_id | |
for f in $(find $d -name "*$resource*"); do | |
basename $f | |
cat $f | sed -r 's/^/\t/' | |
done | |
done | |
} | |
main "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment