#!/bin/bash #%# family=auto : << EOF =head1 NAME zfs_list - Plugin to monitor ZFS Filesystems This is an extension of the zfs_fs plugin modified as a multigraph to graph all zfs filesystems it can find =head1 CONFIGURATION [zfs_list] env.ignore_datasets_pattern =head1 AUTHOR Adam Michel (elfurbe@furbism.com) =head1 MAGIC MARKERS #%# family=auto =cut EOF . "$MUNIN_LIBDIR/plugins/plugin.sh" 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 # set standard value ignore_datasets_pattern=${ignore_datasets_pattern:-} # set search term, based on if the searh pattern is set if [ -n "$ignore_datasets_pattern" ]; then search_term=$(zfs list -Hp -t filesystem,volume | grep -v "$ignore_datasets_pattern" | awk '{print $1}') else search_term=$(zfs list -Hp -t filesystem,volume | awk '{print $1}') fi if [ "$1" = "config" ]; then for i in $search_term; 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=$(clean_fieldname $(echo "$i" | sed 's/\//__/g')) echo <