NFS Stats

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

cgotstein
Posts: 6
Joined: Tue Jul 26, 2005 3:43 am

Post by cgotstein »

Anyone have this working on a FreeBSD or NetBSD server???
User avatar
knebb
Cacti User
Posts: 138
Joined: Tue Sep 19, 2006 11:29 am

Re: Error when importing template.

Post by knebb »

Threepwood wrote: Error: XML: Hash version does not exist.
Do I need to upgrade my CACTI ?. I'm using version : 0.8.6j
You version is too old as the template was exported as 0.8.7a.

Same issue here- I wanted to update anyway.
digihans
Posts: 2
Joined: Tue Sep 23, 2008 10:09 am

just nan's

Post by digihans »

HI all,
Because of some problems (probably nfs-related) i tried to install the scripts.
I already had cacti up-and-running for general statistics for nfs-client and nfs-server.
If i run either nfs-server.sh or nfs_client.sh i see the numbers constantly changing.

nfs_server.sh
2145970
80750
2287380
959833
8444
20669
49762
15864
917
330
0
20113
203989
15636
5448
5414
364984
6574
147
70
16730

However, the image for either nfs_server or nfs_client keeps showing nan, instead of the numbers produced by the scripts.

I'm running cacti-0.8.7b and used the latest xml-files:
cacti_graph_template_ucdnet__nfs_server_213.xml
cacti_graph_template_ucdnet__nfs_client_186.xml

On the nfs-server, i tried into /etc/snmp/snmpd.conf:
#extend .66.4.1.2.10.110.102.115.95.99.108.105.101.110.116 nfs_server /usr/local/bin/nfs_server.sh
extend .1.3.6.1.4.1.2021.66 nfs_server /usr/local/bin/nfs_server.sh


If i try snmpwalk (for the short OID) i get
snmpwalk -Os -c kcbeheer -v 2c localhost .1.3.6.1.4.1.2021.66
ucdavis.66.1.0 = INTEGER: 1
ucdavis.66.2.1.2.10.110.102.115.95.115.101.114.118.101.114 = STRING: "/usr/local/bin/nfs_server.sh"
ucdavis.66.2.1.3.10.110.102.115.95.115.101.114.118.101.114 = ""
ucdavis.66.2.1.4.10.110.102.115.95.115.101.114.118.101.114 = ""
ucdavis.66.2.1.5.10.110.102.115.95.115.101.114.118.101.114 = INTEGER: 5
ucdavis.66.2.1.6.10.110.102.115.95.115.101.114.118.101.114 = INTEGER: 1
ucdavis.66.2.1.7.10.110.102.115.95.115.101.114.118.101.114 = INTEGER: 1
ucdavis.66.2.1.20.10.110.102.115.95.115.101.114.118.101.114 = INTEGER: 4
ucdavis.66.2.1.21.10.110.102.115.95.115.101.114.118.101.114 = INTEGER: 1
ucdavis.66.3.1.1.10.110.102.115.95.115.101.114.118.101.114 = STRING: "/usr/local/bin/nfs_server.sh: Exec format error"
ucdavis.66.3.1.2.10.110.102.115.95.115.101.114.118.101.114 = STRING: "/usr/local/bin/nfs_server.sh: Exec format error"
ucdavis.66.3.1.3.10.110.102.115.95.115.101.114.118.101.114 = INTEGER: 1
ucdavis.66.3.1.4.10.110.102.115.95.115.101.114.118.101.114 = INTEGER: 1
ucdavis.66.4.1.2.10.110.102.115.95.115.101.114.118.101.114.1 = STRING: "/usr/local/bin/nfs_server.sh: Exec format error"

