Projet

Général

Profil

Révision a6669d3f

IDa6669d3faab6155ab4c3f303f28d55cad44b5ccc
Parent e8d6a10e
Enfant 599102ca

Ajouté par patpro il y a presque 14 ans

Initial version

Voir les différences:

plugins/other/zfs-stats-for-freebsd-cache-hits-by-data-type
1
#!/bin/sh
2
# -*- sh -*-
3
#
4
# $Id: zfs_arc_cache_hits_by_data_type 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 and Misses'
39
    echo 'graph_args --upper-limit 100 -l -100'
40
    echo 'graph_vlabel %'
41
    echo 'graph_category ZFS'
42
    echo 'graph_info This graph shows the ARC cache hits and misses by data type'
43

  
44
/usr/local/bin/zfs-stats -A | awk 'BEGIN { RS = "" ; FS = "\n" } /HITS BY DATA TYPE/ {print}' | \
45
awk '/^\t.*%/ {sub(/[\t ]*/,"");sub(/:.*/,""); displayname = $0" (hits)"; gsub(/[ .]/,"_",$0); print "hits_"$0".label "displayname"\nhits_"$0".min 0"}' 
46
/usr/local/bin/zfs-stats -A | awk 'BEGIN { RS = "" ; FS = "\n" } /MISSES BY DATA TYPE/ {print}' | \
47
awk '/^\t.*%/ {sub(/[\t ]*/,"");sub(/:.*/,""); displayname = $0" (misses)"; gsub(/[ .]/,"_",$0); print "misses_"$0".label "displayname"\nmisses_"$0".min -100"}' 
48
	
49
	exit 0
50
fi
51

  
52
# This is the main part of the script, basically it calls
53
# /usr/local/bin/zfs-stats and processes its output
54

  
55
/usr/local/bin/zfs-stats -A | awk 'BEGIN { RS = "" ; FS = "\n" } /HITS BY DATA TYPE/ {print}' | \
56
awk '/^\t.*%/ {sub(/[\t ]*/,"");sub(/:/,""); gsub(/[ .]/,"_",$0); sub(/%/,""); sub(/_/,".",$2); print "hits_"$1".value "$2}'
57
/usr/local/bin/zfs-stats -A | awk 'BEGIN { RS = "" ; FS = "\n" } /MISSES BY DATA TYPE/ {print}' | \
58
awk '/^\t.*%/ {sub(/[\t ]*/,"");sub(/:/,""); gsub(/[ .]/,"_",$0); sub(/%/,""); sub(/_/,".",$2); print "misses_"$1".value -"$2}'

Formats disponibles : Unified diff