Projet

Général

Profil

Révision f6dbe9bd

IDf6dbe9bd577cac23c5fdc76318a8c996db417361
Parent 0429e63b
Enfant c35eee02

Ajouté par Sephtex il y a presque 7 ans

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.

Voir les différences:

plugins/zfs/zfs_list
16 16
#
17 17
#%# family=auto
18 18

  
19
. "$MUNIN_LIBDIR/plugins/plugin.sh"
20

  
19 21
need_multigraph()
20 22

  
21 23
if [ "$1" = "autoconf" ]; then
......
31 33
if [ "$1" = "config" ]; then
32 34
	for i in `zfs list -Hp | awk '{print $1}'`; do
33 35
		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;}') )
34
		fsname=`echo $i | sed 's/\//__/g' | sed 's/-/_/g'`
36
		fsname=$(clean_fieldname "$i")
35 37

  
36 38
		echo <<EOF "multigraph zfs_list_$fsname
37 39
graph_title $fsname usage
......
75 77

  
76 78
for i in `zfs list -Hp | awk '{print $1}'`; do
77 79
	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;}') )
78
	fsname=`echo $i | sed 's/\//__/g' | sed 's/-/_/g'`
80
	fsname=$(clean_fieldname $(echo "$i" | sed 's/\//__/g'))
79 81

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

Formats disponibles : Unified diff