How to use the sos.plugins.UbuntuPlugin function in sos

To help you get started, we’ve selected a few sos examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sosreport / sos / sos / plugins / elastic.py View on Github external
# Copyright (C) 2018 Amit Ghadge 
#
# This file is part of the sos project: https://github.com/sosreport/sos
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# version 2 of the GNU General Public License.
#
# See the LICENSE file in the source distribution for further information.

from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
import re


class Elastic(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
    """
    ElasticSearch service
    """
    plugin_name = 'elastic'
    profiles = ('services', )

    packages = ('elasticsearch',)

    def get_hostname_port(self, els_config_file):
        hostname = "localhost"
        port = "9200"
        try:
            with open(els_config_file) as fread:
                for line in fread:
                    network_host = re.search(r'(^network.host):(.*)', line)
                    network_port = re.search(r'(^http.port):(.*)', line)
github ansible / awx / tools / sosreport / tower.py View on Github external
"/var/log/installer",
    "/var/log/unattended-upgrades",
    "/var/log/apport.log"
]

SOSREPORT_FORBIDDEN_PATHS = [
    "/etc/tower/SECRET_KEY",
    "/etc/tower/tower.key",
    "/etc/tower/awx.key",
    "/etc/tower/tower.cert",
    "/etc/tower/awx.cert",
    "/var/log/tower/profile"
]


class Tower(Plugin, RedHatPlugin, UbuntuPlugin):
    '''Collect Ansible Tower related information'''
    plugin_name = "tower"

    def setup(self):

        for path in SOSREPORT_TOWER_DIRS:
            self.add_copy_spec(path)

        self.add_forbidden_path(SOSREPORT_FORBIDDEN_PATHS)

        self.add_cmd_output(SOSREPORT_TOWER_COMMANDS)
github sosreport / sos / sos / plugins / lvm2.py View on Github external
# This file is part of the sos project: https://github.com/sosreport/sos
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# version 2 of the GNU General Public License.
#
# See the LICENSE file in the source distribution for further information.

from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin


class Lvm2(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
    """LVM2 volume manager
    """

    plugin_name = 'lvm2'
    profiles = ('storage',)

    option_list = [("lvmdump", 'collect an lvmdump tarball', 'fast', False),
                   ("lvmdump-am", 'attempt to collect an lvmdump with '
                    'advanced options and raw metadata collection', 'slow',
                    False)]

    def do_lvmdump(self, metadata=False):
        """Collects an lvmdump in standard format with optional metadata
           archives for each physical volume present.
        """
        lvmdump_path = self.get_cmd_output_path(name="lvmdump", make=False)
github sosreport / sos / sos / plugins / scsi.py View on Github external
# This file is part of the sos project: https://github.com/sosreport/sos
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# version 2 of the GNU General Public License.
#
# See the LICENSE file in the source distribution for further information.

from glob import glob
from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin


class Scsi(Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin):
    """SCSI devices
    """

    plugin_name = 'scsi'
    profiles = ('storage', 'hardware')

    def setup(self):
        self.add_copy_spec([
            "/proc/scsi",
            "/etc/stinit.def",
            "/sys/bus/scsi",
            "/sys/class/scsi_host",
            "/sys/class/scsi_disk",
            "/sys/class/scsi_device",
            "/sys/class/scsi_generic"
        ])
github sosreport / sos / sos / plugins / lightdm.py View on Github external
# Copyright (C) 2015 Red Hat, Inc., Bryn M. Reeves 

# This file is part of the sos project: https://github.com/sosreport/sos
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# version 2 of the GNU General Public License.
#
# See the LICENSE file in the source distribution for further information.

from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin


class LightDm(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
    """Light Display Manager
    """
    packages = ('lightdm', )
    profiles = ('desktop', )
    plugin_name = 'lightdm'

    def setup(self):
        self.add_service_status("lightdm")
        self.add_journal(units="lightdm")
        self.add_copy_spec([
            "/etc/lightdm/lightdm.conf",
            "/etc/lightdm/users.conf"
        ])
        if not self.get_option("all_logs"):
            self.add_copy_spec("/var/log/lightdm/lightdm.log")
            self.add_copy_spec("/var/log/lightdm/x-0-greeter.log")
github sosreport / sos / sos / plugins / systemtap.py View on Github external
# Copyright (C) 2007 Red Hat, Inc., Eugene Teo 

# This file is part of the sos project: https://github.com/sosreport/sos
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# version 2 of the GNU General Public License.
#
# See the LICENSE file in the source distribution for further information.

from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin


class SystemTap(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
    """SystemTap dynamic instrumentation
    """

    plugin_name = 'systemtap'
    profiles = ('debug', 'performance')

    files = ('stap',)
    packages = ('systemtap', 'systemtap-runtime')

    def setup(self):
        self.add_cmd_output([
            "stap -V 2",
            "uname -r",
            "stap-report"
        ])
github sosreport / sos / sos / plugins / opencl.py View on Github external
# This file is part of the sos project: https://github.com/sosreport/sos
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# version 2 of the GNU General Public License.
#
# See the LICENSE file in the source distribution for further information.

from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin


class OpenCL(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
    """OpenCL
    """

    plugin_name = 'opencl'
    profiles = ('hardware', 'desktop', 'gpu')
    files = ('/usr/bin/clinfo',)

    def setup(self):
        self.add_cmd_output([
            "clinfo",
        ])
github sosreport / sos / sos / plugins / openstack_ansible.py View on Github external
# Copyright (C) 2017 Major Hayden 

# This file is part of the sos project: https://github.com/sosreport/sos
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# version 2 of the GNU General Public License.
#
# See the LICENSE file in the source distribution for further information.

from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin


class OpenStackAnsible(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
    """OpenStack-Ansible sos plugin."""

    plugin_name = "openstack_ansible"
    profiles = ('openstack',)
    files = ('/etc/openstack_deploy/',)

    def setup(self):
        """Gathering the contents of the report."""
        self.add_copy_spec([
            "/etc/openstack_deploy/",
            "/etc/openstack-release",
            "/etc/rpc_deploy/",
            "/etc/rpc-release"
        ])

    def postproc(self):
github sosreport / sos / sos / plugins / openstack_horizon.py View on Github external
class DebianHorizon(OpenStackHorizon, DebianPlugin):

    packages = (
        'python-django-horizon',
        'openstack-dashboard',
        'openstack-dashboard-apache'
    )

    def setup(self):
        super(DebianHorizon, self).setup()
        self.add_copy_spec("/etc/apache2/sites-available/")


class UbuntuHorizon(OpenStackHorizon, UbuntuPlugin):

    packages = (
        'python-django-horizon',
        'openstack-dashboard',
        'openstack-dashboard-ubuntu-theme'
    )

    def setup(self):
        super(UbuntuHorizon, self).setup()
        self.add_copy_spec("/etc/apache2/conf.d/openstack-dashboard.conf")


class RedHatHorizon(OpenStackHorizon, RedHatPlugin):

    packages = ('openstack-selinux',)