And for the long OID:
snmpwalk -Os -c kcbeheer -v 2c localhost .66.4.1.2.10.110.102.115.95.99.108.105.101.110.116
snmp_build: unknown failuresnmpwalk: Error building ASN.1 representation (Can't build OID for variable)

A plain walk gets me:
snmpwalk -Os -c kcbeheer -v 2c localhost |grep -i nfs
hrPartitionFSIndex.1552.1 = INTEGER: 13
hrPartitionFSIndex.1553.1 = INTEGER: 12
hrPartitionFSIndex.1553.2 = INTEGER: 0
hrSWRunName.3253 = STRING: "nfsd4"
hrSWRunName.3254 = STRING: "nfsd"
hrSWRunName.3255 = STRING: "nfsd"
hrSWRunName.3256 = STRING: "nfsd"
hrSWRunName.3257 = STRING: "nfsd"
hrSWRunPath.3253 = STRING: "nfsd4"
hrSWRunPath.3254 = STRING: "nfsd"
hrSWRunPath.3255 = STRING: "nfsd"
hrSWRunPath.3256 = STRING: "nfsd"
hrSWRunPath.3257 = STRING: "nfsd"
hrSWRunParameters.4470 = STRING: "-i nfs"
hrSWInstalledName.64 = STRING: "nfsidmap-0.20-76.1"
hrSWInstalledName.142 = STRING: "yast2-nfs-common-2.16.1-6.1"
hrSWInstalledName.363 = STRING: "nfs-client-1.1.2-9.2"
hrSWInstalledName.397 = STRING: "yast2-nfs-client-2.16.1-26.1"
hrSWInstalledName.431 = STRING: "limal-nfs-server-1.4.6-0.1"
hrSWInstalledName.472 = STRING: "limal-nfs-server-perl-1.4.6-0.1"
hrSWInstalledName.524 = STRING: "nfs-kernel-server-1.1.2-9.2"
hrSWInstalledName.684 = STRING: "yast2-nfs-server-2.16.1-6.1"

Suggestions? Are these OID's wrong ?
sykosoft
Posts: 8
Joined: Tue Nov 06, 2007 6:26 pm
Contact:

Post by sykosoft »

Just a message for anyone else who has it happen.

If your graphs are blank, or contain no data, yet the script runs fine when you run it by hand. Check to make sure that selinux isn't causing issues. Selinux was preventing the greps from running when snmp was executing the script. Disable selinux as a solution (that thing is more trouble than I've ever found it to be worth).

Michael
digihans
Posts: 2
Joined: Tue Sep 23, 2008 10:09 am

selinux?

Post by digihans »

Tnx for the suggestion, but i reccon it must be someting else, as SE-L is disabled....

One of my colleages mentioned that it is some kind of MIB-problem,
because snmp-walk didn't produce any nfs-stat-fields (not even empty ones)
Could it be that _if_ some parts of a MIB are missing, the scripts can not store the nfs-stat info and hence cacti can not retrieve it?

If so, are there any additional mibs to be loaded? (or am i talking non-sense)
sykosoft
Posts: 8
Joined: Tue Nov 06, 2007 6:26 pm
Contact:

Post by sykosoft »

One other thing, make sure snmpd is running as root.

Michael
Wido
Posts: 3
Joined: Mon Jul 11, 2005 6:34 am

Re: selinux?

Post by Wido »

digihans wrote:Tnx for the suggestion, but i reccon it must be someting else, as SE-L is disabled....

One of my colleages mentioned that it is some kind of MIB-problem,
because snmp-walk didn't produce any nfs-stat-fields (not even empty ones)
Could it be that _if_ some parts of a MIB are missing, the scripts can not store the nfs-stat info and hence cacti can not retrieve it?

If so, are there any additional mibs to be loaded? (or am i talking non-sense)
Well, i have exactly the same problem!

But you seem to be also using "extend" rather then exec. The templates are build for using "exec", so i think that is the problem, but i don't know how to solve it ;)
JesperKrogh
Posts: 1
Joined: Fri Feb 13, 2009 5:32 am

Updated templates

Post by JesperKrogh »

Updated template.. the OID's were wrong for my system (Ubuntu .. snmpd hooked in using extend as described.)
Attachments
cacti_graph_template_ucdnet_-_nfs_server.xml
New template file.
(141.5 KiB) Downloaded 934 times
lundman
Posts: 1
Joined: Tue Feb 17, 2009 10:50 pm

Post by lundman »

Carrying on from benr work for Solaris, I changed it for NFS Server, added total nfsops and nfsd number of threads.

Code: Select all

#!/bin/bash
# NFSv3 Solaris Stats Collection
#  - Based on nfs_client.sh by pheezy
#  - benr@cuddletech.com
# NFS server change, and massage:
#  - lundman@lundman.net

proc="getattr setattr lookup access readlink read write create mkdir symlink mknod remove rmdir rename link readdir readdirplus fsstat fsinfo pathconf commit"

for a in $proc; do
     # Change "rfsproccnt_v3" to "rfsreqcnt_v3" for clients. Change "3" for
     # NFS version.
     args="nfs:0:rfsproccnt_v3:${a} ${args}"
done

#echo $args

# Use xargs if $args eventually becomes too large.
# Number of threads
ps -edo nlwp,comm|grep '[n]fsd' | awk '{print $1}'

# Add in the total calls as well.
kstat -p "nfs:0:nfs_server:calls" ${args} | awk '{print $2}'     
kraduk
Posts: 3
Joined: Wed Mar 21, 2007 7:23 pm

Post by kraduk »

For freebsd users out there this script will make the graphs work on freebsd
just add a line something like this in snmpd.conf

pass .1.3.6.1.4.1.2021.66 /opt/scripts/nfsstats.sh

not the nicest script but it seems to work ok

Code: Select all

