diff options
author | Varsha Teratipally <teratipally@google.com> | 2022-08-24 21:34:18 +0000 |
---|---|---|
committer | Jake Hunsaker <jhunsake@redhat.com> | 2022-08-30 11:19:06 -0400 |
commit | 647d52da2ca617b24a044c1733b1217a612da3ad (patch) | |
tree | abe6128b7ac3926f53f6e531e9d099ce298f3c0f | |
parent | 99b5fc3daa1b3ec67af323345dcaed49f02f9d27 (diff) | |
download | sos-647d52da2ca617b24a044c1733b1217a612da3ad.tar.gz |
add support for logs, kdump, release in CosPlugin
Signed-off-by: Varsha Teratipally <teratipally@google.com>
-rw-r--r-- | sos/report/plugins/kdump.py | 17 | ||||
-rw-r--r-- | sos/report/plugins/logs.py | 19 | ||||
-rw-r--r-- | sos/report/plugins/release.py | 5 |
3 files changed, 36 insertions, 5 deletions
diff --git a/sos/report/plugins/kdump.py b/sos/report/plugins/kdump.py index 66565664..a6c7b279 100644 --- a/sos/report/plugins/kdump.py +++ b/sos/report/plugins/kdump.py @@ -7,7 +7,8 @@ # See the LICENSE file in the source distribution for further information. import platform -from sos.report.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin +from sos.report.plugins import Plugin, PluginOpt, RedHatPlugin, DebianPlugin, \ + UbuntuPlugin, CosPlugin class KDump(Plugin): @@ -102,4 +103,18 @@ class DebianKDump(KDump, DebianPlugin, UbuntuPlugin): "/etc/default/kdump-tools" ]) + +class CosKDump(KDump, CosPlugin): + + option_list = [ + PluginOpt(name="collect-kdumps", default=False, + desc="Collect existing kdump files"), + ] + + def setup(self): + super(CosKDump, self).setup() + self.add_cmd_output('ls -alRh /var/kdump*') + if self.get_option("collect-kdumps"): + self.add_copy_spec(["/var/kdump-*"]) + # vim: set et ts=4 sw=4 : diff --git a/sos/report/plugins/logs.py b/sos/report/plugins/logs.py index 27a814a9..5413b55d 100644 --- a/sos/report/plugins/logs.py +++ b/sos/report/plugins/logs.py @@ -7,7 +7,7 @@ # See the LICENSE file in the source distribution for further information. import glob -from sos.report.plugins import Plugin, IndependentPlugin +from sos.report.plugins import Plugin, PluginOpt, IndependentPlugin, CosPlugin class Logs(Plugin, IndependentPlugin): @@ -61,7 +61,7 @@ class Logs(Plugin, IndependentPlugin): # - systemd-journald service exists # otherwise fallback to collecting few well known logfiles directly journal = any([self.path_exists(self.path_join(p, "log/journal/")) - for p in ["/var", "/run"]]) + for p in ["/var", "/run"]]) if journal and self.is_service("systemd-journald"): self.add_journal(since=since, tags='journal_full', priority=100) self.add_journal(boot="this", since=since, @@ -105,4 +105,19 @@ class Logs(Plugin, IndependentPlugin): r"pwd=[******]" ) + +class CosLogs(Logs, CosPlugin): + option_list = [ + PluginOpt(name="log_days", default=3, + desc="the number of days logs to collect") + ] + + def setup(self): + super(CosLogs, self).setup() + if self.get_option("all_logs"): + self.add_cmd_output("journalctl -o export") + else: + days = self.get_option("log_days", 3) + self.add_journal(since="-%ddays" % days) + # vim: set et ts=4 sw=4 : diff --git a/sos/report/plugins/release.py b/sos/report/plugins/release.py index 52919972..a57f37f1 100644 --- a/sos/report/plugins/release.py +++ b/sos/report/plugins/release.py @@ -6,10 +6,11 @@ # # See the LICENSE file in the source distribution for further information. -from sos.report.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin +from sos.report.plugins import Plugin, RedHatPlugin,\ + DebianPlugin, UbuntuPlugin, CosPlugin -class Release(Plugin, UbuntuPlugin): +class Release(Plugin, UbuntuPlugin, CosPlugin): short_desc = 'Linux release information' |