diff --git a/plugins/nfs-freebsd/nfs_client b/plugins/nfs-freebsd/nfs_client new file mode 100644 index 00000000..f2d807cf --- /dev/null +++ b/plugins/nfs-freebsd/nfs_client @@ -0,0 +1,60 @@ +#!/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 diff --git a/plugins/nfs-freebsd/nfsd b/plugins/nfs-freebsd/nfsd index 88bd077a..d73d959f 100755 --- a/plugins/nfs-freebsd/nfsd +++ b/plugins/nfs-freebsd/nfsd @@ -5,7 +5,7 @@ =head1 NAME -nfsd - Plugin to monitor NFS server activity on FreeBSD +nfsd - Plugin to monitor NFSv3 server activity on FreeBSD =head1 CONFIGURATION @@ -46,7 +46,7 @@ varray=( $values ) if [ "$1" = "config" ]; then - echo 'graph_title NFS Server' + echo 'graph_title NFSv3 Server' echo 'graph_args --base 1000 -l 0' echo 'graph_vlabel requests / ${graph_period}' echo 'graph_total total'