Skip to content

Commit

Permalink
[plugins/ceph][ubuntu] Add microceph collections
Browse files Browse the repository at this point in the history
Collect the microceph data in the ceph plugins.

Signed-off-by: Nikhil Kshirsagar <[email protected]>
  • Loading branch information
nkshirsagar authored and TurboTurtle committed Jul 18, 2023
1 parent 984abd5 commit 5bcdb79
Show file tree
Hide file tree
Showing 3 changed files with 146 additions and 106 deletions.
70 changes: 39 additions & 31 deletions sos/report/plugins/ceph_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 :
59 changes: 38 additions & 21 deletions sos/report/plugins/ceph_mon.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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([
Expand Down
123 changes: 69 additions & 54 deletions sos/report/plugins/ceph_osd.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,62 +31,77 @@ class CephOSD(Plugin, RedHatPlugin, UbuntuPlugin):
plugin_name = 'ceph_osd'
profiles = ('storage', 'virt', 'container', 'ceph')
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):
"""
Expand Down

0 comments on commit 5bcdb79

Please sign in to comment.