PERFCOUNTER_LONGRUNAVG = 4
PERFCOUNTER_COUNTER = 8
PERFCOUNTER_HISTOGRAM = 0x10
- PERFCOUNTER_TYPE_MASK = ~2
+ PERFCOUNTER_TYPE_MASK = ~3
def __init__(self, module_name, py_modules_ptr, this_ptr):
self.module_name = module_name
return ''
+ def _perfvalue_to_value(self, stattype, value):
+ if stattype & self.PERFCOUNTER_TIME:
+ # Convert from ns to seconds
+ return value / 1000000000.0
+ else:
+ return value
+
def get_server(self, hostname):
"""
Called by the plugin to load information about a particular
and/or the monitor cluster is down.
"""
- return self._ceph_have_mon_connection()
\ No newline at end of file
+ return self._ceph_have_mon_connection()
("ceph_daemon",),
))
- self.metrics.append(path, counter_info['value'], (daemon,))
+ value = self._perfvalue_to_value(counter_info['type'], counter_info['value'])
+ self.metrics.append(path, value, (daemon,))
# It is sufficient to reset the pending metrics once per scrape
self.metrics.reset()