Skip to content

Commit

Permalink
Merge pull request #970 from Sephtex/Sephtex/969/zfs_list_plugin_wot_…
Browse files Browse the repository at this point in the history
…working_with_dash

Add support for dash in zfs_list
  • Loading branch information
sumpfralle committed Feb 16, 2019
2 parents 0598644 + f72390c commit 5c3ee23
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions plugins/zfs/zfs_list
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#
#%# family=auto

. "$MUNIN_LIBDIR/plugins/plugin.sh"

need_multigraph()

if [ "$1" = "autoconf" ]; then
Expand All @@ -31,7 +33,7 @@ fi
if [ "$1" = "config" ]; then
for i in `zfs list -Hp | awk '{print $1}'`; do
values=( $(zfs get -p usedbydataset,usedbychildren,usedbysnapshots,usedbyrefreservation,available,quota $i | awk 'BEGIN {total=0;} { if( NR==1 ) next; } !/quota/ {total=total+$3;} {print $3} END{print total;}') )
fsname=`echo $i | sed 's/\//__/g'`
fsname=$(clean_fieldname $(echo "$i" | sed 's/\//__/g'))

echo <<EOF "multigraph zfs_list_$fsname
graph_title $fsname usage
Expand Down Expand Up @@ -75,9 +77,9 @@ fi

for i in `zfs list -Hp | awk '{print $1}'`; do
values=( $(zfs get -p usedbydataset,usedbychildren,usedbysnapshots,usedbyrefreservation,available,quota $i | awk 'BEGIN {total=0;} { if( NR==1 ) next; } !/quota/ {total=total+$3;} {print $3} END{print total;}') )
fsname=`echo $i | sed 's/\//__/g'`
fsname=$(clean_fieldname $(echo "$i" | sed 's/\//__/g'))

echo <<EOF "multigraph zfs_list_$fsname
echo <<EOF "multigraph zfs_list_$fsname
usedbydataset.value ${values[0]}
usedbysnapshots.value ${values[2]}
usedbychildren.value ${values[1]}
Expand Down

0 comments on commit 5c3ee23

Please sign in to comment.