From: Sage Weil Date: Tue, 29 Oct 2019 18:14:40 +0000 (-0500) Subject: mgr/telemetry: add host counts X-Git-Tag: v15.1.0~1083^2~7 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9e6fbaaaa023a96db62a76ce72b0f6bb3a025297;p=ceph.git mgr/telemetry: add host counts Signed-off-by: Sage Weil --- diff --git a/PendingReleaseNotes b/PendingReleaseNotes index 2e0bd62e40b..d98055e8dbf 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 a2e79a98acf..eaf41e0b200 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,