From ee9558b72735c69765346023cd1f8c731f070308 Mon Sep 17 00:00:00 2001 From: Marco Schmidt Date: Thu, 10 Apr 2025 12:53:31 +0200 Subject: [PATCH] ignore empty lines Ignore empty lines to prevent writing wrong lables. --- plugins/docker/docker_volumesize | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/docker/docker_volumesize b/plugins/docker/docker_volumesize index 3be53b5d..d1f598b4 100644 --- a/plugins/docker/docker_volumesize +++ b/plugins/docker/docker_volumesize @@ -50,6 +50,8 @@ if [ "$1" = "config" ]; then echo "graph_args -l 0 --base 1024" echo "graph_info This graph shows the size per volume." while IFS= read -r line; do + # ignore empty lines + [ -n "$line" ] || continue echo "$line" | awk 'BEGIN { FS = ":" } { label = substr($1, 1, 30); print $1 ".label " label }' # display info only when labels are set if [ -n "$(echo "$line" | awk 'BEGIN { FS = ":" } { print $3 }')" ]; then @@ -62,6 +64,8 @@ fi echo "multigraph volumesize" while IFS= read -r line; do + # ignore empty lines + [ -n "$line" ] || continue name=$(echo "$line" | awk 'BEGIN { FS = ":" } { print $1 }') value=$(echo "$line" | awk 'BEGIN { FS = ":" } { print $2 }')