1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-22 02:51:03 +00:00

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.
This commit is contained in:
Sephtex 2019-02-03 19:10:56 +01:00 committed by GitHub
parent 0429e63be5
commit f6dbe9bd57
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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]}