Skip to content
Permalink
Browse files

add usage of clean_fieldname

Used the correct munin way by soursing "$MUNIN_LIBDIR/plugins/plugin.sh" and use clean_fieldname.
For the title I removed the replacement of / by __ and on the multigraph value I added the usage of clean_fieldname to make it backwards compatible.
  • Loading branch information...
Sephtex committed Feb 3, 2019
1 parent 0429e63 commit f6dbe9bd577cac23c5fdc76318a8c996db417361
Showing with 4 additions and 2 deletions.
  1. +4 −2 plugins/zfs/zfs_list
@@ -16,6 +16,8 @@
#
#%# family=auto

. "$MUNIN_LIBDIR/plugins/plugin.sh"

need_multigraph()

if [ "$1" = "autoconf" ]; then
@@ -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' | sed 's/-/_/g'`
fsname=$(clean_fieldname "$i")

echo <<EOF "multigraph zfs_list_$fsname
graph_title $fsname usage
@@ -75,7 +77,7 @@ 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' | sed 's/-/_/g'`
fsname=$(clean_fieldname $(echo "$i" | sed 's/\//__/g'))

echo <<EOF "multigraph zfs_list_$fsname
usedbydataset.value ${values[0]}

0 comments on commit f6dbe9b

Please sign in to comment.
You can’t perform that action at this time.