diff --git a/sos/report/plugins/ceph_common.py b/sos/report/plugins/ceph_common.py index 105fd8c494..6722b0724a 100644 --- a/sos/report/plugins/ceph_common.py +++ b/sos/report/plugins/ceph_common.py @@ -41,45 +41,53 @@ class Ceph_Common(Plugin, RedHatPlugin, UbuntuPlugin): # This check will enable the plugin regardless of being # containerized or not - files = ('/etc/ceph/ceph.conf',) + files = ('/etc/ceph/ceph.conf', + '/var/snap/microceph/*',) def setup(self): all_logs = self.get_option("all_logs") - self.add_file_tags({ - '.*/ceph.conf': 'ceph_conf', - '/var/log/ceph(.*)?/ceph.log.*': 'ceph_log', - }) - - if not all_logs: - self.add_copy_spec("/var/log/calamari/*.log",) + microceph_pkg = self.policy.package_manager.pkg_by_name('microceph') + if not microceph_pkg: + self.add_file_tags({ + '.*/ceph.conf': 'ceph_conf', + '/var/log/ceph(.*)?/ceph.log.*': 'ceph_log', + }) + + if not all_logs: + self.add_copy_spec("/var/log/calamari/*.log",) + else: + self.add_copy_spec("/var/log/calamari",) + + self.add_copy_spec([ + "/var/log/ceph/**/ceph.log", + "/var/log/ceph/**/ceph.audit.log*", + "/var/log/calamari/*.log", + "/etc/ceph/", + "/etc/calamari/", + "/var/lib/ceph/tmp/", + ]) + + self.add_forbidden_path([ + "/etc/ceph/*keyring*", + "/var/lib/ceph/*keyring*", + "/var/lib/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*" + ]) else: - self.add_copy_spec("/var/log/calamari",) - - self.add_copy_spec([ - "/var/log/ceph/**/ceph.log", - "/var/log/ceph/**/ceph.audit.log*", - "/var/log/calamari/*.log", - "/etc/ceph/", - "/etc/calamari/", - "/var/lib/ceph/tmp/", - ]) + self.add_copy_spec([ + "/var/snap/microceph/common/logs/ceph.log", + "/var/snap/microceph/common/logs/ceph.audit.log", + ]) self.add_cmd_output([ "ceph -v", ]) - self.add_forbidden_path([ - "/etc/ceph/*keyring*", - "/var/lib/ceph/*keyring*", - "/var/lib/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*" - ]) - # vim: set et ts=4 sw=4 : diff --git a/sos/report/plugins/ceph_mon.py b/sos/report/plugins/ceph_mon.py index b8dc8b8a4d..a9253a91fa 100644 --- a/sos/report/plugins/ceph_mon.py +++ b/sos/report/plugins/ceph_mon.py @@ -14,8 +14,8 @@ class CephMON(Plugin, RedHatPlugin, UbuntuPlugin): """ This plugin serves to collect information on monitor nodes within a Ceph - cluster. It is designed to collect from several versions of Ceph, including - those versions that serve as the basis for RHCS 4 and RHCS 5. + or microceph cluster. It is designed to collect from several versions of + Ceph, including versions that serve as the basis for RHCS 4 and RHCS 5. Older versions of Ceph will have collections from locations such as /var/log/ceph, whereas newer versions (as of this plugin's latest update) @@ -37,32 +37,49 @@ class CephMON(Plugin, RedHatPlugin, UbuntuPlugin): # but by default they are not capable of running various ceph commands in # this plugin - the `ceph` binary is functional directly on the host containers = ('ceph-(.*-)?mon.*',) - files = ('/var/lib/ceph/mon/', '/var/lib/ceph/*/mon*') + files = ('/var/lib/ceph/mon/', '/var/lib/ceph/*/mon*', + '/var/snap/microceph/common/data/mon/*') ceph_version = 0 def setup(self): self.ceph_version = self.get_ceph_version() - self.add_file_tags({ - '.*/ceph.conf': 'ceph_conf', - "/var/log/ceph/(.*/)?ceph-.*mon.*.log": 'ceph_mon_log' - }) - - self.add_forbidden_path([ - "/etc/ceph/*keyring*", - "/var/lib/ceph/**/*keyring*", - # Excludes temporary ceph-osd mount location like - # /var/lib/ceph/tmp/mnt.XXXX from sos collection. - "/var/lib/ceph/**/tmp/*mnt*", - "/etc/ceph/*bindpass*" - ]) + microceph_pkg = self.policy.package_manager.pkg_by_name('microceph') + if not microceph_pkg: + self.add_file_tags({ + '.*/ceph.conf': 'ceph_conf', + "/var/log/ceph/(.*/)?ceph-.*mon.*.log": 'ceph_mon_log' + }) + + self.add_forbidden_path([ + "/etc/ceph/*keyring*", + "/var/lib/ceph/**/*keyring*", + # 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([ + "/run/ceph/**/ceph-mon*", + "/var/lib/ceph/**/kv_backend", + "/var/log/ceph/**/*ceph-mon*.log" + ]) - self.add_copy_spec([ - "/run/ceph/**/ceph-mon*", - "/var/lib/ceph/**/kv_backend", - "/var/log/ceph/**/*ceph-mon*.log" - ]) + else: + self.add_forbidden_path([ + "/var/snap/microceph/common/**/*keyring*", + "/var/snap/microceph/current/**/*keyring*", + "/var/snap/microceph/common/data/mon/*/store.db", + "/var/snap/microceph/common/state/*", + ]) + + self.add_copy_spec([ + "/var/snap/microceph/common/data/mon/*", + "/var/snap/microceph/common/logs/*ceph-mon*.log", + "/var/snap/microceph/current/conf/*", + ]) self.add_cmd_output("ceph report", tags="ceph_report") self.add_cmd_output([ diff --git a/sos/report/plugins/ceph_osd.py b/sos/report/plugins/ceph_osd.py index 4ed4565b63..39a7ece9e7 100644 --- a/sos/report/plugins/ceph_osd.py +++ b/sos/report/plugins/ceph_osd.py @@ -31,62 +31,77 @@ class CephOSD(Plugin, RedHatPlugin, UbuntuPlugin): plugin_name = 'ceph_osd' profiles = ('storage', 'virt', 'container') containers = ('ceph-(.*-)?osd.*',) - files = ('/var/lib/ceph/osd/', '/var/lib/ceph/*/osd*') + files = ('/var/lib/ceph/osd/', '/var/lib/ceph/*/osd*', + '/var/snap/microceph/common/data/osd/*') def setup(self): - - self.add_file_tags({ - "/var/log/ceph/(.*/)?ceph-(.*-)?osd.*.log": 'ceph_osd_log', - }) - - self.add_forbidden_path([ - "/etc/ceph/*keyring*", - "/var/lib/ceph/**/*keyring*", - # Excludes temporary ceph-osd mount location like - # /var/lib/ceph/tmp/mnt.XXXX from sos collection. - "/var/lib/ceph/**/tmp/*mnt*", - "/etc/ceph/*bindpass*" - ]) - - # Only collect OSD specific files - self.add_copy_spec([ - "/run/ceph/**/ceph-osd*", - "/var/lib/ceph/**/kv_backend", - "/var/log/ceph/**/ceph-osd*.log", - "/var/log/ceph/**/ceph-volume*.log", - ]) - - self.add_cmd_output([ - "ceph-disk list", - "ceph-volume lvm list" - ]) - - cmds = [ - "bluestore bluefs available", - "config diff", - "config show", - "dump_blacklist", - "dump_blocked_ops", - "dump_historic_ops_by_duration", - "dump_historic_slow_ops", - "dump_mempools", - "dump_ops_in_flight", - "dump_op_pq_state", - "dump_osd_network", - "dump_reservations", - "dump_watchers", - "log dump", - "perf dump", - "perf histogram dump", - "objecter_requests", - "ops", - "status", - "version", - ] - - self.add_cmd_output( - [f"ceph daemon {i} {c}" for i in self.get_socks() for c in cmds] - ) + microceph_pkg = self.policy.package_manager.pkg_by_name('microceph') + if not microceph_pkg: + self.add_file_tags({ + "/var/log/ceph/(.*/)?ceph-(.*-)?osd.*.log": 'ceph_osd_log', + }) + + self.add_forbidden_path([ + "/etc/ceph/*keyring*", + "/var/lib/ceph/**/*keyring*", + # Excludes temporary ceph-osd mount location like + # /var/lib/ceph/tmp/mnt.XXXX from sos collection. + "/var/lib/ceph/**/tmp/*mnt*", + "/etc/ceph/*bindpass*" + ]) + + # Only collect OSD specific files + self.add_copy_spec([ + "/run/ceph/**/ceph-osd*", + "/var/lib/ceph/**/kv_backend", + "/var/log/ceph/**/ceph-osd*.log", + "/var/log/ceph/**/ceph-volume*.log", + ]) + + self.add_cmd_output([ + "ceph-disk list", + "ceph-volume lvm list" + ]) + + cmds = [ + "bluestore bluefs available", + "config diff", + "config show", + "dump_blacklist", + "dump_blocked_ops", + "dump_historic_ops_by_duration", + "dump_historic_slow_ops", + "dump_mempools", + "dump_ops_in_flight", + "dump_op_pq_state", + "dump_osd_network", + "dump_reservations", + "dump_watchers", + "log dump", + "perf dump", + "perf histogram dump", + "objecter_requests", + "ops", + "status", + "version", + ] + + self.add_cmd_output( + [f"ceph daemon {i} {c}" for i in self.get_socks() for c in cmds] + ) + + else: + # Only collect microceph files, don't run any commands + self.add_forbidden_path([ + "/var/snap/microceph/common/**/*keyring*", + "/var/snap/microceph/current/**/*keyring*", + "/var/snap/microceph/common/state/*", + ]) + + self.add_copy_spec([ + "/var/snap/microceph/common/data/osd/*", + "/var/snap/microceph/common/logs/*ceph-osd*.log", + ]) def get_socks(self): """