1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-25 02:18:08 +00:00

- have some dirs

This commit is contained in:
Steve Schnepp 2012-02-13 18:24:46 +01:00
parent 0b089ea777
commit 08346aac58
687 changed files with 0 additions and 0 deletions

View file

@ -0,0 +1,87 @@
#!/usr/local/bin/bash
#
# Plugin to monitor a ZFS Filesystem
#
# Wildcard-plugin to monitor a zfs filesystems.
#
# To monitor a filesystem, link zfs_fs_<zpool>_<filesystem> to this file. E.g.
#
# ln -s /usr/share/munin/node/plugins-auto/zfs_fs_ /etc/munin/node.d/zfs_fs_tank_foo
#
# ...will monitor tank/foo fs.
#
# You can monitor zpool as well by a link on zfs_fs_<zpool>
#
# Parameters understood:
#
# config (required)
# autoconf (optional - used by munin-config)
#
# ** WARNING **
# For now this plugin does not allow "_" in the name of a zpool or filesystems
#
myname=`basename $0 | sed 's/^zfs_fs_//g' | sed -e 's/_/\//g'`
if [ "$1" = "autoconf" ]; then
# Makes little sense to autoconf if you can't suggest
echo no
exit 0
fi
if [ "$1" = "suggest" ]; then
exit 0
fi
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 <<EOF "graph_title zfs $myname
graph_order usedbydataset usedbychildren usedbysnapshots usedbyrefreservation available total quota
graph_args --base 1024 -r -l 0 --vertical-label Bytes --upper-limit ${values[6]}
graph_info This graph shows how is used a zfs filesystems.
graph_category Zfs
graph_period second
usedbydataset.label UsedByDataset
usedbydataset.draw AREA
usedbydataset.info Used space by Dataset
usedbydataset.colour FF0000
usedbychildren.label UsedByChildren
usedbychildren.draw STACK
usedbychildren.info Used space by children
usedbychildren.colour FFCC33
usedbysnapshots.label UsedBySnapshots
usedbysnapshots.draw STACK
usedbysnapshots.info Used space by snapshot
usedbysnapshots.colour 0000FF
usedbyrefreservation.label Usedbyrefreservation
usedbyrefreservation.draw STACK
usedbyrefreservation.info Used space by Ref Reservation
usedbyrefreservation.colour 33CCFF
available.label Available
available.draw STACK
available.info Free space
available.colour 00FF00
total.label Total
total.draw LINE1
total.info Total
total.colour 000000
quota.label Quota
quota.draw LINE1
quota.info Quota
quota.colour 555555"
EOF
exit 0
fi
echo <<EOF "usedbydataset.value ${values[0]}
usedbysnapshots.value ${values[2]}
usedbychildren.value ${values[1]}
usedbyrefreservation.value ${values[3]}
available.value ${values[4]}
total.value ${values[6]}
quota.value ${values[5]}"
EOF
exit 0

Binary file not shown.

View file

@ -0,0 +1,54 @@
#!/bin/sh
# -*- sh -*-
#
# $Id: zfs_arc_efficiency 11 2010-11-25 07:10:14Z patpro $
#
# Parameters:
#
# config (required)
# autoconf (optional - used by munin-config)
#
# Magick markers (optional - used by munin-config and som installation
# scripts):
#%# family=auto
#%# capabilities=autoconf
export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# autoconf
if [ "$1" = "autoconf" ]; then
# Is the zfs-stats executable there at least ?
if [ -x /usr/local/bin/zfs-stats ]; then
if /usr/local/bin/zfs-stats -p > /dev/null 2>&1; then
echo yes
exit 0
else
echo "no"
exit 0
fi
else
echo "no (no /usr/local/bin/zfs-stats executable)"
exit 0
fi
fi
# config
if [ "$1" = "config" ]; then
echo 'graph_title ZFS ARC Efficiency'
echo 'graph_args -l 0'
echo 'graph_vlabel %'
echo 'graph_category ZFS'
echo 'graph_info This graph shows the ARC Efficiency'
/usr/local/bin/zfs-stats -A | awk 'BEGIN { RS = "" ; FS = "\n" } /Efficiency/ {print}' | \
awk '/^\t.*%/ {sub("\t","");sub(/:.*/,""); displayname = $0; gsub(/[ .]/,"_",$0); print $0".label "displayname"\n"$0".min 0"}'
exit 0
fi
# This is the main part of the script, basically it calls
# /usr/local/bin/zfs-stats and processes its output
/usr/local/bin/zfs-stats -A | awk 'BEGIN { RS = "" ; FS = "\n" } /Efficiency/ {print}' | \
awk '/^\t.*%/ {sub("\t","");sub(/:/,""); gsub(/[ .]/,"_",$0); sub(/%/,""); sub(/_/,".",$2); print $1".value "$2}'

