Skip to content
Browse files

Merge pull request #68 from waxie/attribute-error-fix

nfsstats/python_modules/nfsstats.py:
  • Loading branch information...
2 parents 1eb6ffd + b61d6fe commit 6d693d600ebc718898678a641228f8bf78a4942d @jbuchbinder jbuchbinder committed Jun 26, 2012
Showing with 21 additions and 2 deletions.
  1. +21 −2 nfsstats/python_modules/nfsstats.py
View
23 nfsstats/python_modules/nfsstats.py
@@ -7,14 +7,33 @@
import syslog
import sys
+def test_proc3( p_file ):
+
+ """
+ Check if <p_file> contains keyword 'proc3'
+ """
+
+ p_fd = open( p_file )
+
+ p_contents = p_fd.read()
+
+ p_fd.close()
+
+ m = re.search(".*proc3.*", p_contents, flags=re.MULTILINE)
+
+ if not m:
+ return False
+ else:
+ return True
+
verboselevel = 0
descriptors = [ ]
old_values = { }
# What we want ganglia to monitor, where to find it, how to extract it, ...
configtable = [
{
'group': 'nfs_client',
- 'tests': [ 'stat.S_ISREG(os.stat("/proc/net/rpc/nfs").st_mode)' ],
+ 'tests': [ 'stat.S_ISREG(os.stat("/proc/net/rpc/nfs").st_mode)', 'test_proc3("/proc/net/rpc/nfs")' ],
'prefix': 'nfs_v3_',
# The next 4 lines can be at the 'group' level or the 'name' level
'file': '/proc/net/rpc/nfs',
@@ -47,7 +66,7 @@
},
{
'group': 'nfs_server',
- 'tests': [ 'stat.S_ISREG(os.stat("/proc/net/rpc/nfsd").st_mode)' ],
+ 'tests': [ 'stat.S_ISREG(os.stat("/proc/net/rpc/nfsd").st_mode)', 'test_proc3("/proc/net/rpc/nfsd")' ],
'prefix': 'nfsd_v3_',
# The next 4 lines can be at the 'group' level or the 'name' level
'file': '/proc/net/rpc/nfsd',

0 comments on commit 6d693d6

Please sign in to comment.
Something went wrong with that request. Please try again.