docker stats live container resource metrics#9984
Conversation
docker/flags.go
Outdated
|
What about showing stats for all running containers if |
af722be to
917b1f1
Compare
|
can you go up the exact number of lines and rewrite on top of it, instead of clearing the screen. (that's how we do for pull) |
|
@bobrik I guess it would depend on how many containers you have. You can always do docker stats `docker ps -q` |
|
exited containers aren't handled properly |
|
@vieux I think exited containers should get zeroed out then when they start again you start getting metrics. What do you think of that functionality ? |
daemon/stats_collector.go
Outdated
There was a problem hiding this comment.
this debug is printed way too often, I feel like the -D is useless with it.
api/client/commands.go
Outdated
There was a problem hiding this comment.
I'm not familiar with map concurrency guarantees, but is that a safe thing to do without locking?
api/stats/stats.go
Outdated
|
@crosbymichael I mean the cli is hanging and waiting for |
daemon/delete.go
Outdated
|
I got a panic when trying to delete a container: |
|
Fixed the panic |
fd5fe65 to
43c5038
Compare
|
@vieux fixed the issue where you request stats for a non running container, it will go ahead and add it then when it's started you see the stats start flowing in. |
api/client/commands.go
Outdated
There was a problem hiding this comment.
Check previousCpu < TotalUsage, otherwise negative numbers appear on container restart.
|
@crosbymichael It's like what @LK4D4 said. We may want to get the one-time status of containers. |
|
I noticed if I run |
|
@ekuric This is expected $(docker ps -q) is only run once, and is only pulling those ids. |
|
@cpuguy83 ah,yes, thank you,sorry for noise |
|
Thanks! This is a great addition. Are there plans to let users control the frequency with which they can extract stats data from the api endpoint? 1 second may be too aggressive when there are a lot of containers running on a host. |
|
The CPU usage % seem to be stuck at 0% for me. Being able to monitor the growing size of a running container and its disk I/O would also be very useful. |
|
Thanks for this new feature. Works like a charm |
|
@usertaken if you want disk IO for monitoring hit the API, the CLI is very dumbed down for a quick and simple view. If you are using this for monitoring use the api |
|
very nice stuff! |
|
I'm also waiting for the option like --count or something that just capture the stats once. It will be very useful when getting remote parameter. |
|
+1 to the count option. I'd love to create a New Relic plugin for this data but there is a lot of extra work I have to do if I don't have control over the polling interval (plus the consumption of a continuous stream is much more involved process) |
|
For me, I would like to get the current stats of the containers and no need to return the whole stream. It would be great to support this feature 😃 |
|
I agree :) |
|
+1 for a simply way of just getting current stats as opposed to subscribing and disconnecting |
|
@SvenDowideit API docs need a bit more info on what the cpu numbers mean and how you go about converting them to % cpu |
|
+1 for just getting current numbers without subscription. @crosbymichael I can create a separate issue. |
|
+1 :) |
|
👍 |
|
Stats are nice. Thanks. Here's a one-liner that does what you would expect However, the flicker is distinctly unpleasant. |
|
I love and appreciate the concept and current possibilities, however I have some thoughts: I don't understand why it is repeating (or why it doesn't have the count flag). I could eg. use 'watch' and its features to show me a constant update if I want that. I also find it hard to imagine writing a simple script to parse the json data if it has to be running forever. I'd rather query once a minute and send those stats to graphite (just an example), but I don't see how I could accomplish this in a simple way (someone has any thoughts?) I would also appreciate the presence of an 'all' option, especially for the json-part (where you would have to run several queries to get all container data) |
|
+1 for a count option. |
|
Please stop adding new feature requests to a closed/merged PR. If you have an enhancement/feature request, open a new issue. For those looking for a "count" option; there is a PR that implements a |
This PR allows you to receive live container metrics for your containers. You can use the
docker stats <containers...>cli command to get a live top like interface. This only displays a few of the metrics available.For people who require more information they can subscribe to the container's stats stream and receive more information such as blkio information.
GET
/v1/containers/redis/stats{ "read" : "2015-01-08T22:57:31.547920715Z", "network" : { "rx_dropped" : 0, "rx_bytes" : 648, "rx_errors" : 0, "tx_packets" : 8, "tx_dropped" : 0, "rx_packets" : 8, "tx_errors" : 0, "tx_bytes" : 648 }, "memory_stats" : { "stats" : { "total_pgmajfault" : 0, "cache" : 0, "mapped_file" : 0, "total_inactive_file" : 0, "pgpgout" : 414, "rss" : 6537216, "total_mapped_file" : 0, "writeback" : 0, "unevictable" : 0, "pgpgin" : 477, "total_unevictable" : 0, "pgmajfault" : 0, "total_rss" : 6537216, "total_rss_huge" : 6291456, "total_writeback" : 0, "total_inactive_anon" : 0, "rss_huge" : 6291456, "hierarchical_memory_limit" : 67108864, "total_pgfault" : 964, "total_active_file" : 0, "active_anon" : 6537216, "total_active_anon" : 6537216, "total_pgpgout" : 414, "total_cache" : 0, "inactive_anon" : 0, "active_file" : 0, "pgfault" : 964, "inactive_file" : 0, "total_pgpgin" : 477 }, "max_usage" : 6651904, "usage" : 6537216, "failcnt" : 0, "limit" : 67108864 "blkio_stats" : {}, "cpu_stats" : { "cpu_usage" : { "percpu_usage" : [ 16970827, 1839451, 7107380, 10571290 ], "usage_in_usermode" : 10000000, "total_usage" : 36488948, "usage_in_kernelmode" : 20000000 }, "system_cpu_usage" : 20091722000000000, "throttling_data" : {} } }