How to use the sos.plugins.Plugin 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 / ceph.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, UbuntuPlugin
from socket import gethostname


class Ceph(Plugin, RedHatPlugin, UbuntuPlugin):
    """CEPH distributed storage
    """

    plugin_name = 'ceph'
    profiles = ('storage', 'virt')
    ceph_hostname = gethostname()

    packages = (
        'ceph',
        'ceph-mds',
        'ceph-common',
        'libcephfs1',
        'ceph-fs-common',
        'calamari-server',
        'librados2'
    )
github sosreport / sos / sos / plugins / system.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 System(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
    """core system information
    """

    plugin_name = "system"
    profiles = ('system', 'kernel')
    verify_packages = ('glibc', 'initscripts', 'zlib')

    def setup(self):
        self.add_copy_spec([
            "/proc/sys",
            "/etc/sysconfig",
            "/etc/default",
            "/etc/environment",
        ])

        # FIXME: provide a a long-term solution for #1299
github sosreport / sos / sos / plugins / lilo.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, UbuntuPlugin


class Lilo(Plugin, RedHatPlugin, UbuntuPlugin):
    """Lilo bootloader
    """

    plugin_name = 'lilo'
    profiles = ('system', 'boot')
    packages = ('lilo',)

    def setup(self):
        self.add_copy_spec("/etc/lilo.conf")
        self.add_cmd_output("lilo -q")
github sosreport / sos / sos / plugins / jboss.py View on Github external
import os
import zipfile
import platform
import fnmatch
import shlex
import subprocess
import string
import grp, pwd

from sos.plugins import Plugin, RedHatPlugin
from sos.utilities import DirTree, find

class jboss(Plugin, RedHatPlugin):
    """JBoss related information
    """

    option_list = [("home",  'JBoss\'s installation dir (i.e. JBOSS_HOME)', '', False),
                  ("javahome",  'Java\'s installation dir (i.e. JAVA_HOME)', '', False),
                  ("profile", 'Quoted and space separated list of server profiles to limit collection. \
Default=\'all default minimal production standard web\'.', '', False),
                  ("user",  'JBoss JMX invoker user to be used with twiddle.', '', False),
                  ("pass",  'JBoss JMX invoker user\'s password to be used with twiddle.', '', False),
                  ("logsize", 'max size (MiB) to collect per log file', '', 15),
                  ("stdjar",  'Collect jar statistics for standard jars.', '', True),
                  ("servjar",  'Collect jar statistics from any server configuration dirs.', '', True),
                  ("twiddle",  'Collect twiddle data.', '', True),
                  ("appxml",  'Quoted and space separated list of application\'s whose XML descriptors you want. The keyword \"all\" will collect all descriptors in the designated profile(s).', '', False)]

    __MD5_CHUNK_SIZE=128
github sosreport / sos / sos / plugins / as7.py View on Github external
import os
import sys
import re
import zipfile
import urllib2
import tempfile
from xml.etree import ElementTree
from itertools import chain

from sos.plugins import Plugin, IndependentPlugin, AS7Mixin
from sos.utilities import DirTree, find, checksum

class AS7(Plugin, IndependentPlugin, AS7Mixin):
    """JBoss related information
    """

    requires_root = False

    version = "1.0"

    option_list = [
          ("home",  "JBoss's installation dir (i.e. JBOSS_HOME)", '', False),
          ("logsize", 'max size (MiB) to collect per log file', '', 15),
          ("stdjar",  'Collect jar statistics for standard jars.', '', True),
          ("host", 'hostname of the management api for jboss', '', 'localhost'),
          ("port", 'port of the management api for jboss', '', '9990'),
          ("user", 'username for management console', '', None),
          ("pass", 'password for management console', '', None),
    ]
github sosreport / sos / sos / plugins / openstack_horizon.py View on Github external
# Copyright (C) 2012 Rackspace US, Inc.,
#                    Justin Shepherd 
# Copyright (C) 2013 Red Hat, Inc., Jeremy Agee 

# 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 OpenStackHorizon(Plugin):
    """OpenStack Horizon
    """

    plugin_name = "openstack_horizon"
    profiles = ('openstack', 'openstack_controller')
    option_list = []
    var_puppet_gen = "/var/lib/config-data/puppet-generated"

    def setup(self):
        if self.get_option("all_logs"):
            self.add_copy_spec([
                "/var/log/horizon/",
            ])
        else:
            self.add_copy_spec([
                "/var/log/horizon/*.log",
github sosreport / sos / sos / plugins / tuned.py View on Github external
# Copyright (C) 2014 Red Hat, Inc., Peter Portante 

# 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


class Tuned(Plugin, RedHatPlugin):
    """Tuned system tuning daemon
    """
    packages = ('tuned',)
    profiles = ('system', 'performance')
    plugin_name = 'tuned'

    def setup(self):
        self.add_cmd_output([
            "tuned-adm list",
            "tuned-adm active",
            "tuned-adm recommend",
            "tuned-adm verify"
        ])
        self.add_copy_spec([
            "/etc/tuned.conf",
            "/etc/tune-profiles"
github sosreport / sos / sos / plugins / named.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
from os.path import exists, join, normpath


class Named(Plugin):
    """BIND named server
    """

    plugin_name = "named"
    profiles = ('system', 'services', 'network')
    named_conf = "/etc/named.conf"
    config_files = named_conf

    def setup(self):
        self.add_copy_spec([
            "/etc/default/bind",
            "/var/log/named*.log"
        ])
        for cfg in self.config_files:
            if exists(cfg):
                self.add_copy_spec([
github sosreport / sos / sos / plugins / iscsitarget.py View on Github external
# Copyright (C) 2007-2012 Red Hat, Inc., Ben Turner 
# Copyright (C) 2012 Adam Stokes 

# 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 IscsiTarget(Plugin):
    """iSCSI target
    """

    plugin_name = "iscsitarget"
    profiles = ('storage',)


class RedHatIscsiTarget(IscsiTarget, RedHatPlugin):

    packages = ('scsi-target-utils',)

    def setup(self):
        super(RedHatIscsiTarget, self).setup()
        self.add_copy_spec("/etc/tgt/targets.conf")
        self.add_cmd_output("tgtadm --lld iscsi --op show --mode target")
github sosreport / sos / sos / plugins / openstack_keystone.py View on Github external
# Copyright (C) 2013 Red Hat, Inc., Jeremy Agee 
# Copyright (C) 2017 Red Hat, Inc., Martin Schuppert 

# 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 os


class OpenStackKeystone(Plugin):
    """OpenStack Keystone
    """
    plugin_name = "openstack_keystone"
    profiles = ('openstack', 'openstack_controller')

    option_list = [("nopw", "dont gathers keystone passwords", "slow", True)]
    var_puppet_gen = "/var/lib/config-data/puppet-generated/keystone"

    def setup(self):
        self.add_copy_spec([
            "/etc/keystone/default_catalog.templates",
            "/etc/keystone/keystone.conf",
            "/etc/keystone/logging.conf",
            "/etc/keystone/policy.json",
            self.var_puppet_gen + "/etc/keystone/*.conf",
            self.var_puppet_gen + "/etc/keystone/*.json",