]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/telemetry: add host counts
authorSage Weil <sage@redhat.com>
Tue, 29 Oct 2019 18:14:40 +0000 (13:14 -0500)
committerSage Weil <sage@redhat.com>
Tue, 29 Oct 2019 19:25:00 +0000 (14:25 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
PendingReleaseNotes
src/pybind/mgr/telemetry/module.py

index 2e0bd62e40b36a80f2dbd59d0c91c8b7672482a1..d98055e8dbf731835bd416d7f00d8992053efd8e 100644 (file)
     - 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::
 
index a2e79a98acf789a501065cd63f9d875d466c016d..eaf41e0b2000e6b994ce59fa57953cdaaf2ad404 100644 (file)
@@ -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,