#!/usr/local/bin/bash

export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/home/cscott/bin


OID_BASE=".1.3.6.1.4.1.2021.66"
declare -i OID_BASE_MAX=22
declare -i t=0

if (! echo $2 | grep $OID_BASE >/dev/null ) ; then 
 echo base OID mismatch
 exit 1 
fi

t=`echo $2| sed -e "s#.*\.##"`



case $1 in
  -g)
     echo $2
     echo integer
     if [ $2 == "$OID_BASE" ] ; then
       echo ${OID_BASE_MAX}
     else
      nfsstat  -c| grep -i "[0-9]" | grep -v ":" | head -3 | tr '\n' ' ' | awk '{print $1,$2,$3,$16, $4, $5, $6, $7, $12, $11, $17, $8, $13, $9, $10, $14, $15, $18, $19, $20, $21, $22 }'  | tr ' ' '\n' | head -${t}  | tail -1
     fi

 

  ;;

  -n)
    if [ $2 == "$OID_BASE" ] ; then 
     echo ${OID_BASE}.1
    else
     t+=1;
     if [ $t -gt $OID_BASE_MAX ] ; then exit; fi 
     echo ${OID_BASE}.$t
   fi
    
 
  ;;

esac
bfg-randy
Posts: 3
Joined: Wed Nov 12, 2008 1:22 pm

Post by bfg-randy »

Has anybody solved the no data in the graph problem? I get valid data when running the script manually, but NaN in the graph. I stepped through Gandalf's NaN troubleshooting steps, all to no avail. Any suggestions?
User avatar
FoggeR
Posts: 2
Joined: Sat Aug 11, 2007 1:06 pm
Location: Finland
Contact:

Re: NFS Stats

Post by FoggeR »

Fixd version of nfs_server.sh. About thousand times faster..

Code: Select all

NFSD=/proc/net/rpc/nfsd
proc="getattr setattr lookup access readlink read write create mkdir symlink mknod remove rmdir rename link readdir readdirplus fsstat fsinfo pathconf commit"

i=0;

data=`grep proc3 $NFSD`;

for a in $data; do
#        grep proc3 $NFSD \
#               | cut -f $i -d ' ' \
#                | awk '{print $1}'
        if [ $i -ge 3 ]; then
                echo $a
        fi
        i=$(expr $i + 1)
done
sirhopcount
Posts: 5
Joined: Tue Mar 25, 2008 5:56 am

Re: NFS Stats

Post by sirhopcount »

Hi

I have a small question about the data being collected and the way its collected. If a take for example my the proc3 line from my /proc/net/rpc/nfsd it looks like this:

Code: Select all

proc3 22 124 293606019 77582633 126915042 380472083 0 98058414 61510311 22269327 6908 0 0 21290377 1243 18438938 1373865 7949872 26250248 3302016 2651 1275 55358199
Reading some documentation, the code supplied in this post and the results from nfsstat I was able to figure out the following values:

(In order as in proc3)

Code: Select all

?		22
null		124 
getattr		293606019 
setattr		77582633
lookup		126915042
access		380472083
readlink	0
read		98058414
write		61510311
create 		22269327
mkdir		6908
symlink		0
mknod		0
remove		21290377
rmdir		1243
rename		18438938
link		1373865
readdir		7949872
readdirplus	26250248
fsstat		3302016 
fsinfo		2651
pathconf	1275 
commit		55358199
The only value i cannot figure out what it represents is the first. Could someone please explain this to me.

The next question i have is about the scripts getting this information. Would it not suffice to just echo back these values (with the appropriate name) and use an data input method ? Or to formulate my question differently why do all provided solutions here loop through to the results and in the end result report the same values as proc3 does ?
eschoeller
Cacti User
Posts: 234
Joined: Mon Dec 13, 2004 3:03 pm

Re: NFS Stats

Post by eschoeller »

Like FoggeR I've fixed the nfs_client_solaris to be about a thousand times faster ... sorry it's written in perl and it's a bit of a hack.

Code: Select all

time /usr/local/bin//nfs_client_solaris.sh
...
real    0m4.647s
user    0m4.064s
sys     0m0.722s

time /usr/local/bin//nfs_client_solaris2.sh
...
real    0m0.245s
user    0m0.205s
sys     0m0.039s
Here it is:

Code: Select all

#!/bin/perl
# NFSv3 Solaris Stats Collection
# Eric Schoeller - University of Colorado Boulder - 20110506

# Collect all NFS v3 kernel stats in one call
my @kstatnfs=`/bin/kstat -p nfs:0:rfsreqcnt_v3`;

