From 353548af0f07c2681a35f24d174de780ea3f933d Mon Sep 17 00:00:00 2001 From: Nikhil Kshirsagar Date: Mon, 9 Oct 2023 07:19:34 +0000 Subject: [PATCH] [microceph][ubuntu] Collect ceph daemon commands in OSD node Now that https://github.com/canonical/microceph/issues/160 is fixed, gather the ceph daemon command outputs for OSD nodes. Signed-off-by: Nikhil Kshirsagar --- sos/report/plugins/ceph_osd.py | 70 +++++++++++++++++++++------------- 1 file changed, 43 insertions(+), 27 deletions(-) diff --git a/sos/report/plugins/ceph_osd.py b/sos/report/plugins/ceph_osd.py index 41bde4c910..cc45c96d1c 100644 --- a/sos/report/plugins/ceph_osd.py +++ b/sos/report/plugins/ceph_osd.py @@ -36,6 +36,39 @@ class CephOSD(Plugin, RedHatPlugin, UbuntuPlugin): def setup(self): microceph_pkg = self.policy.package_manager.pkg_by_name('microceph') + cmds = [ + # will work pre quincy + "dump_reservations", + "bluestore bluefs available", + # will work quincy onward + "bluestore bluefs device info", + "bluefs stats", + "config diff", + "config show", + "dump_blocklist", + "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_pgstate_history", + "dump_recovery_reservations", + "dump_scrubs", + "get_mapped_pools", + "dump_watchers", + "log dump", + "list_devices", + "list_unfound", + "perf dump", + "perf histogram dump", + "objecter_requests", + "ops", + "status", + "version", + ] + if not microceph_pkg: self.add_file_tags({ "/var/log/ceph/(.*/)?ceph-(.*-)?osd.*.log": 'ceph_osd_log', @@ -63,31 +96,9 @@ def setup(self): "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] + [f"ceph daemon {i} {c}" for i in self.get_socks( + 'var/run/ceph') for c in cmds] ) else: @@ -103,15 +114,20 @@ def setup(self): "/var/snap/microceph/common/logs/*ceph-osd*.log", ]) - def get_socks(self): + self.add_cmd_output( + [f"ceph daemon {i} {c}" for i in self.get_socks( + '/var/snap/microceph/') for c 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.endswith('.asok'): + if file.endswith('.asok') and 'osd' in file: ceph_sockets.append(self.path_join(rdir, file)) return ceph_sockets