]> 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>
Fri, 1 Jun 2018 12:26:25 +0000 (14:26 +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 dea9b5971788088c0368fcda6c680fdc556c40fe..bba1576d68fa8bfabe0ca9fbcb888f338f397f7f 100644 (file)
@@ -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
 
@@ -529,6 +538,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()
@@ -537,6 +552,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():