]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
pybind/mgr: add osd space utilization to insights report
authorNoah Watkins <nwatkins@redhat.com>
Thu, 15 Nov 2018 21:29:52 +0000 (13:29 -0800)
committerNoah Watkins <nwatkins@redhat.com>
Thu, 15 Nov 2018 21:29:52 +0000 (13:29 -0800)
Signed-off-by: Noah Watkins <nwatkins@redhat.com>
src/pybind/mgr/insights/module.py

index 613fdbed7ea3cbd21a06f3fe5e16016fc48f5751..9f59920f54e13b9f91bcd059f870e48440eea74c 100644 (file)
@@ -200,6 +200,24 @@ class Module(MgrModule):
 
         return result, health_check_details
 
+    def _apply_osd_stats(self, osd_map):
+        # map from osd id to its index in the map structure
+        osd_id_to_idx = {}
+        for idx in range(len(osd_map["osds"])):
+            osd_id_to_idx[osd_map["osds"][idx]["osd"]] = idx
+
+        # include stats, including space utilization performance counters.
+        # adapted from dashboard api controller
+        for s in self.get('osd_stats')['osd_stats']:
+            idx = osd_id_to_idx[s["osd"]]
+            osd_map["osds"][idx].update({'osd_stats': s})
+
+        for osd in osd_map["osds"]:
+            osd['stats'] = {}
+            for s in ['osd.numpg', 'osd.stat_bytes', 'osd.stat_bytes_used']:
+                osd['stats'][s.split('.')[1]] = self.get_latest('osd', str(osd["osd"]), s)
+
+
     def _config_dump(self):
         """Report cluster configuration
 
@@ -241,6 +259,7 @@ class Module(MgrModule):
 
         osd_map = self.get("osd_map")
         del osd_map['pg_temp']
+        self._apply_osd_stats(osd_map)
         report["osd_dump"] = osd_map
 
         report["df"] = self.get("df")