From 599102ca034fdff85a58102321ce0485d0723a91 Mon Sep 17 00:00:00 2001 From: patpro Date: Fri, 26 Nov 2010 11:36:57 +0100 Subject: [PATCH] Initial version --- .../zfs-stats-for-freebsd-arc-efficiency | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100755 plugins/other/zfs-stats-for-freebsd-arc-efficiency diff --git a/plugins/other/zfs-stats-for-freebsd-arc-efficiency b/plugins/other/zfs-stats-for-freebsd-arc-efficiency new file mode 100755 index 00000000..2d510a58 --- /dev/null +++ b/plugins/other/zfs-stats-for-freebsd-arc-efficiency @@ -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}' \ No newline at end of file