Skip to content

Commit

Permalink
[kdump] Capture more commands for RH kdump
Browse files Browse the repository at this point in the history
This change enables the RH plugin to display the content
of /var/crash via the command 'ls', and adds a new
option to capture the latest vmcores generated
in the last 24 hours, smaller than 2GB, as it's
done in the AzureDump class.

Signed-off-by: Jose Castillo <jcastillo@redhat.com>
  • Loading branch information
jcastill committed May 22, 2024
1 parent ed04ba7 commit 8efe317
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions sos/report/plugins/kdump.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ class RedHatKDump(KDump, RedHatPlugin):
files = ('/etc/kdump.conf',)
packages = ('kexec-tools',)

option_list = [
PluginOpt("get-vm-core", default=False, val_type=bool,
desc="collect vm core")
]

def fstab_parse_fs(self, device):
""" Parse /etc/fstab file """
fstab = self.path_join('/etc/fstab')
Expand Down Expand Up @@ -77,6 +82,7 @@ def setup(self):
self.add_copy_spec([
"/etc/kdump.conf",
"/etc/udev/rules.d/*kexec.rules",
"/usr/lib/udev/rules.d/*kexec.rules",
"/var/crash/*/kexec-dmesg.log",
"/var/log/kdump.log"
])
Expand All @@ -88,9 +94,14 @@ def setup(self):
# set no filesystem and default path
path = "/var/crash"

self.add_cmd_output(f"ls -alhR {path}")
self.add_copy_spec(f"{path}/*/vmcore-dmesg.txt")
self.add_copy_spec(f"{path}/*/kexec-dmesg.log")

# collect the latest vmcore created in the last 24hrs <= 2GB
if self.get_option("get-vm-core"):
self.add_copy_spec(f"{path}/*/vmcore", sizelimit=2048, maxage=24)


class DebianKDump(KDump, DebianPlugin, UbuntuPlugin):

Expand Down

0 comments on commit 8efe317

Please sign in to comment.