diff --git a/sos/report/plugins/ceph_mgr.py b/sos/report/plugins/ceph_mgr.py index d07631568c..6af24dcacc 100644 --- a/sos/report/plugins/ceph_mgr.py +++ b/sos/report/plugins/ceph_mgr.py @@ -36,33 +36,12 @@ class CephMGR(Plugin, RedHatPlugin, UbuntuPlugin): plugin_name = 'ceph_mgr' profiles = ('storage', 'virt', 'container', 'ceph') - files = ('/var/lib/ceph/mgr/*', '/var/lib/ceph/*/mgr*') + files = ('/var/lib/ceph/mgr/*', '/var/lib/ceph/*/mgr*', + '/var/snap/microceph/common/data/mgr/*') containers = ('ceph-(.*-)?mgr.*',) def setup(self): - - self.add_file_tags({ - '/var/log/ceph/(.*/)?ceph-mgr.*.log': 'ceph_mgr_log', - }) - - self.add_forbidden_path([ - "/etc/ceph/*keyring*", - "/var/lib/ceph/**/*keyring*", - "/var/lib/ceph/**/osd*", - "/var/lib/ceph/**/mon*", - # Excludes temporary ceph-osd mount location like - # /var/lib/ceph/tmp/mnt.XXXX from sos collection. - "/var/lib/ceph/**/tmp/*mnt*", - "/etc/ceph/*bindpass*", - ]) - - self.add_copy_spec([ - "/var/log/ceph/**/ceph-mgr*.log", - "/var/lib/ceph/**/mgr*", - "/var/lib/ceph/**/bootstrap-mgr/", - "/run/ceph/**/ceph-mgr*", - ]) - + microceph_pkg = self.policy.package_manager.pkg_by_name('microceph') # more commands to be added later ceph_mgr_cmds = ([ "balancer status", @@ -76,14 +55,6 @@ def setup(self): "log last cephadm" ]) - self.add_cmd_output( - [f"ceph {cmd}" for cmd in ceph_mgr_cmds]) - # get ceph_cmds again as json for easier automation parsing - self.add_cmd_output( - [f"ceph {cmd} --format json-pretty" for cmd in ceph_mgr_cmds], - subdir="json_output", - ) - cmds = [ "config diff", "config show", @@ -93,8 +64,6 @@ def setup(self): "mds_requests", "mds_sessions", "objecter_requests", - "mds_requests", - "mds_sessions", "perf dump", "perf histogram dump", "perf histogram schema", @@ -103,17 +72,74 @@ def setup(self): "version" ] - self.add_cmd_output([ - f"ceph daemon {m} {cmd}" for m in self.get_socks() for cmd in cmds] - ) - - def get_socks(self): + if not microceph_pkg: + self.add_file_tags({ + '/var/log/ceph/(.*/)?ceph-mgr.*.log': 'ceph_mgr_log', + }) + + self.add_forbidden_path([ + "/etc/ceph/*keyring*", + "/var/lib/ceph/**/*keyring*", + "/var/lib/ceph/**/osd*", + "/var/lib/ceph/**/mon*", + # Excludes temporary ceph-osd mount location like + # /var/lib/ceph/tmp/mnt.XXXX from sos collection. + "/var/lib/ceph/**/tmp/*mnt*", + "/etc/ceph/*bindpass*", + ]) + + self.add_copy_spec([ + "/var/log/ceph/**/ceph-mgr*.log", + "/var/lib/ceph/**/mgr*", + "/var/lib/ceph/**/bootstrap-mgr/", + "/run/ceph/**/ceph-mgr*", + ]) + + self.add_cmd_output( + [f"ceph {cmd}" for cmd in ceph_mgr_cmds]) + # get ceph_cmds again as json for easier automation parsing + self.add_cmd_output( + [f"ceph {cmd} --format json-pretty" for cmd in ceph_mgr_cmds], + subdir="json_output", + ) + + self.add_cmd_output([ + f"ceph daemon {m} {cmd}" for m in self.get_socks( + '/var/run/ceph') for cmd in cmds] + ) + else: + self.add_file_tags({ + '/var/log/ceph/common/logs/ceph-mgr.*.log': 'ceph_mgr_log', + }) + + self.add_forbidden_path([ + "/var/snap/microceph/common/**/*keyring*", + ]) + + self.add_copy_spec([ + "/var/snap/microceph/common/logs/ceph-mgr*.log", + ]) + + self.add_cmd_output( + [f"ceph {cmd}" for cmd in ceph_mgr_cmds]) + # get ceph_cmds again as json for easier automation parsing + self.add_cmd_output( + [f"ceph {cmd} --format json-pretty" for cmd in ceph_mgr_cmds], + subdir="json_output", + ) + + self.add_cmd_output([ + f"ceph daemon {m} {cmd}" for m in self.get_socks( + '/var/snap/microceph') for cmd in cmds] + ) + + def get_socks(self, folderpath): """ Find any available admin sockets under /var/run/ceph (or subdirs for later versions of Ceph) which can be used for ceph daemon commands """ ceph_sockets = [] - for rdir, dirs, files in os.walk('/var/run/ceph/'): + for rdir, dirs, files in os.walk(folderpath): for file in files: if file.startswith('ceph-mgr') and file.endswith('.asok'): ceph_sockets.append(self.path_join(rdir, file))