2010-11-26 11:38:12 +01:00
|
|
|
#!/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'
|
2017-02-21 22:15:07 +01:00
|
|
|
echo 'graph_category fs'
|
2010-11-26 11:38:12 +01:00
|
|
|
echo 'graph_info This graph shows the ARC Size utilization'
|
|
|
|
|
|
|
|
/usr/local/bin/zfs-stats -A | awk 'BEGIN { RS = "" ; FS = "\n" } /^ARC Size/ {print}' | \
|
2018-08-02 02:03:42 +02:00
|
|
|
awk '/^\t/ {sub("\t","");sub(/ \(.*\):.*/,""); displayname = $0; gsub(/[ .]/,"_",$0); print $0".label "displayname"\n"$0".min 0"}'
|
|
|
|
|
2010-11-26 11:38:12 +01:00
|
|
|
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
|