aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJake Hunsaker <jhunsake@redhat.com>2017-12-27 16:07:50 -0500
committerBryn M. Reeves <bmr@redhat.com>2018-04-16 16:44:41 +0100
commit971b9581779da20384f0a4d8de5177c0b87d6892 (patch)
treed0d83eb4bd364befaa8be3c8e12bc504859c02fa
parentec652a4992ed14df6131a38fa62f950eb64e4340 (diff)
downloadsos-971b9581779da20384f0a4d8de5177c0b87d6892.tar.gz
[general|host|date] Break up general into other plugins
Breaks up the general plugin into other plugins, some of them new, to better logically align collected items with relevant plugins. Adds the date plugin to collect system-time related information such as 'date' and 'hwclock' output. Adds the host plugin to capture host information like hostname, uptime, etc. Renames the lsbrelease plugin to 'release', and adds collection of /etc/*release files. Moves collection of /proc/stat to the process plugin, and /etc/sysconfig and /etc/default to the system plugin. Resolves: #1177 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com> Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r--sos/plugins/date.py34
-rw-r--r--sos/plugins/general.py68
-rw-r--r--sos/plugins/host.py41
-rw-r--r--sos/plugins/process.py11
-rw-r--r--sos/plugins/release.py (renamed from sos/plugins/lsbrelease.py)24
-rw-r--r--sos/plugins/system.py7
6 files changed, 107 insertions, 78 deletions
diff --git a/sos/plugins/date.py b/sos/plugins/date.py
new file mode 100644
index 00000000..a337ec9d
--- /dev/null
+++ b/sos/plugins/date.py
@@ -0,0 +1,34 @@
+# Copyright (C) 2018 Red Hat, Inc. Jake Hunsaker <jhunsake@redhat.com>
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+from sos.plugins import Plugin, RedHatPlugin, DebianPlugin
+
+
+class Date(Plugin, RedHatPlugin, DebianPlugin):
+ '''Basic system time information
+ '''
+
+ plugin_name = 'date'
+
+ def setup(self):
+ self.add_cmd_output('date', root_symlink='date')
+
+ self.add_cmd_output([
+ 'date --utc',
+ 'hwclock'
+ ])
+
+ self.add_copy_spec('/etc/localtime')
diff --git a/sos/plugins/general.py b/sos/plugins/general.py
deleted file mode 100644
index 6809e28f..00000000
--- a/sos/plugins/general.py
+++ /dev/null
@@ -1,68 +0,0 @@
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-from sos.plugins import Plugin, RedHatPlugin, DebianPlugin
-
-
-class General(Plugin):
- """general system information"""
-
- plugin_name = "general"
- profiles = ('system', 'sysmgmt')
-
- def setup(self):
- self.add_copy_spec([
- "/etc/sos.conf",
- "/etc/sysconfig",
- "/proc/stat",
- "/var/log/pm/suspend.log",
- "/etc/hostid",
- "/etc/localtime",
- "/etc/os-release"
- ])
-
- self.add_cmd_output("hostname -f")
- self.add_cmd_output("hostname", root_symlink='hostname')
-
- self.add_cmd_output("date", root_symlink="date")
- self.add_cmd_output("uptime", root_symlink="uptime")
-
-
-class RedHatGeneral(General, RedHatPlugin):
-
- def setup(self):
- super(RedHatGeneral, self).setup()
-
- self.add_copy_spec([
- "/etc/redhat-release",
- "/etc/fedora-release",
- "/var/log/up2date"
- ])
-
- def postproc(self):
- self.do_file_sub("/etc/sysconfig/rhn/up2date",
- r"(\s*proxyPassword\s*=\s*)\S+", r"\1***")
-
-
-class DebianGeneral(General, DebianPlugin):
-
- def setup(self):
- super(DebianGeneral, self).setup()
- self.add_copy_spec([
- "/etc/default",
- "/etc/lsb-release",
- "/etc/debian_version"
- ])
-
-# vim: set et ts=4 sw=4 :
diff --git a/sos/plugins/host.py b/sos/plugins/host.py
new file mode 100644
index 00000000..17d94628
--- /dev/null
+++ b/sos/plugins/host.py
@@ -0,0 +1,41 @@
+# Copyright (C) 2018 Red Hat, Inc. Jake Hunsaker <jhunsake@redhat.com>
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+from sos.plugins import Plugin, RedHatPlugin, DebianPlugin
+
+
+class Host(Plugin, RedHatPlugin, DebianPlugin):
+ '''Host information
+ '''
+
+ plugin_name = 'host'
+ profiles = ('system',)
+
+ def setup(self):
+
+ self.add_cmd_output('hostname', root_symlink='hostname')
+ self.add_cmd_output('uptime', root_symlink='uptime')
+
+ self.add_cmd_output([
+ 'hostname -f',
+ 'hostid',
+ 'hostnamectl status'
+ ])
+
+ self.add_copy_spec([
+ '/etc/sos.conf',
+ '/etc/hostid',
+ ])
diff --git a/sos/plugins/process.py b/sos/plugins/process.py
index 50070a57..98887ec3 100644
--- a/sos/plugins/process.py
+++ b/sos/plugins/process.py
@@ -32,13 +32,20 @@ class Process(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
# process group and thread options
ps_group_opts = "pid,ppid,user,group,lwp,nlwp,start_time,comm,cgroup"
ps_sched_opts = "flags,state,uid,pid,ppid,pgid,sid,cls,pri,addr,sz,"
- ps_sched_opts += "wchan,tty,lstart,time,cmd"
- self.add_copy_spec("/proc/sched_debug")
+ ps_sched_opts += "wchan,lstart,tty,time,cmd"
+
+ self.add_copy_spec([
+ "/proc/sched_debug",
+ "/proc/stat"
+ ])
+
self.add_cmd_output("ps auxwww", root_symlink="ps")
self.add_cmd_output("pstree", root_symlink="pstree")
self.add_cmd_output("lsof -b +M -n -l -c ''", root_symlink="lsof")
+
if self.get_option("lsof-threads") or self.get_option("all_logs"):
self.add_cmd_output("lsof -b +M -n -l")
+
self.add_cmd_output([
"ps auxwwwm",
"ps alxwww",
diff --git a/sos/plugins/lsbrelease.py b/sos/plugins/release.py
index 7854f419..7887ab69 100644
--- a/sos/plugins/lsbrelease.py
+++ b/sos/plugins/release.py
@@ -16,18 +16,28 @@
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
-class LsbRelease(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
- """Linux standard base
+class Release(Plugin, RedHatPlugin, UbuntuPlugin):
+ """Linux release information
"""
- plugin_name = 'lsbrelease'
+ plugin_name = 'release'
profiles = ('system',)
def setup(self):
self.add_cmd_output("lsb_release -a")
- self.add_cmd_output(
- "lsb_release -d", suggest_filename="lsb_release",
- root_symlink="lsb-release")
- self.add_copy_spec("/etc/lsb-release*")
+ self.add_cmd_output("lsb_release -d", suggest_filename="lsb_release",
+ root_symlink="lsb-release")
+
+ self.add_copy_spec([
+ "/etc/*release",
+ "/etc/lsb-release/*"
+ ])
+
+
+class DebianRelease(Release, DebianPlugin):
+
+ def setup(self):
+ super(DebianRelease, self).setup()
+ self.add_copy_spec('/etc/debian_version')
# vim: set et ts=4 sw=4 :
diff --git a/sos/plugins/system.py b/sos/plugins/system.py
index 409462bd..dad5f6d4 100644
--- a/sos/plugins/system.py
+++ b/sos/plugins/system.py
@@ -24,7 +24,12 @@ class System(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
verify_packages = ('glibc', 'initscripts', 'zlib')
def setup(self):
- self.add_copy_spec("/proc/sys")
+ self.add_copy_spec([
+ "/proc/sys",
+ "/etc/sysconfig",
+ "/etc/default",
+ ])
+
self.add_forbidden_path(
"/proc/sys/net/ipv6/neigh/*/retrans_time")
self.add_forbidden_path(