2014-04-07 21:28:15 +02:00
|
|
|
#!/usr/bin/env bash
|
2013-07-02 01:50:14 +02:00
|
|
|
# -*- sh -*-
|
|
|
|
|
|
|
|
: << =cut
|
|
|
|
|
|
|
|
=head1 NAME
|
|
|
|
|
|
|
|
nfsd - Plugin to monitor NFSv3 client cache activity on FreeBSD
|
|
|
|
|
|
|
|
=head1 CONFIGURATION
|
|
|
|
|
|
|
|
No configuration
|
|
|
|
|
|
|
|
=head1 AUTHORS
|
|
|
|
|
|
|
|
Plugin created by Adam Michel, based on work by Alexandre Dupouy, with the assistance of Mike Fedyk
|
|
|
|
|
|
|
|
=head1 LICENSE
|
|
|
|
|
|
|
|
GPLv2
|
|
|
|
|
|
|
|
=head1 MAGIC MARKERS
|
|
|
|
|
|
|
|
#%# family=auto
|
|
|
|
#%# capabilities=autoconf
|
|
|
|
|
|
|
|
=cut
|
|
|
|
|
|
|
|
NFSSTAT=/usr/bin/nfsstat
|
|
|
|
if [ "$1" = "autoconf" ]; then
|
|
|
|
if [ -x "$NFSSTAT" ]; then
|
|
|
|
echo yes
|
|
|
|
exit 0
|
|
|
|
else
|
|
|
|
echo "no (no $NFSSTAT)"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
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]'`
|
|
|
|
values=`$NFSSTAT -c | grep -i "[0-9]" | tail -n 2 | tr '\n' ' '`
|
|
|
|
|
|
|
|
larray=( $labels )
|
|
|
|
varray=( $values )
|
|
|
|
if [ "$1" = "config" ]; then
|
|
|
|
|
|
|
|
echo 'graph_title NFSv3 Client Cache'
|
|
|
|
echo 'graph_args --base 1000 -l 0'
|
|
|
|
echo 'graph_vlabel requests / ${graph_period}'
|
|
|
|
echo 'graph_total total'
|
2017-02-23 04:00:39 +01:00
|
|
|
echo 'graph_category fs'
|
2013-07-02 01:50:14 +02:00
|
|
|
for a in $labels; do echo "$a.label $a" ; echo "$a.type DERIVE"; echo "$a.min 0"; done
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
for i in {0..15}; do
|
|
|
|
label=${larray[$i]}
|
|
|
|
value=${varray[$i]}
|
|
|
|
echo "$label.value $value"
|
|
|
|
done
|