From: Boris Ranto Date: Wed, 2 May 2018 21:32:35 +0000 (+0200) Subject: prometheus: Expose number of degraded/misplaced/unfound objects X-Git-Tag: v14.0.0~203^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F21793%2Fhead;p=ceph.git prometheus: Expose number of degraded/misplaced/unfound objects These come from the pg dump by polling the pg_stas_sum. Signed-off-by: Boris Ranto --- diff --git a/src/pybind/mgr/prometheus/module.py b/src/pybind/mgr/prometheus/module.py index 248fd038df89..66e58d1dba85 100644 --- a/src/pybind/mgr/prometheus/module.py +++ b/src/pybind/mgr/prometheus/module.py @@ -102,6 +102,8 @@ RGW_METADATA = ('id', 'hostname', 'ceph_version') DISK_OCCUPATION = ('instance', 'device', 'ceph_daemon') +NUM_OBJECTS = ['degraded', 'misplaced', 'unfound'] + class Metrics(object): def __init__(self): @@ -253,6 +255,13 @@ class Metrics(object): 'DF pool {}'.format(state), ('pool_id',) ) + for state in NUM_OBJECTS: + path = 'num_objects_{}'.format(state) + metrics[path] = Metric( + 'gauge', + path, + 'Number of {} objects'.format(state), + ) return metrics @@ -539,6 +548,12 @@ class Module(MgrModule): (service_id, hostname, version) ) + def get_num_objects(self): + pg_sum = self.get('pg_summary')['pg_stats_sum']['stat_sum'] + for obj in NUM_OBJECTS: + stat = 'num_objects_{}'.format(obj) + self.metrics.set(stat, pg_sum[stat]) + def collect(self): self.get_health() self.get_df() @@ -547,6 +562,7 @@ class Module(MgrModule): self.get_quorum_status() self.get_metadata_and_osd_status() self.get_pg_status() + self.get_num_objects() for daemon, counters in self.get_all_perf_counters().items(): for path, counter_info in counters.items():