]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
prometheus: Expose number of degraded/misplaced/unfound objects
authorBoris Ranto <branto@redhat.com>
Wed, 2 May 2018 21:32:35 +0000 (23:32 +0200)
committerBoris Ranto <branto@redhat.com>
Wed, 30 May 2018 18:07:24 +0000 (20:07 +0200)
These come from the pg dump by polling the pg_stas_sum.

Signed-off-by: Boris Ranto <branto@redhat.com>
(cherry picked from commit df48a34778968ab7141a20e5ade446e2ce3ffd32)

src/pybind/mgr/prometheus/module.py

index 002c7f4e38cc3c93d8ef2affed31591c0f4ceba1..aac656e407ee5693a4512e0088948092248903b9 100644 (file)
@@ -104,6 +104,8 @@ RGW_METADATA = ('ceph_daemon', 'hostname', 'ceph_version')
 
 DISK_OCCUPATION = ( 'ceph_daemon', 'device','instance')
 
+NUM_OBJECTS = ['degraded', 'misplaced', 'unfound']
+
 
 class Metrics(object):
     def __init__(self):
@@ -255,6 +257,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
 
@@ -544,6 +553,12 @@ class Module(MgrModule):
                 ('{}.{}'.format(service_type, 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()
@@ -552,6 +567,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():