Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion plugins/docker/docker_volumesize
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Michael Grote ([email protected])
=head1 MAGIC MARKERS

#%# family=auto
#%# capabilities=autoconf

=head1 LICENSE

Expand All @@ -37,7 +38,7 @@ if [ "$1" = "autoconf" ]; then
exit 0
fi

volume_info=$(docker system df -v --format '{{json .Volumes}}' | jq -r '.[] | "\(.Name):\(.Size):\(.Labels)"')
volume_info=$(docker system df -v --format '{{json .Volumes}}' | jq -r '.[] | select(.Size != "0B" ) | "\(.Name):\(.Size):\(.Labels)"')



Expand All @@ -49,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
Expand All @@ -61,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 }')

Expand Down