So I was recently messing with Docker to keep up on my skills, and I wanted to see how much resources were required by each container over a given time period. So I came up with the following command to run in the terminal to collect it.
This command will produce an output similar to the following (details removed):
Important parts to note include the
ts command this prepends the
time stamp to every linen of output, it’s from the
An alternate option would be to use
date to add the
time stamp, but every line but this is cleaner and faster cause
otherwise we would be starting a lot more processes.
tr command is used to remove the extra slashes as we don’t need
tail commands are used to capture only the parts
of the output we’re interested in like the headers or without the
Things that could be improved are the formatting of the columns to be truly fixed width, and adding a date header, but it’s good for very quick analysis in whatever your favorite tool is. Mine just happens to currently be Excel for the power of pivot tables.