mirror of
https://github.com/munin-monitoring/contrib.git
synced 2018-11-08 00:59:34 +01:00
e891287fd3
I added a v3 to the title of the nfsd graph to reduce ambiguity. This is also the initial commit of the nfs_client plugin. It is essentially identical to server. The output of nfsstat for client is somewhat different from server in the labeling of the cache entries. As such, I've left them off here and will add a standalone plugin for nfs_client_cache where the awful, terrible, hideous string parsing will take place without sullying the triviality and simplicity of this working plugin.
61 lines
1.4 KiB
Bash
61 lines
1.4 KiB
Bash
#!/bin/bash
|
|
# -*- sh -*-
|
|
|
|
: << =cut
|
|
|
|
=head1 NAME
|
|
|
|
nfsd - Plugin to monitor NFSv3 client 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]" | grep -v ":" | sed 's/X\ /x_/' | tr '\n' ' ' | awk '{print $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25,$26}' | tr '[A-Z]' '[a-z]'`
|
|
values=`$NFSSTAT -c | grep -i "[0-9]" | tr '\n' ' ' | awk '{print $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25,$26}'`
|
|
|
|
larray=( $labels )
|
|
varray=( $values )
|
|
if [ "$1" = "config" ]; then
|
|
|
|
echo 'graph_title NFSv3 Client'
|
|
echo 'graph_args --base 1000 -l 0'
|
|
echo 'graph_vlabel requests / ${graph_period}'
|
|
echo 'graph_total total'
|
|
echo 'graph_category NFS'
|
|
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..25}; do
|
|
label=${larray[$i]}
|
|
value=${varray[$i]}
|
|
echo "$label.value $value"
|
|
done
|