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

Commit b4649cb

Browse files
committed
Merge pull request ganglia#69 from waxie/add-cumulative-total-nfscalls-sum-metric
nfsstats/python_modules/nfsstats.py:
2 parents 20acfda + cbf826c commit b4649cb

2 files changed

Lines changed: 25 additions & 1 deletion

File tree

nfsstats/conf.d/nfsstats.pyconf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ modules {
88
collection_group {
99
collect_every = 60
1010
time_threshold = 120
11+
metric {
12+
name = "nfs_v3_total"
13+
title = "NFS v3 total"
14+
}
1115
metric {
1216
name = "nfs_v3_getattr"
1317
title = "NFS v3 getattr"
@@ -92,6 +96,10 @@ collection_group {
9296
name = "nfs_v3_commit"
9397
title = "NFS v3 commit"
9498
}
99+
metric {
100+
name = "nfsd_v3_total"
101+
title = "NFSD v3 total"
102+
}
95103
metric {
96104
name = "nfsd_v3_getattr"
97105
title = "NFSD v3 getattr"

nfsstats/python_modules/nfsstats.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import time
77
import syslog
88
import sys
9+
import string
910

1011
def test_proc3( p_file ):
1112

@@ -41,6 +42,7 @@ def test_proc3( p_file ):
4142
'units': 'calls/sec',
4243
'format': '%f',
4344
'names': {
45+
'total': { 'description':'dummy description', 're': ".*proc3 (?:\S*\s){2}(\d+.*\d)\n" },
4446
'getattr': { 'description':'dummy description', 're': ".*proc3 (?:\S*\s){2}(\S*)" },
4547
'setattr': { 'description':'dummy description', 're': ".*proc3 (?:\S*\s){3}(\S*)" },
4648
'lookup': { 'description':'dummy description', 're': ".*proc3 (?:\S*\s){4}(\S*)" },
@@ -74,6 +76,7 @@ def test_proc3( p_file ):
7476
'units': 'calls/sec',
7577
'format': '%f',
7678
'names': {
79+
'total': { 'description':'dummy description', 're': ".*proc3 (?:\S*\s){2}(\d+.*\d)\n" },
7780
'getattr': { 'description':'dummy description', 're': ".*proc3 (?:\S*\s){2}(\S*)" },
7881
'setattr': { 'description':'dummy description', 're': ".*proc3 (?:\S*\s){3}(\S*)" },
7982
'lookup': { 'description':'dummy description', 're': ".*proc3 (?:\S*\s){4}(\S*)" },
@@ -197,10 +200,23 @@ def get_value(name):
197200
break
198201
contents = file(descriptors[i]['file']).read()
199202
m = re.search(descriptors[i]['re'], contents, flags=re.MULTILINE)
203+
204+
m_value = m.group(1)
205+
206+
#RB: multiple (space seperated) values: calculate sum
207+
if string.count( m_value, ' ' ) > 0:
208+
m_fields = string.split( m_value, ' ' )
209+
210+
sum_value = 0
211+
212+
for f in m_fields:
213+
sum_value = sum_value + int(f)
214+
215+
m_value = sum_value
200216

201217
# Return time and value.
202218
ts = time.time()
203-
return (ts, int(m.group(1)))
219+
return (ts, int(m_value))
204220

205221
def debug(level, text):
206222
global verboselevel

0 commit comments

Comments
 (0)