# Define list of statistics to consider
my @statistics = ('getattr', 'setattr', 'lookup', 'access', 'readlink', 'read', 'write', 'create', 'mkdir', 'symlink', 'mknod', 'remove', 'rmdir', 'rename', 'link', 'readdir', 'readdirplus', 'fsstat', 'fsinfo', 'pathconf', 'commit');

foreach $stat (@statistics) {

   # Find only the statistic we are looking for
   @data = grep(/nfs:0:rfsreqcnt_v3:$stat\b/, @kstatnfs);

   # Grab just the value for the stat
   @value = split(/$stat/, $data[0]);

   # Strip out the newline
   chomp($value[1]);

   # Chop off the leading whitespace characters from the value
   $value[1] =~ s/\s*//g;

   # Print the statistic's value
   print "$value[1]\n";
}
This should help dramatically with any SNMP timeouts or extended poller run times folks may be encountering.
julio9x
Posts: 1
Joined: Fri Oct 28, 2011 8:25 am

Re: NFS Stats

Post by julio9x »

Hi everyone,

I'm trying to graph the nfs client side on a debian squeeze with the extend template.

when i'm launching the snmp walk command, I'm getting hexa message

Code: Select all

snmpwalk -v2c -c "community_name" localhost  .1.3.6.1.4.1.2021.66
iso.3.6.1.4.1.2021.66.1.0 = INTEGER: 1
iso.3.6.1.4.1.2021.66.2.1.2.10.110.102.115.95.99.108.105.101.110.116 = STRING: "/bin/bash"
iso.3.6.1.4.1.2021.66.2.1.3.10.110.102.115.95.99.108.105.101.110.116 = STRING: "/path/to/scripts/nfs_client.sh"
iso.3.6.1.4.1.2021.66.2.1.4.10.110.102.115.95.99.108.105.101.110.116 = ""
iso.3.6.1.4.1.2021.66.2.1.5.10.110.102.115.95.99.108.105.101.110.116 = INTEGER: 5
iso.3.6.1.4.1.2021.66.2.1.6.10.110.102.115.95.99.108.105.101.110.116 = INTEGER: 1
iso.3.6.1.4.1.2021.66.2.1.7.10.110.102.115.95.99.108.105.101.110.116 = INTEGER: 1
iso.3.6.1.4.1.2021.66.2.1.20.10.110.102.115.95.99.108.105.101.110.116 = INTEGER: 4
iso.3.6.1.4.1.2021.66.2.1.21.10.110.102.115.95.99.108.105.101.110.116 = INTEGER: 1
iso.3.6.1.4.1.2021.66.3.1.1.10.110.102.115.95.99.108.105.101.110.116 = Hex-STRING: 2F 62 69 6E 2F 62 61 73 68 3A 20 2F 68 6F 6D 65 
2F 63 61 63 74 69 75 73 65 72 2F 73 63 72 69 70 
74 73 2F 6E 66 73 5F 63 6C 69 65 6E 74 2E 73 68 
3A 20 50 65 72 6D 69 73 73 69 6F 6E 20 6E 6F 6E 
20 61 63 63 6F 72 64 C3 A9 65 
iso.3.6.1.4.1.2021.66.3.1.2.10.110.102.115.95.99.108.105.101.110.116 = Hex-STRING: 2F 62 69 6E 2F 62 61 73 68 3A 20 2F 68 6F 6D 65 
2F 63 61 63 74 69 75 73 65 72 2F 73 63 72 69 70 
74 73 2F 6E 66 73 5F 63 6C 69 65 6E 74 2E 73 68 
3A 20 50 65 72 6D 69 73 73 69 6F 6E 20 6E 6F 6E 
20 61 63 63 6F 72 64 C3 A9 65 
iso.3.6.1.4.1.2021.66.3.1.3.10.110.102.115.95.99.108.105.101.110.116 = INTEGER: 1
iso.3.6.1.4.1.2021.66.3.1.4.10.110.102.115.95.99.108.105.101.110.116 = INTEGER: 126
iso.3.6.1.4.1.2021.66.4.1.2.10.110.102.115.95.99.108.105.101.110.116.1 = Hex-STRING: 2F 62 69 6E 2F 62 61 73 68 3A 20 2F 68 6F 6D 65 
2F 63 61 63 74 69 75 73 65 72 2F 73 63 72 69 70 
74 73 2F 6E 66 73 5F 63 6C 69 65 6E 74 2E 73 68 
3A 20 50 65 72 6D 69 73 73 69 6F 6E 20 6E 6F 6E 
20 61 63 63 6F 72 64 C3 A9 65 
This is what i put in the snmpd.conf file

Code: Select all

extend .1.3.6.1.4.1.2021.66 nfs_client /bin/bash /path/to/scripts/nfs_client.sh
As a result, i'm getting the "nan" message in cacti.

Did someone succeded to solve this issue ?
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests