Last active
August 29, 2015 14:15
-
-
Save bsmile/987dfb2e1a6e0dd66c77 to your computer and use it in GitHub Desktop.
docker1.5の新機能[stats]を使用して、外部からリソース状況を拾ってみる。 ref: http://qiita.com/_BSmile_/items/0a02d28911f77898bf89
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
# Modify these options if you want to change the way the docker daemon runs | |
# OPTIONS=--selinux-enabled -H fd:// | |
OPTIONS=--selinux-enabled -H fd:// -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock | |
# Location used for temporary files, such as those created by | |
# docker load and build operations. Default is /var/lib/docker/tmp | |
# Can be overriden by setting the following environment variable. | |
# DOCKER_TMPDIR=/var/tmp |
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
# docker stats cadvisor | |
CONTAINER CPU % MEM USAGE/LIMIT MEM % NET I/O | |
cadvisor 1.66% 25.3 MiB/3.704 GiB 0.67% 11.23 MiB/27.22 MiB |
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
# systemctl restart docker.service |
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
# firewall-cmd --add-port=2375/tcp |
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
$ curl -X GET http://127.0.0.1:2375/containers/[container id]/stats |
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
$ curl -X GET http://127.0.0.1:2375/containers/[container id]/stats --max-time 1 | jq '.cpu_stats' | |
% Total % Received % Xferd Average Speed Time Time Time Current | |
Dload Upload Total Spent Left Speed | |
100 1961 0 1961 0 0 1210 0 --:--:-- 0:00:01 --:--:-- 1210 | |
curl: (28) Operation timed out after 1620 milliseconds with 1961 out of -1 bytes received | |
{ | |
"throttling_data": { | |
"throttled_time": 0, | |
"throttled_periods": 0, | |
"periods": 0 | |
}, | |
"system_cpu_usage": 1.01798489e+15, | |
"cpu_usage": { | |
"usage_in_usermode": 1.0411e+11, | |
"usage_in_kernelmode": 5.916e+10, | |
"percpu_usage": [ | |
99302252799, | |
101617606123 | |
], | |
"total_usage": 200919858922 | |
} | |
} |
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
# curl -s -X GET http://127.0.0.1:2375/containers/[container id]/stats --max-time 1 | jq '.cpu_stats' | |
{ | |
"throttling_data": { | |
"throttled_time": 0, | |
"throttled_periods": 0, | |
"periods": 0 | |
}, | |
"system_cpu_usage": 2.03790306e+15, | |
"cpu_usage": { | |
"usage_in_usermode": 5.0961e+11, | |
"usage_in_kernelmode": 3.5196e+11, | |
"percpu_usage": [ | |
445562955080, | |
439404240147 | |
], | |
"total_usage": 884967195227 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment