Skip to content

Commit 57767be

Browse files
committed
allow for gmetric compatible type
the "uint" type is not valid for gmetric, which requires the bit specific width specified explicitally (8, 16 or 32). transform the type into a 32bit unsigned int if using uint and which is the equivalent used internally in modpython.
1 parent 85ecf0a commit 57767be

File tree

6 files changed

+36
-6
lines changed

6 files changed

+36
-6
lines changed

diskstat/python_modules/diskstat.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,12 @@ def metric_cleanup():
340340
print ' %s: %s %s [%s]' % (d['name'], v, d['units'], d['description'])
341341

342342
if options.gmetric:
343+
if d['value_type'] == 'uint':
344+
value_type = 'uint32'
345+
else:
346+
value_type = d['value_type']
347+
343348
cmd = "%s --conf=%s --value='%s' --units='%s' --type='%s' --name='%s' --slope='%s'" % \
344-
(options.gmetric_bin, options.gmond_conf, v, d['units'], d['value_type'], d['name'], d['slope'])
349+
(options.gmetric_bin, options.gmond_conf, v, d['units'], value_type, d['name'], d['slope'])
345350
os.system(cmd)
346351

ehcache/python_modules/ehcache.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,12 @@ def metric_cleanup():
218218
print ' %s: %s %s [%s]' % (d['name'], d['format'] % v, d['units'], d['description'])
219219

220220
if options.gmetric:
221+
if d['value_type'] == 'uint':
222+
value_type = 'uint32'
223+
else:
224+
value_type = d['value_type']
225+
221226
cmd = "%s --conf=%s --value='%s' --units='%s' --type='%s' --name='%s' --slope='%s'" % \
222-
(options.gmetric_bin, options.gmond_conf, v, d['units'], d['value_type'], d['name'], d['slope'])
227+
(options.gmetric_bin, options.gmond_conf, v, d['units'], value_type, d['name'], d['slope'])
223228
os.system(cmd)
224229

httpd/python_modules/httpd.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,12 @@ def metric_cleanup():
441441
print ' %s: %s %s [%s]' % (d['name'], v, d['units'], d['description'])
442442

443443
if options.gmetric:
444+
if d['value_type'] == 'uint':
445+
value_type = 'uint32'
446+
else:
447+
value_type = d['value_type']
448+
444449
cmd = "%s --conf=%s --value='%s' --units='%s' --type='%s' --name='%s' --slope='%s'" % \
445-
(options.gmetric_bin, options.gmond_conf, v, d['units'], d['value_type'], d['name'], d['slope'])
450+
(options.gmetric_bin, options.gmond_conf, v, d['units'], value_type, d['name'], d['slope'])
446451
os.system(cmd)
447452

jmxsh/python_modules/jmxsh.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,12 @@ def metric_cleanup():
311311
print ' %s: %s %s [%s]' % (d['name'], d['format'] % v, d['units'], d['description'])
312312

313313
if options.gmetric:
314+
if d['value_type'] == 'uint':
315+
value_type = 'uint32'
316+
else:
317+
value_type = d['value_type']
318+
314319
cmd = "%s --conf=%s --value='%s' --units='%s' --type='%s' --name='%s' --slope='%s'" % \
315-
(options.gmetric_bin, options.gmond_conf, v, d['units'], d['value_type'], d['name'], d['slope'])
320+
(options.gmetric_bin, options.gmond_conf, v, d['units'], value_type, d['name'], d['slope'])
316321
os.system(cmd)
317322

mysqld/python_modules/mysql.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1062,7 +1062,12 @@ def metric_cleanup():
10621062
print ' %s: %s %s [%s]' % (d['name'], v, d['units'], d['description'])
10631063

10641064
if options.gmetric:
1065+
if d['value_type'] == 'uint':
1066+
value_type = 'uint32'
1067+
else:
1068+
value_type = d['value_type']
1069+
10651070
cmd = "%s --conf=%s --value='%s' --units='%s' --type='%s' --name='%s' --slope='%s'" % \
1066-
(options.gmetric_bin, options.gmond_conf, v, d['units'], d['value_type'], d['name'], d['slope'])
1071+
(options.gmetric_bin, options.gmond_conf, v, d['units'], value_type, d['name'], d['slope'])
10671072
os.system(cmd)
10681073

procstat/python_modules/procstat.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,8 +496,13 @@ def metric_cleanup():
496496
print ' %s: %s %s [%s]' % (d['name'], d['format'] % v, d['units'], d['description'])
497497

498498
if options.gmetric:
499+
if d['value_type'] == 'uint':
500+
value_type = 'uint32'
501+
else:
502+
value_type = d['value_type']
503+
499504
cmd = "%s --conf=%s --value='%s' --units='%s' --type='%s' --name='%s' --slope='%s'" % \
500-
(options.gmetric_bin, options.gmond_conf, v, d['units'], d['value_type'], d['name'], d['slope'])
505+
(options.gmetric_bin, options.gmond_conf, v, d['units'], value_type, d['name'], d['slope'])
501506
os.system(cmd)
502507

503508

0 commit comments

Comments
 (0)