2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00
contrib-munin/plugins/nfs-freebsd/nfsd
dipohl a4710dc1a4 Category Tree: Reduce number of categories
cacti -> munin (cacti) [Monitoring the monitoring.. nagios and monit
already there. shall we use a new name for the category then?]
san -> fs (netapp)
san -> cpu (netapp)
nfs -> fs
2017-02-23 04:00:39 +01:00

63 lines
1.4 KiB
Bash
Executable File

#!/usr/bin/env bash
# -*- sh -*-
: << =cut
=head1 NAME
nfsd - Plugin to monitor NFSv3 server 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
# This is where nfsstat lives
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 -s | grep -iv "[0-9]" | grep -v ":" | sed 's/Server\ //' | 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,$27,$28,$29,$30}' | tr '[A-Z]' '[a-z]'`
values=`$NFSSTAT -s | 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,$27,$28,$29,$30}'`
larray=( $labels )
varray=( $values )
if [ "$1" = "config" ]; then
echo 'graph_title NFSv3 Server'
echo 'graph_args --base 1000 -l 0'
echo 'graph_vlabel requests / ${graph_period}'
echo 'graph_total total'
echo 'graph_category fs'
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..29}; do
label=${larray[$i]}
value=${varray[$i]}
echo "$label.value $value"
done