From 9e6fbaaaa023a96db62a76ce72b0f6bb3a025297 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 29 Oct 2019 13:14:40 -0500 Subject: [PATCH] mgr/telemetry: add host counts Signed-off-by: Sage Weil --- PendingReleaseNotes | 1 + src/pybind/mgr/telemetry/module.py | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/PendingReleaseNotes b/PendingReleaseNotes index 2e0bd62e40b36..d98055e8dbf73 100644 --- a/PendingReleaseNotes +++ b/PendingReleaseNotes @@ -208,6 +208,7 @@ - whether RADOS cache tiering is enabled (and which mode) - whether pools are replicated or erasure coded, and which erasure code profile plugin and parameters are in use + - how many hosts are in the cluster, and how many hosts have each type of daemon If you had telemetry enabled, you will need to re-opt-in with:: diff --git a/src/pybind/mgr/telemetry/module.py b/src/pybind/mgr/telemetry/module.py index a2e79a98acf78..eaf41e0b2000e 100644 --- a/src/pybind/mgr/telemetry/module.py +++ b/src/pybind/mgr/telemetry/module.py @@ -51,6 +51,7 @@ REVISION = 3 # - added CephFS metadata (how many MDSs, fs features, how many data pools) # - remove crush_rule # - added more pool metadata (rep vs ec, cache tiering mode, ec profile) +# - added host count, and counts for hosts with each of (mon, osd, mds, mgr) class Module(MgrModule): config = dict() @@ -471,6 +472,18 @@ class Module(MgrModule): report['metadata']['osd'] = self.gather_osd_metadata(osd_map) report['metadata']['mon'] = self.gather_mon_metadata(mon_map) + # host counts + servers = self.list_servers() + self.log.debug('servers %s' % servers) + report['hosts'] = { + 'num': len([h for h in servers if h['hostname']]), + } + for t in ['mon', 'mds', 'osd', 'mgr']: + report['hosts']['num_with_' + t] = len( + [h for h in servers + if len([s for s in h['services'] if s['type'] == t])] + ) + report['usage'] = { 'pools': len(df['pools']), 'pg_num:': num_pg, -- 2.39.5