Projet

Général

Profil

Paste
Télécharger au format
Statistiques
| Branche: | Révision:

root / plugins / nfs-freebsd / nfs_client_cache @ cadcfa01

Historique | Voir | Annoter | Télécharger (1,27 ko)

1
#!/usr/bin/env bash
2
# -*- sh -*-
3

    
4
: << =cut
5

    
6
=head1 NAME
7

    
8
nfsd - Plugin to monitor NFSv3 client cache activity on FreeBSD
9

    
10
=head1 CONFIGURATION
11

    
12
No configuration
13

    
14
=head1 AUTHORS
15

    
16
Plugin created by Adam Michel, based on work by Alexandre Dupouy, with the assistance of Mike Fedyk
17

    
18
=head1 LICENSE
19

    
20
GPLv2
21

    
22
=head1 MAGIC MARKERS
23

    
24
 #%# family=auto
25
 #%# capabilities=autoconf
26

    
27
=cut
28

    
29
NFSSTAT=/usr/bin/nfsstat
30
if [ "$1" = "autoconf" ]; then
31
    if [ -x "$NFSSTAT" ]; then
32
        echo yes
33
        exit 0
34
    else
35
        echo "no (no $NFSSTAT)"
36
        exit 0
37
    fi
38
fi
39

    
40
labels=`$NFSSTAT -c | grep -iv "[0-9]" | tail -n 2 | sed 's/BioRLHits/BioRL\ Hits/g' | awk '{print $1"_"$2,$1"_"$3,$4"_"$5,$4"_"$6,$7"_"$8,$7"_"$9,$10"_"$11,$10"_"$12}' | tr '\n' ' ' | tr '[A-Z]' '[a-z]'`
41
values=`$NFSSTAT -c | grep -i "[0-9]" | tail -n 2 | tr '\n' ' '`
42

    
43
larray=( $labels )
44
varray=( $values )
45
if [ "$1" = "config" ]; then
46

    
47
    echo 'graph_title NFSv3 Client Cache'
48
    echo 'graph_args --base 1000 -l 0'
49
    echo 'graph_vlabel requests / ${graph_period}'
50
    echo 'graph_total total'
51
    echo 'graph_category NFS'
52
    for a in $labels; do echo "$a.label $a" ; echo "$a.type DERIVE"; echo "$a.min 0"; done
53
    exit 0
54
fi
55

    
56
for i in {0..15}; do
57
    label=${larray[$i]}
58
    value=${varray[$i]}
59
    echo "$label.value $value"
60
done