aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPonnuvel Palaniyappan <pponnuvel@gmail.com>2024-03-15 11:54:08 +0000
committerJake Hunsaker <jacob.r.hunsaker@gmail.com>2024-03-16 12:10:48 -0400
commit686ef7e327d58b769cec41a2449cd8090f847062 (patch)
tree1d2aa2a2a8158473d99b374f44e47b6de95f3c05
parentea4625ca6d168dc12983e5e3e1beba9fe320cb7b (diff)
downloadsos-686ef7e327d58b769cec41a2449cd8090f847062.tar.gz
[ceph/plugins] Add Microceph support for RGW and MDS
Signed-off-by: Ponnuvel Palaniyappan <pponnuvel@gmail.com>
-rw-r--r--sos/report/plugins/ceph_mds.py106
-rw-r--r--sos/report/plugins/ceph_mgr.py2
-rw-r--r--sos/report/plugins/ceph_osd.py6
-rw-r--r--sos/report/plugins/ceph_rgw.py56
4 files changed, 101 insertions, 69 deletions
diff --git a/sos/report/plugins/ceph_mds.py b/sos/report/plugins/ceph_mds.py
index b04c9afc..c9253a8d 100644
--- a/sos/report/plugins/ceph_mds.py
+++ b/sos/report/plugins/ceph_mds.py
@@ -6,6 +6,7 @@
#
# See the LICENSE file in the source distribution for further information.
+import os
from sos.report.plugins import Plugin, RedHatPlugin, UbuntuPlugin
@@ -15,44 +16,55 @@ class CephMDS(Plugin, RedHatPlugin, UbuntuPlugin):
plugin_name = 'ceph_mds'
profiles = ('storage', 'virt', 'container', 'ceph')
containers = ('ceph-(.*-)?fs.*',)
- files = ('/var/lib/ceph/mds/*',)
+ files = ('/var/lib/ceph/mds/*', '/var/snap/microceph/common/data/mds/*')
def setup(self):
all_logs = self.get_option("all_logs")
-
- self.add_file_tags({
- '/var/log/ceph/ceph-mds.*.log': 'ceph_mds_log',
- })
-
- if not all_logs:
- self.add_copy_spec([
- "/var/log/ceph/ceph-mds*.log",
+ microceph = self.policy.package_manager.pkg_by_name('microceph')
+ if microceph:
+ if all_logs:
+ self.add_copy_spec([
+ "/var/snap/microceph/common/logs/*ceph-mds*.log*",
+ ])
+ else:
+ self.add_copy_spec([
+ "/var/snap/microceph/common/logs/*ceph-mds*.log",
+ ])
+ self.add_forbidden_path([
+ "/var/snap/microceph/common/**/*keyring*",
+ "/var/snap/microceph/current/**/*keyring*",
+ "/var/snap/microceph/common/state/*",
])
else:
+ self.add_file_tags({
+ '/var/log/ceph/ceph-mds.*.log': 'ceph_mds_log',
+ })
+
+ if not all_logs:
+ self.add_copy_spec(["/var/log/ceph/ceph-mds*.log",])
+ else:
+ self.add_copy_spec(["/var/log/ceph/ceph-mds*.log*",])
+
self.add_copy_spec([
- "/var/log/ceph/ceph-mds*.log*",
+ "/var/lib/ceph/bootstrap-mds/",
+ "/var/lib/ceph/mds/",
+ "/run/ceph/ceph-mds*",
])
- self.add_copy_spec([
- "/var/lib/ceph/bootstrap-mds/",
- "/var/lib/ceph/mds/",
- "/run/ceph/ceph-mds*",
- ])
-
- 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*"
- ])
+ 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*"
+ ])
- ceph_cmds = [
+ cmds = [
"cache status",
"client ls",
"config diff",
@@ -79,29 +91,33 @@ class CephMDS(Plugin, RedHatPlugin, UbuntuPlugin):
"version",
]
- mds_ids = []
- # Get the ceph user processes
- out = self.exec_cmd('ps -u ceph -o args')
-
- if out['status'] == 0:
- # Extract the OSD ids from valid output lines
- for procs in out['output'].splitlines():
- proc = procs.split()
- if len(proc) < 6:
- continue
- if proc[4] == '--id' and "ceph-mds" in proc[0]:
- mds_ids.append("mds.%s" % proc[5])
-
# If containerized, run commands in containers
try:
cname = self.get_all_containers_by_regex("ceph-mds*")[0][1]
except Exception: # pylint: disable=broad-except
cname = None
+ directory = '/var/snap/microceph/current/run' if microceph \
+ else '/var/run/ceph'
+
+ # common add_cmd_output for ceph and microceph
self.add_cmd_output([
- "ceph daemon %s %s"
- % (mdsid, cmd) for mdsid in mds_ids for cmd in ceph_cmds
- ], container=cname)
+ f"ceph daemon {i} {c}" for i in
+ self.get_socks(directory) for c in cmds],
+ container=cname
+ )
+
+ def get_socks(self, directory):
+ """
+ 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, _, files in os.walk(directory):
+ for file in files:
+ if file.endswith('.asok') and 'mds' in file:
+ ceph_sockets.append(self.path_join(rdir, file))
+ return ceph_sockets
# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/ceph_mgr.py b/sos/report/plugins/ceph_mgr.py
index 579cf199..3a2b0c8a 100644
--- a/sos/report/plugins/ceph_mgr.py
+++ b/sos/report/plugins/ceph_mgr.py
@@ -123,7 +123,7 @@ class CephMGR(Plugin, RedHatPlugin, UbuntuPlugin):
])
else:
- directory = '/var/snap/microceph'
+ directory = '/var/snap/microceph/current/run'
self.add_file_tags({
'/var/snap/microceph/common/logs/ceph-mgr.*.log':
'ceph_mgr_log',
diff --git a/sos/report/plugins/ceph_osd.py b/sos/report/plugins/ceph_osd.py
index 6eec21ba..7172697b 100644
--- a/sos/report/plugins/ceph_osd.py
+++ b/sos/report/plugins/ceph_osd.py
@@ -16,7 +16,7 @@ from sos.report.plugins import Plugin, RedHatPlugin, UbuntuPlugin
class CephOSD(Plugin, RedHatPlugin, UbuntuPlugin):
"""
This plugin is for capturing information from Ceph OSD nodes. While the
- majority of this plugin should be version agnotics, several collections are
+ majority of this plugin should be version agnostic, several collections are
dependent upon the version of Ceph installed. Versions that correlate to
RHCS 4 or RHCS 5 are explicitly handled for differences such as those
pertaining to log locations on the host filesystem.
@@ -24,7 +24,7 @@ class CephOSD(Plugin, RedHatPlugin, UbuntuPlugin):
Note that while this plugin will activate based on the presence of Ceph
containers, commands are run directly on the host as those containers are
often not configured to successfully run the `ceph` commands collected by
- this plugin. These commands are majorily `ceph daemon` commands that will
+ this plugin. These commands are majorly `ceph daemon` commands that will
reference discovered admin sockets under /var/run/ceph.
"""
@@ -111,7 +111,7 @@ class CephOSD(Plugin, RedHatPlugin, UbuntuPlugin):
])
else:
- directory = '/var/snap/microceph'
+ directory = '/var/snap/microceph/current/run'
# Only collect microceph files, don't run any commands
self.add_forbidden_path([
"/var/snap/microceph/common/**/*keyring*",
diff --git a/sos/report/plugins/ceph_rgw.py b/sos/report/plugins/ceph_rgw.py
index 202cbeb6..bc226166 100644
--- a/sos/report/plugins/ceph_rgw.py
+++ b/sos/report/plugins/ceph_rgw.py
@@ -16,29 +16,45 @@ class CephRGW(Plugin, RedHatPlugin, UbuntuPlugin):
plugin_name = 'ceph_rgw'
profiles = ('storage', 'virt', 'container', 'webserver', 'ceph')
containers = ('ceph-(.*)?rgw.*',)
- files = ('/var/lib/ceph/radosgw/*',)
+ files = ('/var/lib/ceph/radosgw/*',
+ '/var/snap/microceph/common/data/radosgw/*')
def setup(self):
all_logs = self.get_option("all_logs")
-
- if not all_logs:
- self.add_copy_spec('/var/log/ceph/ceph-client.rgw*.log',
- tags='ceph_rgw_log')
+ microceph = self.policy.package_manager.pkg_by_name('microceph')
+ if microceph:
+ if all_logs:
+ self.add_copy_spec([
+ "/var/snap/microceph/common/logs/*ceph-radosgw*.log*",
+ ])
+ else:
+ self.add_copy_spec([
+ "/var/snap/microceph/common/logs/*ceph-radosgw*.log",
+ ])
+ self.add_forbidden_path([
+ "/var/snap/microceph/common/**/*keyring*",
+ "/var/snap/microceph/current/**/*keyring*",
+ "/var/snap/microceph/common/state/*",
+ ])
else:
- self.add_copy_spec('/var/log/ceph/ceph-client.rgw*.log*',
- tags='ceph_rgw_log')
-
- 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*"
- ])
+ if not all_logs:
+ self.add_copy_spec('/var/log/ceph/ceph-client.rgw*.log',
+ tags='ceph_rgw_log')
+ else:
+ self.add_copy_spec('/var/log/ceph/ceph-client.rgw*.log*',
+ tags='ceph_rgw_log')
+
+ 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 :