Skip to content

Commit b6cbfa7

Browse files
committed
Use formatting to ensure columns are static
1 parent d16deb3 commit b6cbfa7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

check_docker.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,10 @@ function getstats () {
153153
else
154154
case "$typestats" in
155155
CPUPerc)
156-
currentstats=`docker stats --no-stream | grep $cid | awk '{print $2}'`
156+
currentstats=`docker stats --no-stream --format "table {{.Name}}\t{{.CPUPerc}}" $cid | tail -n1 | awk '{print $2}'`
157157
;;
158158
MemPerc)
159-
currentstats=`docker stats --no-stream | grep $cid | awk '{print $8}'`
159+
currentstats=`docker stats --no-stream --format "table {{.Name}}\t{{.MemUsage}}" $cid | tail -n1 | awk '{print $2}'`
160160
;;
161161
*)
162162
echo "Unknown argument: $typestats"

0 commit comments

Comments
 (0)