View file

@ -0,0 +1,54 @@
#!/bin/sh
# -*- sh -*-
#
# $Id: zfs_arc_utilization 11 2010-11-25 07:10:14Z patpro $
#
# Parameters:
#
# config (required)
# autoconf (optional - used by munin-config)
#
# Magick markers (optional - used by munin-config and som installation
# scripts):
#%# family=auto
#%# capabilities=autoconf
export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# autoconf
if [ "$1" = "autoconf" ]; then
# Is the zfs-stats executable there at least ?
if [ -x /usr/local/bin/zfs-stats ]; then
if /usr/local/bin/zfs-stats -p > /dev/null 2>&1; then
echo yes
exit 0
else
echo "no"
exit 0
fi
else
echo "no (no /usr/local/bin/zfs-stats executable)"
exit 0
fi
fi
# config
if [ "$1" = "config" ]; then
echo 'graph_title ZFS ARC Size'
echo 'graph_args -l 0'
echo 'graph_vlabel Size in MB'
echo 'graph_category ZFS'
echo 'graph_info This graph shows the ARC Size utilization'
/usr/local/bin/zfs-stats -A | awk 'BEGIN { RS = "" ; FS = "\n" } /^ARC Size/ {print}' | \
awk '/^\t/ {sub("\t","");sub(/ \(.*\):.*/,""); displayname = $0; gsub(/[ .]/,"_",$0); print $0".label "displayname"\n"$0".min 0"}'
exit 0
fi
# This is the main part of the script, basically it calls
# /usr/local/bin/zfs-stats and processes its output
/usr/local/bin/zfs-stats -A | awk 'BEGIN { RS = "" ; FS = "\n" } /^ARC Size/ {print}' | \
sed -e 's, ,,' -e 's, ,_,g' -e 's,\._,__,' -e 's,_(.*):., ,' -e 's, , ,g' -e 's,\([A-Za-z_]*\) *[^ ]* \([0-9.]*\)M,\1.value \2,' | grep value

View file

@ -0,0 +1,54 @@
#!/bin/sh
# -*- sh -*-
#
# $Id: zfs_arc_cache_hits_by_cache_list 11 2010-11-25 07:10:14Z patpro $
#
# Parameters:
#
# config (required)
# autoconf (optional - used by munin-config)
#
# Magick markers (optional - used by munin-config and som installation
# scripts):
#%# family=auto
#%# capabilities=autoconf
export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# autoconf
if [ "$1" = "autoconf" ]; then
# Is the zfs-stats executable there at least ?
if [ -x /usr/local/bin/zfs-stats ]; then
if /usr/local/bin/zfs-stats -p > /dev/null 2>&1; then
echo yes
exit 0
else
echo "no"
exit 0
fi
else
echo "no (no /usr/local/bin/zfs-stats executable)"
exit 0
fi
fi
# config
if [ "$1" = "config" ]; then
echo 'graph_title ZFS ARC Cache Hits by Cache List'
echo 'graph_args -l 0'
echo 'graph_vlabel %'
echo 'graph_category ZFS'
echo 'graph_info This graph shows the ARC cache hits by cache list'
/usr/local/bin/zfs-stats -A | awk 'BEGIN { RS = "" ; FS = "\n" } /CACHE HITS BY CACHE LIST/ {print}' | \
awk '/^\t.*%/ {sub(/[\t ]*/,"");sub(/ \(.*\):/,":");sub(/:.*/,""); displayname = $0; gsub(/[ .]/,"_",$0); print $0".label "displayname"\n"$0".min 0"}'
exit 0
fi
# This is the main part of the script, basically it calls
# /usr/local/bin/zfs-stats and processes its output
/usr/local/bin/zfs-stats -A | awk 'BEGIN { RS = "" ; FS = "\n" } /CACHE HITS BY CACHE LIST/ {print}' | \
awk '/^\t.*%/ {sub(/[\t ]*/,"");sub(/ \(.*\):/,":");sub(/:/,""); gsub(/[ .]/,"_",$0); sub(/%/,""); sub(/_/,".",$2); print $1".value "$2}'

View file

