mirror of
https://github.com/munin-monitoring/contrib.git
synced 2018-11-08 00:59:34 +01:00
decrease numbers of fork
This commit is contained in:
parent
b6c8c55925
commit
498e871d22
@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
#!/usr/local/bin/bash
|
||||
#
|
||||
# Plugin to monitor a ZFS Filesystem
|
||||
#
|
||||
@ -24,9 +24,6 @@
|
||||
|
||||
myname=`basename $0 | sed 's/^zfs_fs_//g' | sed -e 's/_/\//g'`
|
||||
|
||||
name="${name-\<$myname\>}"
|
||||
REGEX="${regex-\<$name\>}"
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
# Makes little sense to autoconf if you can't suggest
|
||||
echo no
|
||||
@ -37,20 +34,13 @@ if [ "$1" = "suggest" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
usedbydataset=`zfs get -p usedbydataset $myname | grep $myname | awk '{print $3}'`
|
||||
usedbychildren=`zfs get -p usedbychildren $myname | grep $myname | awk '{print $3}'`
|
||||
usedbysnapshots=`zfs get -p usedbysnapshots $myname | grep $myname | awk '{print $3}'`
|
||||
usedbyrefreservation=`zfs get -p usedbyrefreservation $myname | grep $myname | awk '{print $3}'`
|
||||
available=`zfs get -p available $myname | grep $myname | awk '{print $3}'`
|
||||
quota=`zfs get -p quota $myname | grep $myname | awk '{print $3}'`
|
||||
total=$((usedbydataset+usedbysnapshots+available+usedbychildren+usedbyrefreservation))
|
||||
|
||||
values=( $(zfs get -p usedbydataset,usedbychildren,usedbysnapshots,usedbyrefreservation,available,quota $myname | awk 'BEGIN {total=0;} { if( NR==1 ) next; } !/quota/ {total=total+$3;} {print $3} END{print total;}') )
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
|
||||
echo "graph_title zfs $myname"
|
||||
echo 'graph_order usedbydataset usedbychildren usedbysnapshots usedbyrefreservation available total quota'
|
||||
echo "graph_args --base 1024 -r -l 0 --vertical-label Bytes --upper-limit $total"
|
||||
echo "graph_args --base 1024 -r -l 0 --vertical-label Bytes --upper-limit ${values[6]}"
|
||||
echo 'graph_info This graph shows how is used a zfs filesystems.'
|
||||
echo 'graph_category Zfs'
|
||||
echo 'graph_period second'
|
||||
@ -85,15 +75,12 @@ if [ "$1" = "config" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
|
||||
echo "usedbydataset.value $usedbydataset"
|
||||
echo "usedbysnapshots.value $usedbysnapshots"
|
||||
echo "usedbychildren.value $usedbychildren"
|
||||
echo "usedbyrefreservation.value $usedbyrefreservation"
|
||||
echo "available.value $available"
|
||||
echo "total.value $total"
|
||||
echo "quota.value $quota"
|
||||
|
||||
echo "usedbydataset.value ${values[0]}"
|
||||
echo "usedbysnapshots.value ${values[2]}"
|
||||
echo "usedbychildren.value ${values[1]}"
|
||||
echo "usedbyrefreservation.value ${values[3]}"
|
||||
echo "available.value ${values[4]}"
|
||||
echo "total.value ${values[6]}"
|
||||
echo "quota.value ${values[5]}"
|
||||
|
||||
exit 0
|
||||
|
Loading…
Reference in New Issue
Block a user