Skip to content

Commit

Permalink
[microceph][ubuntu] Collect ceph daemon commands in OSD node
Browse files Browse the repository at this point in the history
Now that canonical/microceph#160 is fixed,
gather the ceph daemon command outputs for OSD nodes.

Signed-off-by: Nikhil Kshirsagar <[email protected]>
  • Loading branch information
nkshirsagar authored and root committed Oct 9, 2023
1 parent c9de414 commit 353548a
Showing 1 changed file with 43 additions and 27 deletions.
70 changes: 43 additions & 27 deletions sos/report/plugins/ceph_osd.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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:
Expand All @@ -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

Expand Down

0 comments on commit 353548a

Please sign in to comment.