@ -0,0 +1,58 @@
#!/bin/sh
# -*- sh -*-
#
# $Id: zfs_arc_cache_hits_by_data_type 11 2010-11-25 07:10:14Z patpro $
#
# Parameters:
#
# config (required)
# autoconf (optional - used by munin-config)
#
# Magick markers (optional - used by munin-config and som installation
# scripts):
#%# family=auto
#%# capabilities=autoconf
export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# autoconf
if [ "$1" = "autoconf" ]; then
# Is the zfs-stats executable there at least ?
if [ -x /usr/local/bin/zfs-stats ]; then
if /usr/local/bin/zfs-stats -p > /dev/null 2>&1; then
echo yes
exit 0
else
echo "no"
exit 0
fi
else
echo "no (no /usr/local/bin/zfs-stats executable)"
exit 0
fi
fi
# config
if [ "$1" = "config" ]; then
echo 'graph_title ZFS ARC Cache Hits and Misses'
echo 'graph_args --upper-limit 100 -l -100'
echo 'graph_vlabel %'
echo 'graph_category ZFS'
echo 'graph_info This graph shows the ARC cache hits and misses by data type'
/usr/local/bin/zfs-stats -A | awk 'BEGIN { RS = "" ; FS = "\n" } /HITS BY DATA TYPE/ {print}' | \
awk '/^\t.*%/ {sub(/[\t ]*/,"");sub(/:.*/,""); displayname = $0" (hits)"; gsub(/[ .]/,"_",$0); print "hits_"$0".label "displayname"\nhits_"$0".min 0"}'
/usr/local/bin/zfs-stats -A | awk 'BEGIN { RS = "" ; FS = "\n" } /MISSES BY DATA TYPE/ {print}' | \
awk '/^\t.*%/ {sub(/[\t ]*/,"");sub(/:.*/,""); displayname = $0" (misses)"; gsub(/[ .]/,"_",$0); print "misses_"$0".label "displayname"\nmisses_"$0".min -100"}'
exit 0
fi
# This is the main part of the script, basically it calls
# /usr/local/bin/zfs-stats and processes its output
/usr/local/bin/zfs-stats -A | awk 'BEGIN { RS = "" ; FS = "\n" } /HITS BY DATA TYPE/ {print}' | \
awk '/^\t.*%/ {sub(/[\t ]*/,"");sub(/:/,""); gsub(/[ .]/,"_",$0); sub(/%/,""); sub(/_/,".",$2); print "hits_"$1".value "$2}'
/usr/local/bin/zfs-stats -A | awk 'BEGIN { RS = "" ; FS = "\n" } /MISSES BY DATA TYPE/ {print}' | \
awk '/^\t.*%/ {sub(/[\t ]*/,"");sub(/:/,""); gsub(/[ .]/,"_",$0); sub(/%/,""); sub(/_/,".",$2); print "misses_"$1".value -"$2}'

View file

@ -0,0 +1,54 @@
#!/bin/sh
# -*- sh -*-
#
# $Id: zfs_dmu_prefetch 11 2010-11-25 07:10:14Z patpro $
#
# Parameters:
#
# config (required)
# autoconf (optional - used by munin-config)
#
# Magick markers (optional - used by munin-config and som installation
# scripts):
#%# family=auto
#%# capabilities=autoconf
export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# autoconf
if [ "$1" = "autoconf" ]; then
# Is the zfs-stats executable there at least ?
if [ -x /usr/local/bin/zfs-stats ]; then
if /usr/local/bin/zfs-stats -p > /dev/null 2>&1; then
echo yes
exit 0
else
echo "no"
exit 0
fi
else
echo "no (no /usr/local/bin/zfs-stats executable)"
exit 0
fi
fi
# config
if [ "$1" = "config" ]; then
echo 'graph_title ZFS DMU prefech stats'
echo 'graph_args --upper-limit 100 -l -100'
echo 'graph_vlabel %'
echo 'graph_category ZFS'
echo 'graph_info This graph shows the DMU prefech stats'
/usr/local/bin/zfs-stats -Z | awk '/Hit Ratio/ {sub(/[\t ]*/,"");sub(/:.*/,""); displayname = $0; gsub(/[ .]/,"_",$0); print $0".label "displayname"\n"$0".min 0"}'
/usr/local/bin/zfs-stats -Z | awk '/Miss Ratio/ {sub(/[\t ]*/,"");sub(/:.*/,""); displayname = $0; gsub(/[ .]/,"_",$0); print $0".label "displayname"\n"$0".min -100"}'
exit 0
fi
# This is the main part of the script, basically it calls
# /usr/local/bin/zfs-stats and processes its output
/usr/local/bin/zfs-stats -Z | awk '/Hit Ratio/ {sub(/[\t ]*/,"");sub(/:/,""); gsub(/[ .]/,"_",$0); sub(/%/,""); sub(/_/,".",$2); print $1".value "$2}'
/usr/local/bin/zfs-stats -Z | awk '/Miss Ratio/ {sub(/[\t ]*/,"");sub(/:/,""); gsub(/[ .]/,"_",$0); sub(/%/,""); sub(/_/,".",$2); print $1".value -"$2}'

