Skip to content

Commit

Permalink
mgr/prometheus: Expose OSD Flags
Browse files Browse the repository at this point in the history
Signed-off-by: Boris Ranto <branto@redhat.com>
  • Loading branch information
b-ranto committed Feb 19, 2018
1 parent 58af411 commit e76ec2a
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/pybind/mgr/prometheus/module.py
Expand Up @@ -53,6 +53,9 @@ def health_status_to_number(status):
DF_POOL = ['max_avail', 'bytes_used', 'raw_bytes_used', 'objects', 'dirty',
'quota_bytes', 'quota_objects', 'rd', 'rd_bytes', 'wr', 'wr_bytes']

OSD_FLAGS = ('noup', 'nodown', 'noout', 'noin', 'nobackfill', 'norebalance',
'norecover', 'noscrub', 'nodeep-scrub')

OSD_METADATA = ('cluster_addr', 'device_class', 'id', 'public_addr')

OSD_STATUS = ['weight', 'up', 'in']
Expand Down Expand Up @@ -186,6 +189,13 @@ def _setup_static_metrics(self):
'PG Total Count'
)

for flag in OSD_FLAGS:
path = 'osd_flag_{}'.format(flag)
metrics[path] = Metric(
'untyped',
path,
'OSD Flag {}'.format(flag)
)
for state in OSD_STATUS:
path = 'osd_{}'.format(state)
self.log.debug("init: creating {}".format(path))
Expand Down Expand Up @@ -295,6 +305,11 @@ def get_osd_stats(self):

def get_metadata_and_osd_status(self):
osd_map = self.get('osd_map')
osd_flags = osd_map['flags'].split(',')
for flag in OSD_FLAGS:
self.metrics['osd_flag_{}'.format(flag)].set(
int(flag in osd_flags)
)
osd_devices = self.get('osd_map_crush')['devices']
for osd in osd_map['osds']:
id_ = osd['osd']
Expand Down

0 comments on commit e76ec2a

Please sign in to comment.