Skip to content
This repository was archived by the owner on Jun 22, 2022. It is now read-only.

Commit b61d6fe

Browse files
author
Ramon Bastiaans
committed
nfsstats/python_modules/nfsstats.py:
* added test_proc3: check if string 'proc3' is present in proc file * added test_proc3 to tests for nfs_client and nfs_server
1 parent 1eb6ffd commit b61d6fe

1 file changed

Lines changed: 21 additions & 2 deletions

File tree

nfsstats/python_modules/nfsstats.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,33 @@
77
import syslog
88
import sys
99

10+
def test_proc3( p_file ):
11+
12+
"""
13+
Check if <p_file> contains keyword 'proc3'
14+
"""
15+
16+
p_fd = open( p_file )
17+
18+
p_contents = p_fd.read()
19+
20+
p_fd.close()
21+
22+
m = re.search(".*proc3.*", p_contents, flags=re.MULTILINE)
23+
24+
if not m:
25+
return False
26+
else:
27+
return True
28+
1029
verboselevel = 0
1130
descriptors = [ ]
1231
old_values = { }
1332
# What we want ganglia to monitor, where to find it, how to extract it, ...
1433
configtable = [
1534
{
1635
'group': 'nfs_client',
17-
'tests': [ 'stat.S_ISREG(os.stat("/proc/net/rpc/nfs").st_mode)' ],
36+
'tests': [ 'stat.S_ISREG(os.stat("/proc/net/rpc/nfs").st_mode)', 'test_proc3("/proc/net/rpc/nfs")' ],
1837
'prefix': 'nfs_v3_',
1938
# The next 4 lines can be at the 'group' level or the 'name' level
2039
'file': '/proc/net/rpc/nfs',
@@ -47,7 +66,7 @@
4766
},
4867
{
4968
'group': 'nfs_server',
50-
'tests': [ 'stat.S_ISREG(os.stat("/proc/net/rpc/nfsd").st_mode)' ],
69+
'tests': [ 'stat.S_ISREG(os.stat("/proc/net/rpc/nfsd").st_mode)', 'test_proc3("/proc/net/rpc/nfsd")' ],
5170
'prefix': 'nfsd_v3_',
5271
# The next 4 lines can be at the 'group' level or the 'name' level
5372
'file': '/proc/net/rpc/nfsd',

0 commit comments

Comments
 (0)