37
plugins/zfs/zlist Executable file
View file

@ -0,0 +1,37 @@
#!/bin/sh
if [ "$1" = "config" ]; then
echo 'graph_title zpool list'
echo 'graph_args --base 1000 -l 0'
echo 'graph_vlabel zpool list'
echo 'graph_category zfs'
echo 'graph_scale no'
echo 'graph_info This graph shows zpool list on the server.'
zlist=`/sbin/zpool list -H|awk '{print $1}'`
first=`echo $zlist | tr ' ' '\n' | head -1`
echo $zlist | tr ' ' '\n' | while read i; do
case $i in
*) name=`echo $i | awk '{ gsub("[^a-zA-Z0-9_]", "_", $1); print }'` ;;
esac
echo "$name.label $i"
echo "$name.info $i"
echo "$name.draw STACK"
done
echo $first'.draw AREA'
echo 'total.label Total'
echo 'total.info Summ'
echo 'total.draw LINE1'
exit 0
fi
/sbin/zpool list -H | while read i; do
case $i in
*) name=`echo $i | awk '{ gsub("[^a-zA-Z0-9_]", "_", $1); print $1 }'` ;;
esac
echo -n "$name.value "
echo $i|awk '{ print $4}' | awk ' /T/ {print $1*1000000}; /G/ {print $1*1000}; /M/ {print "777"}; /K/ {print "1"}' | sed 's/^\$name.value //'
done
tzl=`/sbin/zpool list -H | awk '{ print $4}' | awk ' /T/ {print $1*1000000}; /G/ {print $1*1000}; /M/ {print "777" }; /K/ {print "1"}' | awk '{ x+=$1 } END { print x }'`
echo 'total.value' $tzl

48
plugins/zfs/zpool_iostat Executable file
View file

@ -0,0 +1,48 @@
#!/bin/bash
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
fi
zlines=`/sbin/zpool iostat -v| wc -l|sed 's/ //g'`
ztail=`echo "-"$zlines`
ztmp=/var/run/munin/zpool_iostat
zdata=`/sbin/zpool iostat -v 1 1| tail $ztail > $ztmp`
zlist=`cat $ztmp|gawk '/alloc/ {next}; /avail/ {next}; /raid/ {next}; /mirror/ {next}; { if ( $4 >=0 ) print $1}'`
zname=`cat $ztmp|gawk '/alloc/ {next}; /avail/ {next}; /raid/ {next}; /mirror/ {next}; { if ( $4 >=0 ) print $1}'|gawk '{gsub("[^a-zA-Z0-9_]", "_", $1); print}'`
zorder=`for o in $zname; do echo $o'_read '; echo $o'_write '; done`
if [ "$1" = "config" ]; then
echo 'graph_title zpool iostat'
echo 'graph_args --base 1000 -l 0'
echo 'graph_vlabel write - read KBytes/s'
echo 'graph_category zfs'
echo 'graph_scale no'
echo 'graph_info This graph shows zpool iostat'
echo 'graph_order '$zorder
echo $zlist | tr ' ' '\n' | while read i; do
case $i in
*) name=`echo $i | gawk '{ gsub("[^a-zA-Z0-9_]", "_", $1); print }'` ;;
esac
echo $name'_read.label '$i
echo $name'_read.type GAUGE'
echo $name'_read.graph no'
echo $name'_write.label '$i
echo $name'_write.type GAUGE'
echo $name'_write.negative '$name'_read'
done
exit 0
fi
echo $zlist | tr ' ' '\n' | while read iz; do
zlabel=`echo $iz|gawk '{print $1}'`
case $iz in
*) name=`echo $iz | gawk '{ gsub("[^a-zA-Z0-9_]", "_", $1); print $1 }'` ;;
esac
echo -n $name'_read.value '
grep '^[ ]*'$zlabel $ztmp|gawk '{print $6}'|gawk '/M/ {print strtonum($1)*1000}; /K/ {print strtonum($1)}; /[0-9]$/ {print int($1)/1000}; /^0/ {print strtonum($1)}'
echo -n $name'_write.value '
grep '^[ ]*'$zlabel $ztmp|gawk '{print $7}'|gawk '/M/ {print strtonum($1)*1000}; /K/ {print strtonum($1)}; /[0-9]$/ {print int($1)/1000}; /^0/ {print strtonum($1)}'
done
rm $ztmp; touch $ztmp