From: Noah Watkins Date: Thu, 15 Nov 2018 21:29:52 +0000 (-0800) Subject: pybind/mgr: add osd space utilization to insights report X-Git-Tag: v14.1.0~744^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9a624209a41d24f5cda23f2bb2e2c0efb7f1e35b;p=ceph.git pybind/mgr: add osd space utilization to insights report Signed-off-by: Noah Watkins --- diff --git a/src/pybind/mgr/insights/module.py b/src/pybind/mgr/insights/module.py index 613fdbed7ea3..9f59920f54e1 100644 --- a/src/pybind/mgr/insights/module.py +++ b/src/pybind/mgr/insights/module.py @@ -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")