From cb6c9595eb2e206c0ccaba9a4f2f8c34810d520e Mon Sep 17 00:00:00 2001 From: amichel Date: Thu, 25 Dec 2014 13:23:05 -0700 Subject: [PATCH] Added zfs_list plugin --- plugins/zfs/zfs_list | 91 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100755 plugins/zfs/zfs_list diff --git a/plugins/zfs/zfs_list b/plugins/zfs/zfs_list new file mode 100755 index 00000000..e8c7ed38 --- /dev/null +++ b/plugins/zfs/zfs_list @@ -0,0 +1,91 @@ +#!/bin/bash +# +# Plugin to monitor ZFS Filesystems +# Author: Adam Michel (elfurbe@furbism.com) +# Description: +# This is an extension of the zfs_fs plugin +# modified as a multigraph to graph all zfs +# filesystems it can find +# +# Tested on Ubuntu-14.04 +# +# Parameters understood: +# +# config (required) +# autoconf (optional - used by munin-config) +# +#%# family=auto + +need_multigraph() + +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 + +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'` + + echo <