aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikhil Kshirsagar <nkshirsagar@gmail.com>2021-09-17 21:29:34 +0530
committerJake Hunsaker <jhunsake@redhat.com>2021-09-24 13:40:48 -0400
commit13ce81156970034375e3a6985a7c147e281486f3 (patch)
tree6e47755077ad91e8a1231dcf70426508098148d5
parentaaeb8cb57ed55598ab744b96d4f127aedebcb292 (diff)
downloadsos-13ce81156970034375e3a6985a7c147e281486f3.tar.gz
[ceph] split the ceph plugin
This work distributes the ceph plugin into plugins for individual ceph components (mon,osd,mds,rgw,mgr), so that additional data collection can then be added in each of the components. Work for additional data collection in each component plugin will follow in a later commit. Closes: #1945 Signed-off-by: Nikhil Kshirsagar <nkshirsagar@gmail.com>
-rw-r--r--sos/report/plugins/ceph_common.py85
-rw-r--r--sos/report/plugins/ceph_mds.py48
-rw-r--r--sos/report/plugins/ceph_mgr.py81
-rw-r--r--sos/report/plugins/ceph_mon.py (renamed from sos/report/plugins/ceph.py)128
-rw-r--r--sos/report/plugins/ceph_osd.py58
-rw-r--r--sos/report/plugins/ceph_rgw.py41
6 files changed, 347 insertions, 94 deletions
diff --git a/sos/report/plugins/ceph_common.py b/sos/report/plugins/ceph_common.py
new file mode 100644
index 00000000..ebe70e0b
--- /dev/null
+++ b/sos/report/plugins/ceph_common.py
@@ -0,0 +1,85 @@
+# This file is part of the sos project: https://github.com/sosreport/sos
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions of
+# version 2 of the GNU General Public License.
+#
+# See the LICENSE file in the source distribution for further information.
+
+from sos.report.plugins import Plugin, RedHatPlugin, UbuntuPlugin
+from socket import gethostname
+
+
+class Ceph_Common(Plugin, RedHatPlugin, UbuntuPlugin):
+
+ short_desc = 'CEPH common'
+
+ plugin_name = 'ceph_common'
+ profiles = ('storage', 'virt', 'container')
+
+ containers = ('ceph-(mon|rgw|osd).*',)
+ ceph_hostname = gethostname()
+
+ packages = (
+ 'ceph',
+ 'ceph-mds',
+ 'ceph-common',
+ 'libcephfs1',
+ 'ceph-fs-common',
+ 'calamari-server',
+ 'librados2'
+ )
+
+ services = (
+ 'ceph-nfs@pacemaker',
+ 'ceph-mds@%s' % ceph_hostname,
+ 'ceph-mon@%s' % ceph_hostname,
+ 'ceph-mgr@%s' % ceph_hostname,
+ 'ceph-radosgw@*',
+ 'ceph-osd@*'
+ )
+
+ # This check will enable the plugin regardless of being
+ # containerized or not
+ files = ('/etc/ceph/ceph.conf',)
+
+ 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",)
+ 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_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_mds.py b/sos/report/plugins/ceph_mds.py
new file mode 100644
index 00000000..38ba95c9
--- /dev/null
+++ b/sos/report/plugins/ceph_mds.py
@@ -0,0 +1,48 @@
+# This file is part of the sos project: https://github.com/sosreport/sos
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions of
+# version 2 of the GNU General Public License.
+#
+# See the LICENSE file in the source distribution for further information.
+
+from sos.report.plugins import Plugin, RedHatPlugin, UbuntuPlugin
+import glob
+
+
+class CephMDS(Plugin, RedHatPlugin, UbuntuPlugin):
+ short_desc = 'CEPH mds'
+ plugin_name = 'ceph_mds'
+ profiles = ('storage', 'virt', 'container')
+ containers = ('ceph-fs.*',)
+
+ def check_enabled(self):
+ return True if glob.glob('/var/lib/ceph/mds/*/*') else False
+
+ def setup(self):
+ self.add_file_tags({
+ '/var/log/ceph/ceph-mds.*.log': 'ceph_mds_log',
+ })
+
+ self.add_copy_spec([
+ "/var/log/ceph.log",
+ "/var/log/ceph/ceph-mds*.log",
+ "/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*"
+ ])
+
+# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/ceph_mgr.py b/sos/report/plugins/ceph_mgr.py
new file mode 100644
index 00000000..518731a8
--- /dev/null
+++ b/sos/report/plugins/ceph_mgr.py
@@ -0,0 +1,81 @@
+# This file is part of the sos project: https://github.com/sosreport/sos
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions of
+# version 2 of the GNU General Public License.
+#
+# See the LICENSE file in the source distribution for further information.
+
+from sos.report.plugins import Plugin, RedHatPlugin, UbuntuPlugin
+import glob
+
+
+class CephMGR(Plugin, RedHatPlugin, UbuntuPlugin):
+
+ short_desc = 'CEPH mgr'
+
+ plugin_name = 'ceph_mgr'
+ profiles = ('storage', 'virt', 'container')
+
+ containers = ('ceph-mgr.*',)
+
+ def check_enabled(self):
+ return True if glob.glob('/var/lib/ceph/mgr/*/*') else False
+
+ def setup(self):
+ self.add_file_tags({
+ '/var/log/ceph/ceph-mgr.*.log': 'ceph_mgr_log',
+ })
+
+ self.add_copy_spec([
+ "/var/log/ceph/ceph-mgr*.log",
+ "/var/lib/ceph/mgr/",
+ "/var/lib/ceph/bootstrap-mgr/",
+ "/run/ceph/ceph-mgr*",
+ ])
+
+ # more commands to be added later
+ self.add_cmd_output([
+ "ceph balancer status",
+ "ceph mgr metadata",
+ ])
+
+ # more commands to be added later
+ ceph_cmds = [
+ "mgr module ls",
+ "mgr dump",
+ ]
+
+ self.add_cmd_output([
+ "ceph %s --format json-pretty" % s for s in ceph_cmds
+ ], subdir="json_output", tags="insights_ceph_health_detail")
+
+ 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 containerized, run commands in containers
+ containers_list = self.get_all_containers_by_regex("ceph-mgr*")
+ if containers_list:
+ for container in containers_list:
+ self.add_cmd_output([
+ self.fmt_container_cmd(container[1], "ceph %s" % s)
+ for s in ceph_cmds
+ ])
+ break
+ # Not containerized
+ else:
+ self.add_cmd_output([
+ "ceph %s" % s for s in ceph_cmds
+ ])
+
+# vim: set et ts=4 sw=4 :
diff --git a/sos/report/plugins/ceph.py b/sos/report/plugins/ceph_mon.py
index e5d12c51..420bc695 100644
--- a/sos/report/plugins/ceph.py
+++ b/sos/report/plugins/ceph_mon.py
@@ -7,101 +7,64 @@
# See the LICENSE file in the source distribution for further information.
from sos.report.plugins import Plugin, RedHatPlugin, UbuntuPlugin
-from socket import gethostname
-import re
+import glob
-class Ceph(Plugin, RedHatPlugin, UbuntuPlugin):
+class CephMON(Plugin, RedHatPlugin, UbuntuPlugin):
- short_desc = 'CEPH distributed storage'
+ short_desc = 'CEPH mon'
- plugin_name = 'ceph'
+ plugin_name = 'ceph_mon'
profiles = ('storage', 'virt', 'container')
- containers = ('ceph-(mon|rgw|osd)*',)
- ceph_hostname = gethostname()
+ containers = ('ceph-mon.*',)
- packages = (
- 'ceph',
- 'ceph-mds',
- 'ceph-common',
- 'libcephfs1',
- 'ceph-fs-common',
- 'calamari-server',
- 'librados2'
- )
-
- services = (
- 'ceph-nfs@pacemaker',
- 'ceph-mds@%s' % ceph_hostname,
- 'ceph-mon@%s' % ceph_hostname,
- 'ceph-mgr@%s' % ceph_hostname,
- 'ceph-radosgw@*',
- 'ceph-osd@*'
- )
-
- # This check will enable the plugin regardless of being
- # containerized or not
- files = (
- '/etc/ceph/ceph.conf',
- )
+ def check_enabled(self):
+ return True if glob.glob('/var/lib/ceph/mon/*/*') else False
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',
- '/var/log/ceph/ceph-osd.*.log': 'ceph_osd_log'
+ '/var/log/ceph/ceph-mon.*.log': 'ceph_mon_log'
})
- if not all_logs:
- self.add_copy_spec([
- "/var/log/ceph/*.log",
- "/var/log/radosgw/*.log",
- "/var/log/calamari/*.log"
- ])
- else:
- self.add_copy_spec([
- "/var/log/ceph/",
- "/var/log/calamari",
- "/var/log/radosgw"
- ])
-
self.add_copy_spec([
- "/etc/ceph/",
- "/etc/calamari/",
- "/var/lib/ceph/",
- "/run/ceph/"
+ "/var/log/ceph/ceph-mon*.log",
+ "/var/lib/ceph/mon/",
+ "/run/ceph/ceph-mon*"
])
self.add_cmd_output([
"ceph mon stat",
- "ceph mon_status",
"ceph quorum_status",
- "ceph mgr module ls",
- "ceph mgr metadata",
- "ceph balancer status",
- "ceph osd metadata",
- "ceph osd erasure-code-profile ls",
"ceph report",
- "ceph osd crush show-tunables",
"ceph-disk list",
"ceph versions",
"ceph features",
"ceph insights",
- "ceph osd crush dump",
- "ceph -v",
- "ceph-volume lvm list",
"ceph crash stat",
"ceph crash ls",
"ceph config log",
"ceph config generate-minimal-conf",
"ceph config-key dump",
+ "ceph mon_status",
+ "ceph osd metadata",
+ "ceph osd erasure-code-profile ls",
+ "ceph osd crush show-tunables",
+ "ceph osd crush dump"
])
ceph_cmds = [
+ "mon dump",
"status",
"health detail",
+ "device ls",
+ "df",
+ "df detail",
+ "fs ls",
+ "fs dump",
+ "pg dump",
+ "pg stat",
+ "time-sync-status",
"osd tree",
"osd stat",
"osd df tree",
@@ -111,28 +74,15 @@ class Ceph(Plugin, RedHatPlugin, UbuntuPlugin):
"osd blocked-by",
"osd pool ls detail",
"osd pool autoscale-status",
- "osd numa-status",
- "device ls",
- "mon dump",
- "mgr dump",
"mds stat",
- "df",
- "df detail",
- "fs ls",
- "fs dump",
- "pg dump",
- "pg stat",
- "time-sync-status",
- ]
-
- ceph_osd_cmds = [
- "ceph-volume lvm list",
+ "osd numa-status"
]
self.add_cmd_output([
"ceph %s --format json-pretty" % s for s in ceph_cmds
], subdir="json_output", tags="insights_ceph_health_detail")
+ # these can be cleaned up too but leaving them for safety for now
self.add_forbidden_path([
"/etc/ceph/*keyring*",
"/var/lib/ceph/*keyring*",
@@ -147,25 +97,15 @@ class Ceph(Plugin, RedHatPlugin, UbuntuPlugin):
])
# If containerized, run commands in containers
- containers_list = self.get_all_containers_by_regex("ceph-*")
+ containers_list = self.get_all_containers_by_regex("ceph-mon*")
if containers_list:
- # Avoid retrieving multiple times the same data
- got_ceph_cmds = False
for container in containers_list:
- if re.match("ceph-(mon|rgw|osd)", container[1]) and \
- not got_ceph_cmds:
- self.add_cmd_output([
- self.fmt_container_cmd(container[1], "ceph %s" % s)
- for s in ceph_cmds
- ])
- got_ceph_cmds = True
- if re.match("ceph-osd", container[1]):
- self.add_cmd_output([
- self.fmt_container_cmd(container[1], "%s" % s)
- for s in ceph_osd_cmds
- ])
- break
- # Not containerized
+ self.add_cmd_output([
+ self.fmt_container_cmd(container[1], "ceph %s" % s)
+ for s in ceph_cmds
+ ])
+ break
+ # Not containerized but still mon node
else:
self.add_cmd_output([
"ceph %s" % s for s in ceph_cmds
diff --git a/sos/report/plugins/ceph_osd.py b/sos/report/plugins/ceph_osd.py
new file mode 100644
index 00000000..d5027a4e
--- /dev/null
+++ b/sos/report/plugins/ceph_osd.py
@@ -0,0 +1,58 @@
+# This file is part of the sos project: https://github.com/sosreport/sos
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions of
+# version 2 of the GNU General Public License.
+#
+# See the LICENSE file in the source distribution for further information.
+
+from sos.report.plugins import Plugin, RedHatPlugin, UbuntuPlugin
+import glob
+
+
+class CephOSD(Plugin, RedHatPlugin, UbuntuPlugin):
+
+ short_desc = 'CEPH osd'
+
+ plugin_name = 'ceph_osd'
+ profiles = ('storage', 'virt', 'container')
+ containers = ('ceph-osd.*',)
+
+ def check_enabled(self):
+ return True if glob.glob('/var/lib/ceph/osd/*/*') else False
+
+ def setup(self):
+ self.add_file_tags({
+ '/var/log/ceph/ceph-osd.*.log': 'ceph_osd_log',
+ })
+
+ # Only collect OSD specific files
+ self.add_copy_spec([
+ "/var/log/ceph/ceph-osd*.log",
+ "/var/log/ceph/ceph-volume*.log",
+
+ "/var/lib/ceph/osd/",
+ "/var/lib/ceph/bootstrap-osd/",
+
+ "/run/ceph/ceph-osd*"
+ ])
+
+ self.add_cmd_output([
+ "ceph-disk list",
+ "ceph-volume lvm list",
+ ])
+
+ 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_rgw.py b/sos/report/plugins/ceph_rgw.py
new file mode 100644
index 00000000..f5afc0dd
--- /dev/null
+++ b/sos/report/plugins/ceph_rgw.py
@@ -0,0 +1,41 @@
+# This file is part of the sos project: https://github.com/sosreport/sos
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions of
+# version 2 of the GNU General Public License.
+#
+# See the LICENSE file in the source distribution for further information.
+
+from sos.report.plugins import Plugin, RedHatPlugin, UbuntuPlugin
+import glob
+
+
+class CephRGW(Plugin, RedHatPlugin, UbuntuPlugin):
+
+ short_desc = 'CEPH rgw'
+
+ plugin_name = 'ceph_rgw'
+ profiles = ('storage', 'virt', 'container', 'webserver')
+ containers = ('ceph-rgw.*',)
+
+ def check_enabled(self):
+ return True if glob.glob('/var/lib/ceph/radosgw/*/*') else False
+
+ def setup(self):
+ 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 :