Obtained contents of sosreport

Background examined

https://github.com/sosreport/sos/wiki/

What is sosreport

implementation of sosreport

Plugin storage location

/usr/lib/python2.7/site-packages/sos/plugins

Plugin implementation

Example: yum plugin source

yum.py


from sos.plugins import Plugin, RedHatPlugin


class Yum(Plugin, RedHatPlugin):
    """yum information
    """

    plugin_name = 'yum'
    profiles = ('system', 'packagemanager', 'sysmgmt')

    files = ('/etc/yum.conf',)
    packages = ('yum',)

    option_list = [
        ("yumlist", "list repositories and packages", "slow", False),
        ("yumdebug", "gather yum debugging data", "slow", False)
    ]

    def setup(self):
        # Pull all yum related information
        self.add_copy_spec([
            "/etc/yum",
            "/etc/yum.repos.d",
            "/etc/yum.conf",
            "/var/log/yum.log"
        ])

        # Get a list of channels the machine is subscribed to.
        self.add_cmd_output("yum -C repolist")

        # candlepin info
        self.add_forbidden_path("/etc/pki/entitlement/key.pem")
        self.add_forbidden_path("/etc/pki/entitlement/*-key.pem")
        self.add_copy_spec([
            "/etc/pki/product/*.pem",
            "/etc/pki/consumer/cert.pem",
            "/etc/pki/entitlement/*.pem"
        ])
        self.add_cmd_output("yum history")

        if self.get_option("yumlist"):
            # List various information about available packages
            self.add_cmd_output("yum list")

        if self.get_option("yumdebug") and self.is_installed('yum-utils'):
            # RHEL6+ alternative for this whole function:
            # self.add_cmd_output("yum-debug-dump '%s'"
            # % os.path.join(self.commons['dstroot'],"yum-debug-dump"))
            r = self.call_ext_prog("yum-debug-dump")
            try:
                self.add_cmd_output("zcat %s" % (r['output'].split()[-1],))
            except IndexError:
                pass

sosreport.py


1240     def setup(self):
1241         msg = "[%s:%s] executing 'sosreport %s'"
1242         self.soslog.info(msg % (__name__, "setup", " ".join(self._args)))
1243         self.ui_log.info(_(" Setting up plugins ..."))
1244         for plugname, plug in self.loaded_plugins:
1245             try:
1246                 plug.archive = self.archive
1247                 plug.setup()
1248             except KeyboardInterrupt:
1249                 raise
1250             except (OSError, IOError) as e:
1251                 if e.errno in fatal_fs_errors:
1252                     self.ui_log.error("")
1253                     self.ui_log.error(" %s while setting up plugins"
1254                                       % e.strerror)
1255                     self.ui_log.error("")
1256                     self._exit(1)
1257                 if self.raise_plugins:
1258                     raise
1259                 self._log_plugin_exception(plugname, "setup")
1260             except:
1261                 if self.raise_plugins:
1262                     raise
1263                 self._log_plugin_exception(plugname, "setup")

Summarizing the above, the implementation of the yum plugin is as follows.

item Contents
profiles system
packagemanager
sysmgmt
Valid conditions /etc/yum.conf exists or when yum package is installed
yumlist option Get the execution result of the yum list command. Default disabled
yumdebug option yum-debug-Get the result of referencing the archive generated by the dump command with the zcat command. Default is disabled
Acquisition file /etc/yum
/etc/yum.repos.d
/etc/yum.conf
/var/log/yum.log
/etc/pki/product/*.pem(*1)
/etc/pki/consumer/cert.pem
/etc/pki/entitlement/*.pem
/etc/pki/entitlement/key.pem
/etc/pki/entitlement/*-key.pem
yum-debug-Reference result by zcat command of archive generated by dump command(*2)
Get command yum -C repolist
yum history
yum list(*3)
/etc/pki/entitlement/key.pem
/etc/pki/entitlement/\*-key.pem

Recommended Posts

Obtained contents of sosreport
Contents of __name__
[Note] Contents of shape [0], shape [1], shape [2]
taichi's Torisetsu ⓪ Table of contents
Simulation of the contents of the wallet
[Linux] [Initial Settings] Table of Contents
yolov5 visualization program table of contents
Easy encryption of file contents (Python)
Contents of HTML escaping process of Jinja2
[Python] [Table of Contents Links] Python Programming
Understand the contents of sklearn's pipeline
[Translation] scikit-learn 0.18 Tutorial Table of Contents
See the contents of Kumantic Segumantion
Python Math Series ⓪ Table of Contents
Github Interesting Repository ⓪ Table of Contents
Introductory table of contents for python3
A memorandum of closure survey contents
I checked the contents of docker volume
2014/02/28 Summary of contents demoed at #ssmjp, part 1
[Translation] scikit-learn 0.18 User Guide Table of Contents
Read all the contents of proc / [pid]