Created
November 14, 2024 12:26
-
-
Save gquittet/abfd0f6f6d852e70b7ef5b89fa0da2d3 to your computer and use it in GitHub Desktop.
Small one-liner to see full network usage of running/all containers
This file contains 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
printf " | |
\e[1mDocker Network Usage\e[0m | |
\e[3mRunning containers (I/O):\e[0m $(docker stats --format "table {{.NetIO}}" --no-stream | tail -n +2 | sed "s/kB/KB/g" | sed "s/B//g" | cut -d '/' -f1 | numfmt --from=iec | awk '{ sum += $1; } END { print sum; }' | numfmt --to=iec) / $(docker stats --format "table {{.NetIO}}" --no-stream | tail -n +2 | sed "s/kB/KB/g" | sed "s/B//g" | cut -d '/' -f2 | numfmt --from=iec | awk '{ sum += $1; } END { print sum; }' | numfmt --to=iec) | |
\e[3mAll containers (I/O):\e[0m $(docker stats --all --format "table {{.NetIO}}" --no-stream | tail -n +2 | sed "s/kB/KB/g" | sed "s/B//g" | cut -d '/' -f1 | numfmt --from=iec | awk '{ sum += $1; } END { print sum; }' | numfmt --to=iec) / $(docker stats --all --format "table {{.NetIO}}" --no-stream | tail -n +2 | sed "s/kB/KB/g" | sed "s/B//g" | cut -d '/' -f2 | numfmt --from=iec | awk '{ sum += $1; } END { print sum; }' | numfmt --to=iec) | |
" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment