Révision e8d6a10e
Initial version
| plugins/other/zfs-stats-for-freebsd-cache-hits-by-cache-list | ||
|---|---|---|
| 1 |
#!/bin/sh |
|
| 2 |
# -*- sh -*- |
|
| 3 |
# |
|
| 4 |
# $Id: zfs_arc_cache_hits_by_cache_list 11 2010-11-25 07:10:14Z patpro $ |
|
| 5 |
# |
|
| 6 |
# Parameters: |
|
| 7 |
# |
|
| 8 |
# config (required) |
|
| 9 |
# autoconf (optional - used by munin-config) |
|
| 10 |
# |
|
| 11 |
# Magick markers (optional - used by munin-config and som installation |
|
| 12 |
# scripts): |
|
| 13 |
#%# family=auto |
|
| 14 |
#%# capabilities=autoconf |
|
| 15 |
|
|
| 16 |
export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin |
|
| 17 |
|
|
| 18 |
# autoconf |
|
| 19 |
|
|
| 20 |
if [ "$1" = "autoconf" ]; then |
|
| 21 |
# Is the zfs-stats executable there at least ? |
|
| 22 |
if [ -x /usr/local/bin/zfs-stats ]; then |
|
| 23 |
if /usr/local/bin/zfs-stats -p > /dev/null 2>&1; then |
|
| 24 |
echo yes |
|
| 25 |
exit 0 |
|
| 26 |
else |
|
| 27 |
echo "no" |
|
| 28 |
exit 0 |
|
| 29 |
fi |
|
| 30 |
else |
|
| 31 |
echo "no (no /usr/local/bin/zfs-stats executable)" |
|
| 32 |
exit 0 |
|
| 33 |
fi |
|
| 34 |
fi |
|
| 35 |
|
|
| 36 |
# config |
|
| 37 |
if [ "$1" = "config" ]; then |
|
| 38 |
echo 'graph_title ZFS ARC Cache Hits by Cache List' |
|
| 39 |
echo 'graph_args -l 0' |
|
| 40 |
echo 'graph_vlabel %' |
|
| 41 |
echo 'graph_category ZFS' |
|
| 42 |
echo 'graph_info This graph shows the ARC cache hits by cache list' |
|
| 43 |
|
|
| 44 |
/usr/local/bin/zfs-stats -A | awk 'BEGIN { RS = "" ; FS = "\n" } /CACHE HITS BY CACHE LIST/ {print}' | \
|
|
| 45 |
awk '/^\t.*%/ {sub(/[\t ]*/,"");sub(/ \(.*\):/,":");sub(/:.*/,""); displayname = $0; gsub(/[ .]/,"_",$0); print $0".label "displayname"\n"$0".min 0"}'
|
|
| 46 |
|
|
| 47 |
exit 0 |
|
| 48 |
fi |
|
| 49 |
|
|
| 50 |
# This is the main part of the script, basically it calls |
|
| 51 |
# /usr/local/bin/zfs-stats and processes its output |
|
| 52 |
|
|
| 53 |
/usr/local/bin/zfs-stats -A | awk 'BEGIN { RS = "" ; FS = "\n" } /CACHE HITS BY CACHE LIST/ {print}' | \
|
|
| 54 |
awk '/^\t.*%/ {sub(/[\t ]*/,"");sub(/ \(.*\):/,":");sub(/:/,""); gsub(/[ .]/,"_",$0); sub(/%/,""); sub(/_/,".",$2); print $1".value "$2}'
|
|
Formats disponibles : Unified diff