cli icon indicating copy to clipboard operation
cli copied to clipboard

[FEATURE REQUEST] Add new columns to docker stat output

Open mcaleavya opened this issue 8 years ago • 4 comments

Description

I would like to propose adding a few options to the docker stat output.

--no-clear This stops the screen from being cleared when running docker stats. (I have an example of this working however I am still looking at how to only print the header data once in this mode rather than each time)

--add-timestamp This would add a TIME column with a human readable timestamp to the stat output again this compliments the -no-clear option so we can correlate times with metrics.

The main focus of this is to allow looking at the stats from the cli over a period of time, when using the api it takes around 2 seconds per container to gather stats each time. We can get this information from the stat command for all containers at the same time.

mcaleavya avatar Oct 03 '18 13:10 mcaleavya

@mcaleavya docker stats is calling the same stats API, it's just doing it in parallel.

cpuguy83 avatar Oct 03 '18 18:10 cpuguy83

HI Brian

Thanks for the update, would the project be open to the suggested changes from a cli standpoint?

Al

On Wed, Oct 3, 2018 at 7:31 PM Brian Goff [email protected] wrote:

@mcaleavya https://github.com/mcaleavya docker stats is calling the same stats API, it's just doing it in parallel.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/docker/cli/issues/1412#issuecomment-426746962, or mute the thread https://github.com/notifications/unsubscribe-auth/ADPbVLn9T3jA2Nk6aq8ShBEw2Vb4ZbQgks5uhQJ8gaJpZM4XF_3U .

mcaleavya avatar Oct 03 '18 18:10 mcaleavya

you'll need to install moreutils to get this to work, but this will prepend each line of the docker stats with a timestamp as it writes it to a file

while true; do sudo docker stats --no-stream | ts '[%H:%M:%S]' | tee --append stats.txt; sleep 1; done

I take no credit for this work as its a mish mash of other peoples work

max-carroll avatar Jan 17 '20 09:01 max-carroll

looks like this went stale; closing for now

thaJeztah avatar Apr 22 '25 16:04 thaJeztah