From 852ac60901c628fd7fbe7ebafdb2f2ff05c9dc2f Mon Sep 17 00:00:00 2001 From: Johannes Tigges Date: Sun, 17 Aug 2008 15:29:40 +0200 Subject: [PATCH] Initial version --- plugins/other/nfs4_client | 69 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100755 plugins/other/nfs4_client diff --git a/plugins/other/nfs4_client b/plugins/other/nfs4_client new file mode 100755 index 00000000..d73c45a4 --- /dev/null +++ b/plugins/other/nfs4_client @@ -0,0 +1,69 @@ +#!/bin/sh +# +# Plugin to monitor NFS client traffic +# +# $Log$ +# Revision 1.8.2.1 2005/03/16 13:45:45 ilmari +# Fix autoconf for linux/{nfsd,nfs_client}. +# +# Revision 1.8 2004/12/10 10:47:49 jimmyo +# Change name from ${scale} to ${graph_period}, to be more consistent. +# +# Revision 1.7 2004/12/09 22:12:56 jimmyo +# Added "graph_period" option, to make "graph_sums" usable. +# +# Revision 1.6 2004/11/21 00:17:12 jimmyo +# Changed a lot of plugins so they use DERIVE instead of COUNTER. +# +# Revision 1.5 2004/10/01 12:32:09 ilmari +# complete "rpc" removal +# +# Revision 1.4 2004/10/01 08:40:50 ilmari +# Remove useless 'rpc' field, add total field +# +# Revision 1.3 2004/05/20 19:02:37 jimmyo +# Set categories on a bunch of plugins +# +# Revision 1.2 2004/05/15 21:33:29 jimmyo +# "Upped" som plugins from contrib/manual to manual or auto. +# +# +#%# family=auto +#%# capabilities=autoconf + +NFS=/proc/net/rpc/nfs + +#proc="getattr setattr lookup access readlink read write create mkdir symlink mknod remove rmdir rename link readdir readdirplus fsstat fsinfo pathconf commit" + +proc="access close commit create delegpurge delegreturn getattr getfh link lock lockt locku lookup lookup_root nverify open openattr open_conf open_dgrd putfh putpubfh putrootfh read readdir readlink remove rename renew restorefh savefh secinfo setattr setcltid setcltidconf verify write rellockowner" + +if [ "$1" = "autoconf" ]; then + if [ -f "$NFS" ]; then + echo yes + exit 0 + else + echo "no (no $NFS)" + exit 1 + fi +fi + +if [ "$1" = "config" ]; then + + echo 'graph_title NFS4 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 $proc ; do echo "$a.label $a" ; echo "$a.type DERIVE"; echo "$a.min 0"; done + exit 0 +fi + +i=4; + +for a in $proc; do + echo -n "$a.value " + grep proc4 $NFS \ + | cut -f $i -d ' ' \ + | awk '{print $1}' + i=$(expr $i + 1) +done