aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.travis.yml18
-rw-r--r--AUTHORS5
-rw-r--r--Makefile4
-rw-r--r--README.md (renamed from README)20
-rw-r--r--debian/changelog7
-rw-r--r--debian/compat2
-rw-r--r--debian/control15
-rw-r--r--debian/copyright31
-rwxr-xr-xdebian/rules13
-rw-r--r--debian/source/format1
-rw-r--r--sos.conf6
-rw-r--r--sos.spec2
-rw-r--r--sos/archive.py5
-rw-r--r--sos/plugins/__init__.py191
-rw-r--r--sos/plugins/abrt.py8
-rw-r--r--sos/plugins/acpid.py6
-rw-r--r--sos/plugins/amd.py6
-rw-r--r--sos/plugins/anaconda.py2
-rw-r--r--sos/plugins/apache.py6
-rw-r--r--sos/plugins/apparmor.py2
-rw-r--r--sos/plugins/apport.py2
-rw-r--r--sos/plugins/as7.py253
-rw-r--r--sos/plugins/auditd.py9
-rw-r--r--sos/plugins/autofs.py15
-rw-r--r--sos/plugins/bootloader.py6
-rw-r--r--sos/plugins/ceph.py16
-rw-r--r--sos/plugins/cgroups.py7
-rw-r--r--sos/plugins/cloudforms.py6
-rw-r--r--sos/plugins/cluster.py12
-rw-r--r--sos/plugins/cobbler.py6
-rw-r--r--sos/plugins/corosync.py6
-rw-r--r--sos/plugins/crontab.py4
-rw-r--r--sos/plugins/devicemapper.py34
-rw-r--r--sos/plugins/dhcp.py10
-rw-r--r--sos/plugins/dovecot.py7
-rw-r--r--sos/plugins/dpkg.py2
-rw-r--r--sos/plugins/emc.py134
-rw-r--r--sos/plugins/filesys.py22
-rw-r--r--sos/plugins/ftp.py1
-rw-r--r--sos/plugins/general.py21
-rw-r--r--sos/plugins/gluster.py2
-rw-r--r--sos/plugins/hardware.py33
-rw-r--r--sos/plugins/i18n.py2
-rw-r--r--sos/plugins/infiniband.py10
-rw-r--r--sos/plugins/initrd.py2
-rw-r--r--sos/plugins/ipa.py3
-rw-r--r--sos/plugins/iscsi.py6
-rw-r--r--sos/plugins/iscsitarget.py9
-rw-r--r--sos/plugins/jboss.py713
-rw-r--r--sos/plugins/kdump.py1
-rw-r--r--sos/plugins/kernel.py16
-rw-r--r--sos/plugins/kernelrt.py2
-rw-r--r--sos/plugins/kvm.py4
-rw-r--r--sos/plugins/landscape.py3
-rw-r--r--sos/plugins/ldap.py46
-rw-r--r--sos/plugins/libraries.py4
-rw-r--r--sos/plugins/logrotate.py2
-rw-r--r--sos/plugins/lsbrelease.py4
-rw-r--r--sos/plugins/maas.py2
-rw-r--r--sos/plugins/memory.py6
-rw-r--r--sos/plugins/mrggrid.py2
-rw-r--r--sos/plugins/mysql.py20
-rw-r--r--sos/plugins/named.py55
-rw-r--r--sos/plugins/netdump.py1
-rw-r--r--sos/plugins/networking.py96
-rw-r--r--sos/plugins/nfsserver.py4
-rw-r--r--sos/plugins/ntp.py9
-rw-r--r--sos/plugins/openstack.py41
-rw-r--r--sos/plugins/openswan.py5
-rw-r--r--sos/plugins/pam.py8
-rw-r--r--sos/plugins/postfix.py2
-rw-r--r--sos/plugins/postgresql.py42
-rw-r--r--sos/plugins/ppp.py3
-rw-r--r--sos/plugins/printing.py6
-rw-r--r--sos/plugins/process.py17
-rw-r--r--sos/plugins/pxe.py7
-rw-r--r--sos/plugins/qpidd.py18
-rw-r--r--sos/plugins/quagga.py1
-rw-r--r--sos/plugins/radius.py1
-rw-r--r--sos/plugins/rhn.py8
-rw-r--r--sos/plugins/rpm.py6
-rw-r--r--sos/plugins/s390.py19
-rw-r--r--sos/plugins/samba.py9
-rw-r--r--sos/plugins/sar.py4
-rw-r--r--sos/plugins/selinux.py7
-rw-r--r--sos/plugins/smartcard.py8
-rw-r--r--sos/plugins/soundcard.py36
-rw-r--r--sos/plugins/squid.py1
-rw-r--r--sos/plugins/startup.py2
-rw-r--r--sos/plugins/sunrpc.py6
-rw-r--r--sos/plugins/system.py4
-rw-r--r--sos/plugins/systemd.py3
-rw-r--r--sos/plugins/systemtap.py6
-rw-r--r--sos/plugins/sysvipc.py2
-rw-r--r--sos/plugins/tftpserver.py3
-rw-r--r--sos/plugins/vmware.py5
-rw-r--r--sos/plugins/xen.py18
-rw-r--r--sos/plugins/xinetd.py3
-rw-r--r--sos/plugins/yum.py13
-rw-r--r--sos/policies/__init__.py15
-rw-r--r--sos/policies/debian.py6
-rw-r--r--sos/policies/redhat.py18
-rw-r--r--sos/utilities.py1
-rw-r--r--tests/plugin_tests.py26
-rwxr-xr-xtests/test_exe.py2
105 files changed, 684 insertions, 1678 deletions
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 00000000..fafcbd3d
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,18 @@
+language: python
+python:
+ - 2.7
+ - 3.2
+ - 3.3
+ - "pypy"
+matrix:
+ allow_failures:
+ - python: 3.2
+ - python: 3.3
+notifications:
+ email: false
+install:
+ - "pip install nose nose-cov --use-mirrors"
+ - "make gpgkey"
+ - "DESTDIR=. make install"
+script:
+ - "make test"
diff --git a/AUTHORS b/AUTHORS
index 1973fc98..7aeeac4d 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,5 +1,7 @@
-Adam Stokes <astokes@redhat.com>
+Adam Stokes <adam.stokes@ubuntu.com>
Ben Turner <bturner@redhat.com>
+Chris J Arges <chris.j.arges@ubuntu.com>
+Eric Williams <eric.williams@canonical.com>
Eugene Teo <eteo@redhat.com>
Gary Kotton <gkotton@redhat.com>
Jesse Jaggars <jjaggars@redhat.com>
@@ -8,6 +10,7 @@ John Berninger <jwb@redhat.com>
Justin Payne <jpayne@redhat.com>
Keith Kearnan <kearnan_keith@emc.com>
Kent Lamb <klamb@redhat.com>
+Louis Bouchard <louis.bouchard@canonical.com>
Marc Sauton <msauton@redhat.com>
Navid Sheikhol-Eslami <navid@redhat.com>
Pierre Amadio <pamadio@redhat.com>
diff --git a/Makefile b/Makefile
index ead90f52..68557a82 100644
--- a/Makefile
+++ b/Makefile
@@ -48,7 +48,7 @@ install: updateversion
install -m755 sosreport $(DESTDIR)/usr/sbin/sosreport
install -m644 sosreport.1.gz $(DESTDIR)/usr/share/man/man1/.
install -m644 sos.conf.5.gz $(DESTDIR)/usr/share/man/man5/.
- install -m644 LICENSE README $(DESTDIR)/usr/share/$(NAME)/.
+ install -m644 LICENSE README.md $(DESTDIR)/usr/share/$(NAME)/.
install -m644 $(NAME).conf $(DESTDIR)/etc/$(NAME).conf
install -m644 gpgkeys/$(GPG_TPL)support.pub $(DESTDIR)/usr/share/$(NAME)/.
for d in $(SUBDIRS); do make DESTDIR=`cd $(DESTDIR); pwd` -C $$d install; [ $$? = 0 ] || exit 1; done
@@ -58,7 +58,7 @@ updateversion:
$(NAME)-$(VERSION).tar.gz: clean gpgkey
@mkdir -p $(ARCHIVE_DIR)
- @tar -cv sosreport sos doc man po sos.conf LICENSE README sos.spec Makefile | tar -x -C $(ARCHIVE_DIR)
+ @tar -cv sosreport sos doc man po sos.conf LICENSE README.md sos.spec Makefile | tar -x -C $(ARCHIVE_DIR)
@mkdir -p $(ARCHIVE_DIR)/gpgkeys
@cp gpgkeys/$(GPG_TPL)support.pub $(ARCHIVE_DIR)/gpgkeys/.
@tar Ccvzf $(DIST_BUILD_DIR) $(DIST_BUILD_DIR)/$(NAME)-$(VERSION).tar.gz $(NAME)-$(VERSION)
diff --git a/README b/README.md
index b811e46b..dfbe0476 100644
--- a/README
+++ b/README.md
@@ -1,3 +1,5 @@
+[![Build Status](https://travis-ci.org/battlemidget/sosreport.png?branch=master)](https://travis-ci.org/battlemidget/sosreport)
+
This set of tools is designed to provide information to support organizations
in an extensible manner, allowing third parties, package maintainers, and
anyone else to provide plugins that will collect and report information that
@@ -8,15 +10,31 @@ version, to contribute, and for more information, please visit there.
To access to the public source code repository for this project run:
- git clone git://github.com/sosreport/sosreport.git
+```
+git clone git://github.com/sosreport/sosreport.git
+```
+
+### Manual Installation ###
+```
to install locally (as root) ==> make install
to build an rpm ==> make rpm
to build a deb ==> make deb-unsign
to build a zipfile for use with jython ==> make zip
+```
+
+### Pre-built Packaging ###
+
+Fedora/RHEL users install via yum:
+
+```
+yum install sos
+```
Debian/Ubuntu users can install via PPA:
+```
sudo add-apt-repository ppa:debugmonkeys/sosreport
sudo apt-get update
sudo apt-get install sos
+```
diff --git a/debian/changelog b/debian/changelog
index a70f2c54..2f5840cf 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,6 @@
-sos (2.3) unstable; urgency=low
+sosreport (2.3+git20130411-1) unstable; urgency=low
- * Initial release.
+ * Package updated from git rev 1baf743
+ Closes: #698329
- -- Adam Stokes <adam.stokes@canonical.com> Mon, 20 Feb 2012 16:41:39 +0000
+ -- Adam Stokes <adam.stokes@ubuntu.com> Thu, 11 Apr 2013 20:55:56 -0400
diff --git a/debian/compat b/debian/compat
index 45a4fb75..ec635144 100644
--- a/debian/compat
+++ b/debian/compat
@@ -1 +1 @@
-8
+9
diff --git a/debian/control b/debian/control
index 6436a604..d82f284a 100644
--- a/debian/control
+++ b/debian/control
@@ -1,14 +1,15 @@
-Source: sos
-Maintainer: Adam Stokes <adam.stokes@canonical.com>
+Source: sosreport
+Maintainer: Adam Stokes <adam.stokes@ubuntu.com>
Section: python
Priority: optional
-Standards-Version: 3.9.2
-Build-Depends: debhelper (>= 8), python-support, python (>=2.7), gettext
+Standards-Version: 3.9.4
+Build-Depends: debhelper (>= 9), python (>=2.7), gettext, python-nose
+Homepage: https://github.com/sosreport/sosreport
-Package: sos
+Package: sosreport
Architecture: any
-Depends: ${python:Depends}, ${misc:Depends}, python-selinux
-Description: A set of tools to gather troubleshooting information from a system
+Depends: ${python:Depends}, ${misc:Depends}
+Description: Set of tools to gather troubleshooting data from a system
Sos is a set of tools that gathers information about system
hardware and configuration. The information can then be used for
diagnostic purposes and debugging. Sos is commonly used to help
diff --git a/debian/copyright b/debian/copyright
index e69de29b..a7cb4f00 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -0,0 +1,31 @@
+This package was originally debianized by Adam Stokes
+<adam.stokes@ubuntu.com> on Thu Apr 11 18:48:47 EST 2013
+
+It was downloaded from https://github.com/sosreport/sosreport
+
+Author: Bryn Reeves: <bmr@redhat.com>
+ https://github.com/sosreport
+
+Copyright: 2007-2013 Red Hat, Inc.
+
+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 St, Fifth Floor, Boston,
+MA 02110-1301, USA.
+
+On Debian systems, the complete text of the GNU General Public
+License, version 2, can be found in /usr/share/common-licenses/GPL-2.
+
+The Debian packaging is (C) 2012-2013, Adam Stokes <adam.stokes@ubuntu.com>
+and is licensed under the GPL, see above.
+
diff --git a/debian/rules b/debian/rules
index d1b7c05f..9ba428e9 100755
--- a/debian/rules
+++ b/debian/rules
@@ -3,11 +3,8 @@
DH_ALWAYS_EXCLUDE=.git
%:
- dh $@
-
-override_dh_pysupport:
- dh_python2 -p sos
-override_dh_fixperms:
- dh_fixperms -Xsos
-override_dh_auto_test:
-
+ dh $@ --with python2
+
+override_dh_auto_install:
+ dh_auto_install
+ rm -f $(CURDIR)/debian/sosreport/usr/share/sos/LICENSE
diff --git a/debian/source/format b/debian/source/format
new file mode 100644
index 00000000..d3827e75
--- /dev/null
+++ b/debian/source/format
@@ -0,0 +1 @@
+1.0
diff --git a/sos.conf b/sos.conf
index a19b1e56..b5429fe0 100644
--- a/sos.conf
+++ b/sos.conf
@@ -1,8 +1,8 @@
[general]
-ftp_upload_url = ftp://dropbox.redhat.com/incoming
-gpg_keyring = /usr/share/sos/rhsupport.pub
-gpg_recipient = support@redhat.com
+#ftp_upload_url = ftp://example.com/incoming
+#gpg_keyring = /usr/share/sos/rhsupport.pub
+#gpg_recipient = support@redhat.com
smtp_server = None
[plugins]
diff --git a/sos.spec b/sos.spec
index 2f1044f4..9baffb3b 100644
--- a/sos.spec
+++ b/sos.spec
@@ -44,7 +44,7 @@ rm -rf ${RPM_BUILD_ROOT}
%{python_sitelib}/*
%{_mandir}/man1/*
%{_mandir}/man5/*
-%doc README LICENSE
+%doc README.md LICENSE
%config(noreplace) %{_sysconfdir}/sos.conf
%changelog
diff --git a/sos/archive.py b/sos/archive.py
index f837c600..f1b0b057 100644
--- a/sos/archive.py
+++ b/sos/archive.py
@@ -28,6 +28,11 @@ import re
from subprocess import Popen, PIPE, STDOUT
try:
+ import selinux
+except ImportError:
+ pass
+
+try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py
index 6df08fc9..f41964cb 100644
--- a/sos/plugins/__init__.py
+++ b/sos/plugins/__init__.py
@@ -26,15 +26,10 @@
from __future__ import with_statement
from sos.utilities import sos_get_command_output, import_module, grep, fileobj, tail
-from sos import _sos as _
-import inspect
import os
-import sys
-import string
import glob
import re
import traceback
-import shutil
from stat import *
from time import time
from itertools import *
@@ -140,8 +135,8 @@ class Plugin(object):
self.must_exit = False
- self.soslog = self.commons['soslog']
- self.proflog = self.commons['proflog']
+ self.soslog = self.commons['soslog'] if self.commons.has_key('soslog') else logging.getLogger('sos')
+ self.proflog = self.commons['proflog'] if self.commons.has_key('proflog') else logging.getLogger('sosprofile')
# get the option list into a dictionary
for opt in self.option_list:
@@ -246,41 +241,41 @@ class Plugin(object):
return False
def copy_symlink(self, srcpath, sub=None):
- # the target stored in the original symlink
+ # the target stored in the original symlink
linkdest = os.readlink(srcpath)
- # absolute path to the link target
- absdest = os.path.normpath(os.path.join(
- os.path.dirname(srcpath), linkdest))
- # adjust the target used inside the report to always be relative
- if os.path.isabs(linkdest):
- reldest = os.path.relpath(linkdest,
- os.path.dirname(srcpath))
- self.soslog.debug("made link target %s relative as %s"
- % (linkdest, reldest))
- else:
- reldest = linkdest
-
- self.soslog.debug(
- "copying link %s pointing to %s with sub=%s, isdir=%s"
- % (srcpath, linkdest, sub, os.path.isdir(absdest)))
+ # absolute path to the link target
+ absdest = os.path.normpath(os.path.join(
+ os.path.dirname(srcpath), linkdest))
+ # adjust the target used inside the report to always be relative
+ if os.path.isabs(linkdest):
+ reldest = os.path.relpath(linkdest,
+ os.path.dirname(srcpath))
+ self.soslog.debug("made link target %s relative as %s"
+ % (linkdest, reldest))
+ else:
+ reldest = linkdest
+
+ self.soslog.debug(
+ "copying link %s pointing to %s with sub=%s, isdir=%s"
+ % (srcpath, linkdest, sub, os.path.isdir(absdest)))
if os.path.isdir(absdest):
self.soslog.debug("link %s is a directory, skipping..."
- % linkdest)
+ % linkdest)
return
if sub:
old, new = sub
reldest = srcpath.replace(old, new)
- # use the relative target path in the tarball
+ # use the relative target path in the tarball
self.archive.add_link(reldest,srcpath)
- # copy the symlink target translating relative targets
- # to absolute paths to pass to do_copy_file_or_dir.
- self.soslog.debug("normalized link target %s as %s"
- %(linkdest, absdest))
- self.do_copy_file_or_dir(absdest)
+ # copy the symlink target translating relative targets
+ # to absolute paths to pass to do_copy_file_or_dir.
+ self.soslog.debug("normalized link target %s as %s"
+ %(linkdest, absdest))
+ self.do_copy_file_or_dir(absdest)
self.copied_files.append({
'srcpath':srcpath,
@@ -714,142 +709,6 @@ class IndependentPlugin(object):
"""Tagging class that indicates this plugin can run on any platform"""
pass
-class AS7Mixin(object):
- """A mixin class that adds some helpful methods for AS7 related plugins"""
-
- class Request(object):
-
- def __init__(self, resource, operation="read-resource", parameters=None):
- self.resource = resource
- self.operation = operation
- if parameters:
- self.parameters = parameters
- else:
- self.parameters = {}
-
- def url_parts(self):
- """Generator function to split a url into (key, value) tuples. The
- url should contain an even number of pairs. In the case of / the
- generator will immediately stop iteration.
- """
- parts = self.resource.strip("/").split("/")
-
- if parts == ['']:
- raise StopIteration
-
- while parts:
- yield (parts.pop(0), parts.pop(0))
-
- def get_jboss_home(self):
- return self._get_opt('home', 'as7_home') or os.getenv("JBOSS_HOME", None)
-
- def query(self, request_obj):
- try:
- return self.query_java(request_obj)
- except Exception, e:
- self.add_alert("JBOSS API call failed, falling back to HTTP: %s" % e)
- return self.query_http(request_obj)
-
- def _get_opt(self, first, second, default=None):
- val = self.get_option(first)
- if val:
- return val
- val = self.get_option(second)
- if val:
- return val
- return default
-
- def query_java(self, request_obj):
- from org.jboss.dmr import ModelNode
- controller_client = self.get_option('controller_client_proxy')
- if not controller_client:
- raise AttributeError("Controller Client is not available")
-
- request = ModelNode()
- request.get("operation").set(request_obj.operation)
-
- for key, val in request_obj.url_parts():
- request.get('address').add(key,val)
-
- if request_obj.parameters:
- for key, value in request_obj.parameters.iteritems():
- request.get(key).set(value)
-
- return controller_client.execute(request).toJSONString(True)
-
- def query_http(self, request_obj, postdata=None):
- host = self._get_opt('host', 'as7_host')
- port = self._get_opt('port', 'as7_port')
-
- username = self._get_opt('user', 'as7_user')
- password = self._get_opt('pass', 'as7_pass')
-
- uri = "http://%s:%s/management" % (host,port)
-
- json_data = {'operation': request_obj.operation,
- 'address': []}
-
- for key, val in request_obj.url_parts():
- json_data['address'].append({key:val})
-
- for key, val in request_obj.parameters.iteritems():
- json_data[key] = val
-
- postdata = json.dumps(json_data)
- headers = {'Content-Type': 'application/json',
- 'Accept': 'application/json'}
-
- opener = urllib2.build_opener()
-
- if username and password:
- passwd_manager = urllib2.HTTPPasswordMgrWithDefaultRealm()
- passwd_manager.add_password(realm="ManagementRealm",
- uri=uri,
- user=username,
- passwd=password)
- digest_auth_handler = urllib2.HTTPDigestAuthHandler(passwd_manager)
- basic_auth_handler = urllib2.HTTPBasicAuthHandler(passwd_manager)
-
- opener.add_handler(digest_auth_handler)
- opener.add_handler(basic_auth_handler)
-
- req = urllib2.Request(uri, data=postdata, headers=headers)
-
- try:
- resp = opener.open(req)
- return resp.read()
- except Exception, e:
- err_msg = "Could not query url: %s; error: %s" % (uri, e)
- self.add_alert(err_msg)
- return err_msg
-
- def set_domain_info(self, parameters=None):
- """This function will add host controller and server instance name data
- if it is present to the desired resource. This is to support
- domain-mode operation in AS7.
- """
- host_controller_name = self.get_option("as7_host_controller_name")
- server_name = self.get_option("as7_server_name")
-
- if host_controller_name and server_name:
- if not parameters:
- parameters = {}
-
- parameters['host'] = host_controller_name
- parameters['server'] = server_name
-
- return parameters
-
-
- def resource_to_file(self, resource=None, parameters=None, operation='read-resource', outfile=None):
- parameters = self.set_domain_info(parameters)
-
- r = self.Request(resource=resource,
- parameters=parameters,
- operation=operation)
- self.add_string_as_file(self.query(r), filename=outfile)
-
-
def import_plugin(name, superclasses=None):
"""Import name as a module and return a list of all classes defined in that
module. superclasses should be a tuple of valid superclasses to import,
diff --git a/sos/plugins/abrt.py b/sos/plugins/abrt.py
index ce5c7c10..9437c562 100644
--- a/sos/plugins/abrt.py
+++ b/sos/plugins/abrt.py
@@ -17,7 +17,7 @@
from sos.plugins import Plugin, RedHatPlugin
from os.path import exists
-class abrt(Plugin, RedHatPlugin):
+class Abrt(Plugin, RedHatPlugin):
"""ABRT log dump
"""
@@ -28,16 +28,16 @@ class abrt(Plugin, RedHatPlugin):
exists("/var/spool/abrt")
def do_backtraces(self):
- ret, output, rtime = self.call_ext_prog('/usr/bin/sqlite3 /var/spool/abrt/abrt-db \'select UUID from abrt_v4\'')
+ ret, output, rtime = self.call_ext_prog('sqlite3 /var/spool/abrt/abrt-db \'select UUID from abrt_v4\'')
try:
for uuid in output.split():
- self.add_cmd_output("/usr/bin/abrt-cli -ib %s" % uuid,
+ self.add_cmd_output("abrt-cli -ib %s" % uuid,
suggest_filename=("backtrace_%s" % uuid))
except IndexError:
pass
def setup(self):
- self.add_cmd_output("/usr/bin/abrt-cli -lf",
+ self.add_cmd_output("abrt-cli -lf",
suggest_filename="abrt-log")
if self.get_option('backtraces'):
self.do_backtraces()
diff --git a/sos/plugins/acpid.py b/sos/plugins/acpid.py
index c49da2d3..9a2d1236 100644
--- a/sos/plugins/acpid.py
+++ b/sos/plugins/acpid.py
@@ -14,10 +14,10 @@
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
-class acpid(Plugin):
+class Acpid(Plugin):
plugin_name = "acpid"
-class RedHatAcpid(acpid, RedHatPlugin):
+class RedHatAcpid(Acpid, RedHatPlugin):
"""acpid related information
"""
def setup(self):
@@ -25,7 +25,7 @@ class RedHatAcpid(acpid, RedHatPlugin):
"/var/log/acpid*",
"/etc/acpi/events/power.conf"])
-class DebianAcpid(acpid, DebianPlugin, UbuntuPlugin):
+class DebianAcpid(Acpid, DebianPlugin, UbuntuPlugin):
"""acpid related information for Debian and Ubuntu
"""
def setup(self):
diff --git a/sos/plugins/amd.py b/sos/plugins/amd.py
index d13f0db0..4ecb8f54 100644
--- a/sos/plugins/amd.py
+++ b/sos/plugins/amd.py
@@ -16,7 +16,7 @@
from sos.plugins import Plugin, RedHatPlugin
-class amd(Plugin, RedHatPlugin):
+class Amd(Plugin, RedHatPlugin):
"""Amd automounter information
"""
files = ('/etc/rc.d/init.d/amd',)
@@ -24,5 +24,5 @@ class amd(Plugin, RedHatPlugin):
def setup(self):
self.add_copy_specs("/etc/amd.*")
- self.add_cmd_output("/bin/egrep -e 'automount|pid.*nfs' /proc/mounts")
- self.add_cmd_output("/bin/mount | egrep -e 'automount|pid.*nfs'")
+ self.add_cmd_output("egrep -e 'automount|pid.*nfs' /proc/mounts")
+ self.add_cmd_output("mount | egrep -e 'automount|pid.*nfs'")
diff --git a/sos/plugins/anaconda.py b/sos/plugins/anaconda.py
index 2a6d9983..dd5f9760 100644
--- a/sos/plugins/anaconda.py
+++ b/sos/plugins/anaconda.py
@@ -15,7 +15,7 @@
from sos.plugins import Plugin, RedHatPlugin
import os
-class anaconda(Plugin, RedHatPlugin):
+class Anaconda(Plugin, RedHatPlugin):
"""Anaconda / Installation information
"""
diff --git a/sos/plugins/apache.py b/sos/plugins/apache.py
index 0076534f..d889125a 100644
--- a/sos/plugins/apache.py
+++ b/sos/plugins/apache.py
@@ -14,14 +14,14 @@
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
-class apache(Plugin):
+class Apache(Plugin):
"""Apache related information
"""
plugin_name = "apache"
option_list = [("log", "gathers all apache logs", "slow", False)]
-class RedHatApache(apache, RedHatPlugin):
+class RedHatApache(Apache, RedHatPlugin):
"""Apache related information for Red Hat distributions
"""
files = ('/etc/httpd/conf/httpd.conf',)
@@ -38,7 +38,7 @@ class RedHatApache(apache, RedHatPlugin):
if self.get_option("log"):
self.add_copy_spec("/var/log/httpd/*")
-class DebianApache(apache, DebianPlugin, UbuntuPlugin):
+class DebianApache(Apache, DebianPlugin, UbuntuPlugin):
"""Apache related information for Debian distributions
"""
files = ('/etc/apache2/apache2.conf',)
diff --git a/sos/plugins/apparmor.py b/sos/plugins/apparmor.py
index cae61c19..29ea02a9 100644
--- a/sos/plugins/apparmor.py
+++ b/sos/plugins/apparmor.py
@@ -15,7 +15,7 @@
from sos.plugins import Plugin, UbuntuPlugin
-class apparmor(Plugin, UbuntuPlugin):
+class Apparmor(Plugin, UbuntuPlugin):
"""Apparmor related information
"""
def setup(self):
diff --git a/sos/plugins/apport.py b/sos/plugins/apport.py
index 7ae319cc..f565261d 100644
--- a/sos/plugins/apport.py
+++ b/sos/plugins/apport.py
@@ -15,7 +15,7 @@
from sos.plugins import Plugin, DebianPlugin, UbuntuPlugin
-class apport(Plugin, DebianPlugin, UbuntuPlugin):
+class Apport(Plugin, DebianPlugin, UbuntuPlugin):
"""apport information
"""
def setup(self):
diff --git a/sos/plugins/as7.py b/sos/plugins/as7.py
deleted file mode 100644
index 52f71203..00000000
--- a/sos/plugins/as7.py
+++ /dev/null
@@ -1,253 +0,0 @@
-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),
- ]
-
- __MD5_CHUNK_SIZE=128
- __jbossHome=None
- __haveJava=False
- __twiddleCmd=None
- __jbossServerConfigDirs = ["standalone", "domain"]
- __jbossHTMLBody=None
-
- def __alert(self, msg):
- self.soslog.error(msg)
- self.add_alert(msg)
-
- def __getJbossHome(self):
-
- self.__jbossHome = self.get_jboss_home()
- if not self.__jbossHome:
- self.add_alert("ERROR: The JBoss installation directory was not supplied.\
- The JBoss SOS plug-in cannot continue.")
- return False
-
- self.add_alert("INFO: The JBoss installation directory supplied to SOS is " +
- self.__jbossHome)
- return True
-
-
- def __getMd5(self, file):
- """Returns the MD5 sum of the specified file."""
-
- retVal = "?" * 32
-
- try:
- retVal = checksum(file, self.__MD5_CHUNK_SIZE)
- except IOError, ioe:
- self.__alert("ERROR: Unable to open %s for reading. Error: %s" % (file,ioe))
-
- return retVal
-
- def __getManifest(self, jarFile):
- """
- Given a jar file, this function will extract the Manifest and return it's contents
- as a string.
- """
- manifest = None
- try:
- zf = zipfile.ZipFile(jarFile)
- try:
- manifest = zf.read("META-INF/MANIFEST.MF")
- except Exception, e:
- self.__alert("ERROR: reading manifest from %s. Error: %s" % (jarFile, e))
- zf.close()
- except Exception, e:
- self.__alert("ERROR: reading contents of %s. Error: %s" % (jarFile, e))
- return manifest
-
- def __getStdJarInfo(self):
- jar_info_list = []
-
- for jarFile in find("*.jar", self.__jbossHome):
- checksum = self.__getMd5(jarFile)
- manifest = self.__getManifest(jarFile)
- path = jarFile.replace(self.__jbossHome, 'JBOSSHOME')
- if manifest:
- manifest = manifest.strip()
- jar_info_list.append((path, checksum, manifest))
-
- if jar_info_list:
- jar_info_list.sort()
- self.add_string_as_file("\n".join([
- "%s\n%s\n%s\n===\n" % (name, checksum, manifest)
- for (name, checksum, manifest) in jar_info_list]),
- 'jarinfo.txt')
- else:
- self.add_alert("WARN: No jars found in JBoss system path (" + self.__jbossHome + ").")
-
- def get_online_data(self):
- """
- This function co-locates calls to the management api that gather
- information from a running system.
- """
- self.resource_to_file(resource="/",
- parameters={"recursive": "true"},
- outfile="configuration.json")
- self.resource_to_file(resource="/core-service/service-container",
- operation="dump-services",
- outfile="dump-services.json")
- self.resource_to_file(resource="/subsystem/modcluster",
- operation="read-proxies-configuration",
- outfile="cluster-proxies-configuration.json")
- self.resource_to_file(resource="/core-service/platform-mbean/type/threading",
- operation="dump-all-threads",
- parameters={"locked-synchronizers": "true",
- "locked-monitors": "true"},
- outfile="threaddump.json")
-
- def __getFiles(self, configDirAry):
- """
- This function will collect files from JBOSS_HOME for analysis. The scope of files to
- be collected are determined by options to this SOS plug-in.
- """
- for dir_ in configDirAry:
- path = os.path.join(self.__jbossHome, dir_)
- ## First add forbidden files
- self.add_forbidden_path(os.path.join(path, "tmp"))
- self.add_forbidden_path(os.path.join(path, "work"))
- self.add_forbidden_path(os.path.join(path, "data"))
-
- if os.path.exists(path):
- ## First get everything in the conf dir
- confDir = os.path.join(path, "configuration")
- self.add_forbidden_path(os.path.join(confDir, 'mgmt-users.properties'))
- self.add_forbidden_path(os.path.join(confDir, 'application-users.properties'))
-
- for logFile in find("*.log", path):
- self.add_copy_spec_limit(logFile,
- self.get_option("logsize"),
- sub=(self.__jbossHome, 'JBOSSHOME'))
-
- for xml in find("*.xml", path):
- self.add_copy_spec(xml, sub=(self.__jbossHome, 'JBOSSHOME'))
-
- for prop in find("*.properties", path):
- self.add_copy_spec(prop, sub=(self.__jbossHome, 'JBOSSHOME'))
-
- deployment_info = self.__get_deployment_info(confDir)
- deployments = self.__get_deployments(path)
- for deployment in deployments:
- self.__get_listing_from_deployment(deployment, deployment_info)
-
- for xml in find("*.xml", os.path.join(self.__jbossHome, 'modules')):
- self.add_copy_spec(xml, sub=(self.__jbossHome, 'JBOSSHOME'))
-
- def __get_deployment_info(self, dir_):
- """Gets the deployment name to sha1 mapping for all deployments defined
- in configs under dir_"""
- deployment_info = {}
- for config in find("*.xml", dir_):
- root = ElementTree.parse(config).getroot()
- # the namespace is harder to fetch than it should be
- ns = root.tag.rpartition("}")[0]
- ns += "}"
- for deployment in root.findall("./%sdeployments/%sdeployment" % (ns, ns)):
- name = deployment.attrib.get("name")
- sha1 = deployment.getchildren()[0].attrib.get("sha1")
- deployment_info[sha1] = name
- return deployment_info
-
- def __get_deployments(self, path):
- return list(chain(
- find("*", os.path.join(path, "deployments")),
- find("content", path)))
-
- def __get_listing_from_deployment(self, path, mapping):
- try:
- zf = zipfile.ZipFile(path)
- contents = []
- for zipinfo in zf.infolist():
- if zipinfo.filename.endswith("/"):
- continue
- contents.append((zipinfo.filename, zipinfo.file_size))
- zf.close()
- contents.sort()
- output = "\n".join(["%s:%d" % (fn, fs) for fn, fs in contents])
-
- path_to = path.replace(self.__jbossHome, '')
- if 'content' in path:
- path_to = path_to.strip(os.path.sep).rstrip("content")
- path_to = os.path.join(*path_to.split(os.path.sep)[:-2])
- sha1 = "".join(path.split(os.path.sep)[-3:-1])
- name = mapping.get(sha1, sha1)
- else:
- path_to, name = os.path.split(path_to)
-
- self.add_string_as_file(output, os.path.join(path_to, "%s.txt" % name))
- except:
- # this is probably not a zipfile so we don't care
- pass
-
- def check_enabled(self):
- return self.__getJbossHome()
-
- def setup(self):
-
- if not self.__getJbossHome():
- self.exit_please()
-
- try:
- self.get_online_data()
- except urllib2.URLError:
- pass
-
- if self.get_option("stdjar"):
- self.__getStdJarInfo()
-
- tree = DirTree(self.__jbossHome).as_string()
- self.add_string_as_file(tree, "jboss_home_tree.txt")
-
- self.__getFiles(self.__jbossServerConfigDirs)
-
- def postproc(self):
- """
- Obfuscate passwords.
- """
-
- password_xml_regex = re.compile(r'<password>.*</password>', re.IGNORECASE)
-
- for dir_ in self.__jbossServerConfigDirs:
- path = os.path.join(self.__jbossHome, dir_)
-
- self.do_file_sub(os.path.join(path,"configuration","*.xml"),
- password_xml_regex,
- r'<password>********</password>')
-
- tmp = os.path.join(path,"configuration")
- for propFile in find("*-users.properties", tmp):
- self.do_file_sub(propFile,
- r"=(.*)",
- r'=********')
-
-# Remove PW from -ds.xml files
- tmp = os.path.join(path, "deployments")
- for dsFile in find("*-ds.xml", tmp):
- self.do_file_sub(dsFile,
- password_xml_regex,
- r"<password>********</password>")
diff --git a/sos/plugins/auditd.py b/sos/plugins/auditd.py
index e15c0a60..6bc6bf49 100644
--- a/sos/plugins/auditd.py
+++ b/sos/plugins/auditd.py
@@ -18,8 +18,11 @@ class auditd(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""Auditd related information
"""
- option_list = [("syslogsize", "max size (MiB) to collect per syslog file", "", 15)]
+ option_list = [("logsize", "maximum size (MiB) of logs to collect",
+ "", 15)]
def setup(self):
- self.add_copy_specs(["/etc/audit/auditd.conf", "/etc/audit/audit.rules"])
- self.add_copy_spec_limit("/var/log/audit*", sizelimit = self.get_option("syslogsize"))
+ self.add_copy_specs(["/etc/audit/auditd.conf",
+ "/etc/audit/audit.rules"])
+ self.add_copy_spec_limit("/var/log/audit*",
+ sizelimit = self.get_option("syslogsize"))
diff --git a/sos/plugins/autofs.py b/sos/plugins/autofs.py
index abf90b0f..b1d264ba 100644
--- a/sos/plugins/autofs.py
+++ b/sos/plugins/autofs.py
@@ -15,9 +15,8 @@
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin
-import os, re
-class autofs(Plugin):
+class Autofs(Plugin):
"""autofs server-related information
"""
@@ -48,21 +47,21 @@ class autofs(Plugin):
self.add_copy_spec("/etc/auto*")
self.add_cmd_output("/etc/init.d/autofs status")
self.add_cmd_output("ps auxwww | grep automount")
- self.add_cmd_output("/bin/egrep -e 'automount|pid.*nfs' /proc/mounts")
- self.add_cmd_output("/bin/mount | egrep -e 'automount|pid.*nfs'")
+ self.add_cmd_output("egrep -e 'automount|pid.*nfs' /proc/mounts")
+ self.add_cmd_output("mount | egrep -e 'automount|pid.*nfs'")
if self.checkdebug():
self.add_copy_spec(self.getdaemondebug())
-class RedHatAutofs(autofs, RedHatPlugin):
+class RedHatAutofs(Autofs, RedHatPlugin):
"""autofs server-related on RedHat based distributions"""
def setup(self):
super(RedHatAutofs, self).setup()
- self.add_cmd_output("/bin/rpm -qV autofs")
+ self.add_cmd_output("rpm -qV autofs")
-class DebianAutofs(autofs, DebianPlugin, UbuntuPlugin):
+class DebianAutofs(Autofs, DebianPlugin, UbuntuPlugin):
"""autofs server-related on Debian based distributions"""
def setup(self):
super(DebianAutofs, self).setup()
- self.add_cmd_output("/usr/bin/dpkg-query -s autofs")
+ self.add_cmd_output("dpkg-query -s autofs")
diff --git a/sos/plugins/bootloader.py b/sos/plugins/bootloader.py
index 80a2f705..3b3d2124 100644
--- a/sos/plugins/bootloader.py
+++ b/sos/plugins/bootloader.py
@@ -14,7 +14,7 @@
from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin
-class bootloader(Plugin, RedHatPlugin, UbuntuPlugin):
+class Bootloader(Plugin, RedHatPlugin, UbuntuPlugin):
"""Bootloader information
"""
def setup(self):
@@ -27,5 +27,5 @@ class bootloader(Plugin, RedHatPlugin, UbuntuPlugin):
"/boot/grub/device.map",
"/etc/grub.d",
"/boot/yaboot.conf"])
- self.add_cmd_output("/sbin/lilo -q")
- self.add_cmd_output("/bin/ls -lanR /boot")
+ self.add_cmd_output("lilo -q")
+ self.add_cmd_output("ls -lanR /boot")
diff --git a/sos/plugins/ceph.py b/sos/plugins/ceph.py
index 7ee3bc07..fbcee784 100644
--- a/sos/plugins/ceph.py
+++ b/sos/plugins/ceph.py
@@ -14,7 +14,7 @@
from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin
-class ceph(Plugin, RedHatPlugin, UbuntuPlugin):
+class Ceph(Plugin, RedHatPlugin, UbuntuPlugin):
"""information on CEPH
"""
option_list = [("log", "gathers all ceph logs", "slow", False)]
@@ -29,11 +29,11 @@ class ceph(Plugin, RedHatPlugin, UbuntuPlugin):
self.add_copy_specs(["/etc/ceph/",
"/var/log/ceph/"])
- self.add_cmd_output("/usr/bin/ceph status")
- self.add_cmd_output("/usr/bin/ceph health")
- self.add_cmd_output("/usr/bin/ceph osd tree")
- self.add_cmd_output("/usr/bin/ceph osd stat")
- self.add_cmd_output("/usr/bin/ceph osd dump")
- self.add_cmd_output("/usr/bin/ceph mon stat")
- self.add_cmd_output("/usr/bin/ceph mon dump")
+ self.add_cmd_output("ceph status")
+ self.add_cmd_output("ceph health")
+ self.add_cmd_output("ceph osd tree")
+ self.add_cmd_output("ceph osd stat")
+ self.add_cmd_output("ceph osd dump")
+ self.add_cmd_output("ceph mon stat")
+ self.add_cmd_output("ceph mon dump")
diff --git a/sos/plugins/cgroups.py b/sos/plugins/cgroups.py
index 72344c2f..102b71c4 100644
--- a/sos/plugins/cgroups.py
+++ b/sos/plugins/cgroups.py
@@ -14,13 +14,13 @@
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
-class cgroups(Plugin):
+class Cgroups(Plugin):
"""cgroup subsystem information
"""
plugin_name = "cgroups"
-class DebianCgroups(cgroups, DebianPlugin, UbuntuPlugin):
+class DebianCgroups(Cgroups, DebianPlugin, UbuntuPlugin):
files = ('/proc/cgroups',)
@@ -29,7 +29,7 @@ class DebianCgroups(cgroups, DebianPlugin, UbuntuPlugin):
"/sys/fs/cgroup"])
return
-class RedHatCgroups(cgroups, RedHatPlugin):
+class RedHatCgroups(Cgroups, RedHatPlugin):
"""Red Hat specific cgroup subsystem information
"""
@@ -39,5 +39,4 @@ class RedHatCgroups(cgroups, RedHatPlugin):
"/etc/cgsnapshot_blacklist.conf",
"/etc/cgconfig.conf",
"/etc/cgrules.conf"])
- cgroups.setup(self)
diff --git a/sos/plugins/cloudforms.py b/sos/plugins/cloudforms.py
index aa2b2090..3a11cc42 100644
--- a/sos/plugins/cloudforms.py
+++ b/sos/plugins/cloudforms.py
@@ -16,18 +16,18 @@
from sos.plugins import Plugin, RedHatPlugin
import os
-class cloudforms(Plugin, RedHatPlugin):
+class Cloudforms(Plugin, RedHatPlugin):
"""CloudForms related information
"""
packages = ["katello", "katello-common",
"katello-headpin", "aeoleus-conductor"]
files = ["/usr/share/katello/script/katello-debug",
- "/usr/bin/aeolus-debug"]
+ "aeolus-debug"]
def setup(self):
katello_debug = "/usr/share/katello/script/katello-debug"
- aeolus_debug = "/usr/bin/aeolus-debug"
+ aeolus_debug = "aeolus-debug"
if os.path.isfile(katello_debug):
katello_debug_path = os.path.join(self.commons['dstroot'],"katello-debug")
self.add_cmd_output("%s --notar -d %s" % (katello_debug, katello_debug_path))
diff --git a/sos/plugins/cluster.py b/sos/plugins/cluster.py
index 2383b370..e31a295b 100644
--- a/sos/plugins/cluster.py
+++ b/sos/plugins/cluster.py
@@ -13,10 +13,10 @@
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin
-import os, re
+import re
from glob import glob
-class cluster(Plugin, RedHatPlugin):
+class Cluster(Plugin, RedHatPlugin):
"""cluster suite and GFS related information
"""
@@ -65,20 +65,20 @@ class cluster(Plugin, RedHatPlugin):
if self.get_option('lockdump'):
self.do_lockdump()
- self.add_cmd_output("/usr/sbin/rg_test test "
+ self.add_cmd_output("rg_test test "
+ "/etc/cluster/cluster.conf" )
self.add_cmd_output("fence_tool ls -n")
self.add_cmd_output("gfs_control ls -n")
self.add_cmd_output("dlm_tool log_plock")
- self.add_cmd_output("/sbin/fdisk -l")
+ self.add_cmd_output("fdisk -l")
self.get_cmd_output_now("clustat")
self.get_cmd_output_now("group_tool dump")
self.add_cmd_output("cman_tool services")
self.add_cmd_output("cman_tool nodes")
self.add_cmd_output("cman_tool status")
self.add_cmd_output("ccs_tool lsnode")
- self.add_cmd_output("/sbin/ipvsadm -L")
+ self.add_cmd_output("ipvsadm -L")
if rhelver is 4:
self.add_copy_spec("/proc/cluster/*")
@@ -135,7 +135,7 @@ class cluster(Plugin, RedHatPlugin):
def do_gfslockdump(self):
for mntpoint in self.do_regex_find_all(r'^\S+\s+([^\s]+)\s+gfs\s+.*$',
"/proc/mounts"):
- self.add_cmd_output("/sbin/gfs_tool lockdump %s" % mntpoint,
+ self.add_cmd_output("gfs_tool lockdump %s" % mntpoint,
suggest_filename = "gfs_lockdump_"
+ self.mangle_command(mntpoint))
diff --git a/sos/plugins/cobbler.py b/sos/plugins/cobbler.py
index 3d8c9faf..e3d289e2 100644
--- a/sos/plugins/cobbler.py
+++ b/sos/plugins/cobbler.py
@@ -14,10 +14,10 @@
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
-class cobbler(Plugin):
+class Cobbler(Plugin):
plugin_name = "cobbler"
-class RedHatCobbler(cobbler, RedHatPlugin):
+class RedHatCobbler(Cobbler, RedHatPlugin):
"""cobbler related information
"""
@@ -29,7 +29,7 @@ class RedHatCobbler(cobbler, RedHatPlugin):
self.add_copy_spec("/var/lib/rhn/kickstarts")
self.add_copy_spec("/var/lib/cobbler")
-class DebianCobbler(cobbler, DebianPlugin, UbuntuPlugin):
+class DebianCobbler(Cobbler, DebianPlugin, UbuntuPlugin):
"""cobbler related information for Debian and Ubuntu
"""
diff --git a/sos/plugins/corosync.py b/sos/plugins/corosync.py
index eecbde5b..79333c2f 100644
--- a/sos/plugins/corosync.py
+++ b/sos/plugins/corosync.py
@@ -19,7 +19,6 @@ class Corosync(Plugin):
"""
plugin_name = "corosync"
-
packages = ('corosync',)
def setup(self):
@@ -32,8 +31,8 @@ class Corosync(Plugin):
self.add_cmd_output("corosync-cpgtool")
self.add_cmd_output("corosync-objctl -a")
self.add_cmd_output("corosync-fplay")
- self.add_cmd_output("/usr/sbin/corosync-objctl -w runtime.blackbox.dump_state=$(date +\%s)")
- self.add_cmd_output("/usr/sbin/corosync-objctl -w runtime.blackbox.dump_flight_data=$(date +\%s)")
+ self.add_cmd_output("corosync-objctl -w runtime.blackbox.dump_state=$(date +\%s)")
+ self.add_cmd_output("corosync-objctl -w runtime.blackbox.dump_flight_data=$(date +\%s)")
self.call_ext_prog("killall -USR2 corosync")
class RedHatCorosync(Corosync, RedHatPlugin):
@@ -43,7 +42,6 @@ class RedHatCorosync(Corosync, RedHatPlugin):
def setup(self):
super(RedHatCorosync, self).setup()
- files = ('/usr/bin/corosync',)
class DebianCorosync(Corosync, DebianPlugin, UbuntuPlugin):
""" corosync information for Debian and Ubuntu distributions
diff --git a/sos/plugins/crontab.py b/sos/plugins/crontab.py
index e5323ba2..bcbb315d 100644
--- a/sos/plugins/crontab.py
+++ b/sos/plugins/crontab.py
@@ -22,7 +22,7 @@ class crontab(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
def setup(self):
self.add_copy_spec("/etc/cron*")
- self.add_cmd_output("/usr/bin/crontab -l -u root", suggest_filename = "root_crontab")
+ self.add_cmd_output("crontab -l -u root", suggest_filename = "root_crontab")
self.add_cmd_output("""for i in `ls /home/`;\
- do echo "User :" $i;/usr/bin/crontab -l -u $i;\
+ do echo "User :" $i;crontab -l -u $i;\
echo "---------------";done""", suggest_filename = "users_crontabs")
diff --git a/sos/plugins/devicemapper.py b/sos/plugins/devicemapper.py
index fbfe84d6..5a3e027c 100644
--- a/sos/plugins/devicemapper.py
+++ b/sos/plugins/devicemapper.py
@@ -32,30 +32,30 @@ class devicemapper(Plugin, RedHatPlugin):
self.add_cmd_output(cmd)
def setup(self):
- self.add_cmd_output("/sbin/dmsetup info -c")
- self.add_cmd_output("/sbin/dmsetup table")
- self.add_cmd_output("/sbin/dmsetup status")
- self.add_cmd_output("/sbin/dmsetup ls --tree")
+ self.add_cmd_output("dmsetup info -c")
+ self.add_cmd_output("dmsetup table")
+ self.add_cmd_output("dmsetup status")
+ self.add_cmd_output("dmsetup ls --tree")
- self.add_cmd_output("/sbin/vgdisplay -vv", root_symlink = "vgdisplay")
- self.add_cmd_output("/sbin/vgscan -vvv")
- self.add_cmd_output("/sbin/pvscan -v")
- self.add_cmd_output("/sbin/lvs -a -o +devices")
- self.add_cmd_output("/sbin/pvs -a -v")
- self.add_cmd_output("/sbin/vgs -v")
- self.add_cmd_output("/sbin/mdadm -D /dev/md*")
+ self.add_cmd_output("vgdisplay -vv", root_symlink = "vgdisplay")
+ self.add_cmd_output("vgscan -vvv")
+ self.add_cmd_output("pvscan -v")
+ self.add_cmd_output("lvs -a -o +devices")
+ self.add_cmd_output("pvs -a -v")
+ self.add_cmd_output("vgs -v")
+ self.add_cmd_output("mdadm -D /dev/md*")
self.add_copy_specs([
"/etc/lvm",
"/etc/multipath/",
"/etc/multipath.conf",
"/var/lib/multipath/bindings"])
- self.add_cmd_output("/sbin/multipath -v4 -ll")
+ self.add_cmd_output("multipath -v4 -ll")
- self.add_cmd_output("/usr/bin/systool -v -c -b scsi")
+ self.add_cmd_output("systool -v -c -b scsi")
- self.add_cmd_output("/bin/ls -lanR /dev")
- self.add_cmd_output("/bin/ls -lanR /sys/block")
+ self.add_cmd_output("ls -lanR /dev")
+ self.add_cmd_output("ls -lanR /sys/block")
if self.get_option('lvmdump'):
self.do_lvmdump()
@@ -64,6 +64,6 @@ class devicemapper(Plugin, RedHatPlugin):
for disk in os.listdir("/sys/block"):
if disk in [ ".", ".." ] or disk.startswith("ram"):
continue
- self.add_cmd_output("/usr/bin/udevinfo -ap /sys/block/%s" % (disk))
+ self.add_cmd_output("udevinfo -ap /sys/block/%s" % (disk))
for opt in self.dmraid_options:
- self.add_cmd_output("/sbin/dmraid -%s" % (opt,))
+ self.add_cmd_output("dmraid -%s" % (opt,))
diff --git a/sos/plugins/dhcp.py b/sos/plugins/dhcp.py
index ccddd75d..71946c2b 100644
--- a/sos/plugins/dhcp.py
+++ b/sos/plugins/dhcp.py
@@ -14,32 +14,32 @@
from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin
-class dhcp(Plugin):
+class Dhcp(Plugin):
"""DHCP related information
"""
plugin_name = "dhcp"
-class RedHatDhcp(dhcp, RedHatPlugin):
+class RedHatDhcp(Dhcp, RedHatPlugin):
"""DHCP related information for Red Hat based distributions"""
files = ('/etc/rc.d/init.d/dhcpd',)
packages = ('dhcp',)
def setup(self):
- super(DhcpRedHat, self).setup()
+ super(RedHatDhcp, self).setup()
self.add_copy_specs([
"/etc/dhcpd.conf",
"/etc/dhcp"])
-class UbuntuDhcp(dhcp, UbuntuPlugin):
+class UbuntuDhcp(Dhcp, UbuntuPlugin):
"""DHCP related information for Debian based distributions"""
files = ('/etc/init.d/udhcpd',)
packages = ('udhcpd',)
def setup(self):
- super(DhcpDebian, self).setup()
+ super(DebianDhcp, self).setup()
self.add_copy_specs([
"/etc/default/udhcpd",
"/etc/udhcpd.conf"
diff --git a/sos/plugins/dovecot.py b/sos/plugins/dovecot.py
index 1222a91b..2d92a6b9 100644
--- a/sos/plugins/dovecot.py
+++ b/sos/plugins/dovecot.py
@@ -23,7 +23,7 @@ class Dovecot(Plugin):
def setup(self):
self.add_copy_spec("/etc/dovecot*")
- self.add_cmd_output("/usr/sbin/dovecot -n")
+ self.add_cmd_output("dovecot -n")
class RedHatDovecot(Dovecot, RedHatPlugin):
"""dovecot server related information for RedHat based distribution
@@ -31,10 +31,7 @@ class RedHatDovecot(Dovecot, RedHatPlugin):
def setup(self):
super(RedHatDovecot, self).setup()
- if os.path.exists("/etc/dovecot.conf"):
- self.add_copy_spec("/etc/dovecot*")
- self.add_cmd_output("/usr/sbin/dovecot -n")
-
+ packages = ('dovecot', )
files = ('/etc/dovecot.conf',)
class DebianDovecot(Dovecot, DebianPlugin, UbuntuPlugin):
diff --git a/sos/plugins/dpkg.py b/sos/plugins/dpkg.py
index b95db952..a3b55a60 100644
--- a/sos/plugins/dpkg.py
+++ b/sos/plugins/dpkg.py
@@ -20,4 +20,4 @@ class dpkg(Plugin, DebianPlugin, UbuntuPlugin):
"""
def setup(self):
self.add_copy_spec("/var/log/dpkg.log")
- self.add_cmd_output("/usr/bin/dpkg -l", root_symlink = "installed-debs")
+ self.add_cmd_output("dpkg -l", root_symlink = "installed-debs")
diff --git a/sos/plugins/emc.py b/sos/plugins/emc.py
index c386e70e..7646ea2c 100644
--- a/sos/plugins/emc.py
+++ b/sos/plugins/emc.py
@@ -36,7 +36,7 @@ class emc(Plugin, RedHatPlugin):
def get_pp_files(self):
""" EMC PowerPath specific information - files
"""
- self.add_cmd_output("/sbin/powermt version")
+ self.add_cmd_output("powermt version")
self.add_copy_specs([
"/etc/init.d/PowerPath",
"/etc/powermt.custom",
@@ -51,13 +51,13 @@ class emc(Plugin, RedHatPlugin):
def get_pp_config(self):
""" EMC PowerPath specific information - commands
"""
- self.add_cmd_output("/sbin/powermt display")
- self.add_cmd_output("/sbin/powermt display dev=all")
- self.add_cmd_output("/sbin/powermt check_registration")
- self.add_cmd_output("/sbin/powermt display options")
- self.add_cmd_output("/sbin/powermt display ports")
- self.add_cmd_output("/sbin/powermt display paths")
- self.add_cmd_output("/sbin/powermt dump")
+ self.add_cmd_output("powermt display")
+ self.add_cmd_output("powermt display dev=all")
+ self.add_cmd_output("powermt check_registration")
+ self.add_cmd_output("powermt display options")
+ self.add_cmd_output("powermt display ports")
+ self.add_cmd_output("powermt display paths")
+ self.add_cmd_output("powermt dump")
def get_symcli_files(self):
""" EMC Solutions Enabler SYMCLI specific information - files
@@ -70,51 +70,51 @@ class emc(Plugin, RedHatPlugin):
def get_symcli_config(self):
""" EMC Solutions Enabler SYMCLI specific information - Symmetrix/DMX - commands
"""
- self.add_cmd_output("/usr/symcli/bin/symcli -def")
- self.add_cmd_output("/usr/symcli/bin/symdg list")
- self.add_cmd_output("/usr/symcli/bin/symdg -v list")
- self.add_cmd_output("/usr/symcli/bin/symcg list")
- self.add_cmd_output("/usr/symcli/bin/symcg -v list")
- self.add_cmd_output("/usr/symcli/bin/symcfg list")
- self.add_cmd_output("/usr/symcli/bin/symcfg -v list")
- self.add_cmd_output("/usr/symcli/bin/symcfg -db")
- self.add_cmd_output("/usr/symcli/bin/symcfg -semaphores list")
- self.add_cmd_output("/usr/symcli/bin/symcfg -dir all -v list")
- self.add_cmd_output("/usr/symcli/bin/symcfg -connections list")
- self.add_cmd_output("/usr/symcli/bin/symcfg -app -v list")
- self.add_cmd_output("/usr/symcli/bin/symcfg -fa all -port list")
- self.add_cmd_output("/usr/symcli/bin/symcfg -ra all -port list")
- self.add_cmd_output("/usr/symcli/bin/symcfg -sa all -port list")
- self.add_cmd_output("/usr/symcli/bin/symcfg list -lock")
- self.add_cmd_output("/usr/symcli/bin/symcfg list -lockn all")
- self.add_cmd_output("/usr/symcli/bin/syminq")
- self.add_cmd_output("/usr/symcli/bin/syminq -v")
- self.add_cmd_output("/usr/symcli/bin/syminq -symmids")
- self.add_cmd_output("/usr/symcli/bin/syminq hba -fibre")
- self.add_cmd_output("/usr/symcli/bin/syminq hba -scsi")
- self.add_cmd_output("/usr/symcli/bin/symhost show -config")
- self.add_cmd_output("/usr/symcli/bin/stordaemon list")
- self.add_cmd_output("/usr/symcli/bin/stordaemon -v list")
- self.add_cmd_output("/usr/symcli/bin/sympd list")
- self.add_cmd_output("/usr/symcli/bin/sympd list -vcm")
- self.add_cmd_output("/usr/symcli/bin/symdev list")
- self.add_cmd_output("/usr/symcli/bin/symdev -v list")
- self.add_cmd_output("/usr/symcli/bin/symdev -rdfa list")
- self.add_cmd_output("/usr/symcli/bin/symdev -rdfa -v list")
- self.add_cmd_output("/usr/symcli/bin/symbcv list")
- self.add_cmd_output("/usr/symcli/bin/symbcv -v list")
- self.add_cmd_output("/usr/symcli/bin/symrdf list")
- self.add_cmd_output("/usr/symcli/bin/symrdf -v list")
- self.add_cmd_output("/usr/symcli/bin/symrdf -rdfa list")
- self.add_cmd_output("/usr/symcli/bin/symrdf -rdfa -v list")
- self.add_cmd_output("/usr/symcli/bin/symsnap list")
- self.add_cmd_output("/usr/symcli/bin/symsnap list -savedevs")
- self.add_cmd_output("/usr/symcli/bin/symclone list")
- self.add_cmd_output("/usr/symcli/bin/symevent list")
- self.add_cmd_output("/usr/symcli/bin/symmask list hba")
- self.add_cmd_output("/usr/symcli/bin/symmask list logins")
- self.add_cmd_output("/usr/symcli/bin/symmaskdb list database")
- self.add_cmd_output("/usr/symcli/bin/symmaskdb -v list database")
+ self.add_cmd_output("symclisymcli -def")
+ self.add_cmd_output("symclisymdg list")
+ self.add_cmd_output("symclisymdg -v list")
+ self.add_cmd_output("symclisymcg list")
+ self.add_cmd_output("symclisymcg -v list")
+ self.add_cmd_output("symclisymcfg list")
+ self.add_cmd_output("symclisymcfg -v list")
+ self.add_cmd_output("symclisymcfg -db")
+ self.add_cmd_output("symclisymcfg -semaphores list")
+ self.add_cmd_output("symclisymcfg -dir all -v list")
+ self.add_cmd_output("symclisymcfg -connections list")
+ self.add_cmd_output("symclisymcfg -app -v list")
+ self.add_cmd_output("symclisymcfg -fa all -port list")
+ self.add_cmd_output("symclisymcfg -ra all -port list")
+ self.add_cmd_output("symclisymcfg -sa all -port list")
+ self.add_cmd_output("symclisymcfg list -lock")
+ self.add_cmd_output("symclisymcfg list -lockn all")
+ self.add_cmd_output("symclisyminq")
+ self.add_cmd_output("symclisyminq -v")
+ self.add_cmd_output("symclisyminq -symmids")
+ self.add_cmd_output("symclisyminq hba -fibre")
+ self.add_cmd_output("symclisyminq hba -scsi")
+ self.add_cmd_output("symclisymhost show -config")
+ self.add_cmd_output("symclistordaemon list")
+ self.add_cmd_output("symclistordaemon -v list")
+ self.add_cmd_output("symclisympd list")
+ self.add_cmd_output("symclisympd list -vcm")
+ self.add_cmd_output("symclisymdev list")
+ self.add_cmd_output("symclisymdev -v list")
+ self.add_cmd_output("symclisymdev -rdfa list")
+ self.add_cmd_output("symclisymdev -rdfa -v list")
+ self.add_cmd_output("symclisymbcv list")
+ self.add_cmd_output("symclisymbcv -v list")
+ self.add_cmd_output("symclisymrdf list")
+ self.add_cmd_output("symclisymrdf -v list")
+ self.add_cmd_output("symclisymrdf -rdfa list")
+ self.add_cmd_output("symclisymrdf -rdfa -v list")
+ self.add_cmd_output("symclisymsnap list")
+ self.add_cmd_output("symclisymsnap list -savedevs")
+ self.add_cmd_output("symclisymclone list")
+ self.add_cmd_output("symclisymevent list")
+ self.add_cmd_output("symclisymmask list hba")
+ self.add_cmd_output("symclisymmask list logins")
+ self.add_cmd_output("symclisymmaskdb list database")
+ self.add_cmd_output("symclisymmaskdb -v list database")
def get_navicli_config(self):
""" EMC Navisphere Host Agent NAVICLI specific information - files
@@ -129,19 +129,19 @@ class emc(Plugin, RedHatPlugin):
def get_navicli_SP_info(self,SP_address):
""" EMC Navisphere Host Agent NAVICLI specific information - CLARiiON - commands
"""
- self.add_cmd_output("/opt/Navisphere/bin/navicli -h %s getall" % SP_address)
- self.add_cmd_output("/opt/Navisphere/bin/navicli -h %s getsptime -spa" % SP_address)
- self.add_cmd_output("/opt/Navisphere/bin/navicli -h %s getsptime -spb" % SP_address)
- self.add_cmd_output("/opt/Navisphere/bin/navicli -h %s getlog" % SP_address)
- self.add_cmd_output("/opt/Navisphere/bin/navicli -h %s getdisk" % SP_address)
- self.add_cmd_output("/opt/Navisphere/bin/navicli -h %s getcache" % SP_address)
- self.add_cmd_output("/opt/Navisphere/bin/navicli -h %s getlun" % SP_address)
- self.add_cmd_output("/opt/Navisphere/bin/navicli -h %s getlun -rg -type -default -owner -crus -capacity" % SP_address)
- self.add_cmd_output("/opt/Navisphere/bin/navicli -h %s lunmapinfo" % SP_address)
- self.add_cmd_output("/opt/Navisphere/bin/navicli -h %s getcrus" % SP_address)
- self.add_cmd_output("/opt/Navisphere/bin/navicli -h %s port -list -all" % SP_address)
- self.add_cmd_output("/opt/Navisphere/bin/navicli -h %s storagegroup -list" % SP_address)
- self.add_cmd_output("/opt/Navisphere/bin/navicli -h %s spportspeed -get" % SP_address)
+ self.add_cmd_output("navicli -h %s getall" % SP_address)
+ self.add_cmd_output("navicli -h %s getsptime -spa" % SP_address)
+ self.add_cmd_output("navicli -h %s getsptime -spb" % SP_address)
+ self.add_cmd_output("navicli -h %s getlog" % SP_address)
+ self.add_cmd_output("navicli -h %s getdisk" % SP_address)
+ self.add_cmd_output("navicli -h %s getcache" % SP_address)
+ self.add_cmd_output("navicli -h %s getlun" % SP_address)
+ self.add_cmd_output("navicli -h %s getlun -rg -type -default -owner -crus -capacity" % SP_address)
+ self.add_cmd_output("navicli -h %s lunmapinfo" % SP_address)
+ self.add_cmd_output("navicli -h %s getcrus" % SP_address)
+ self.add_cmd_output("navicli -h %s port -list -all" % SP_address)
+ self.add_cmd_output("navicli -h %s storagegroup -list" % SP_address)
+ self.add_cmd_output("navicli -h %s spportspeed -get" % SP_address)
def check_enabled(self):
self.packages = [ "EMCpower" ]
@@ -194,7 +194,7 @@ class emc(Plugin, RedHatPlugin):
while CLARiiON_IP_loop == "stay_in":
ans = raw_input("CLARiiON SP IP Address or [Enter] to exit: ")
## Check to make sure the CLARiiON SP IP address provided is valid
- p = Popen("/opt/Navisphere/bin/navicli -h %s getsptime" % (ans,), shell=True, stdout=PIPE, stderr=PIPE)
+ p = Popen("navicli -h %s getsptime" % (ans,), shell=True, stdout=PIPE, stderr=PIPE)
out, err = p.communicate()
if p.returncode == 0:
CLARiiON_IP_address_list.append(ans)
diff --git a/sos/plugins/filesys.py b/sos/plugins/filesys.py
index 5409320f..e5d63dfa 100644
--- a/sos/plugins/filesys.py
+++ b/sos/plugins/filesys.py
@@ -32,15 +32,15 @@ class filesys(Plugin, RedHatPlugin, UbuntuPlugin):
"/proc/mdstat",
"/etc/raidtab",
"/etc/mdadm.conf"])
- mounts = self.get_cmd_output_now("/bin/mount -l", root_symlink = "mount")
+ mounts = self.get_cmd_output_now("mount -l", root_symlink = "mount")
- self.add_cmd_output("/bin/findmnt")
- self.add_cmd_output("/bin/df -al", root_symlink = "df")
- self.add_cmd_output("/bin/df -ali")
+ self.add_cmd_output("findmnt")
+ self.add_cmd_output("df -al", root_symlink = "df")
+ self.add_cmd_output("df -ali")
if self.get_option('lsof'):
- self.add_cmd_output("/usr/sbin/lsof -b +M -n -l -P", root_symlink = "lsof")
- self.add_cmd_output("/sbin/blkid -c /dev/null")
- self.add_cmd_output("/usr/bin/lsblk")
+ self.add_cmd_output("lsof -b +M -n -l -P", root_symlink = "lsof")
+ self.add_cmd_output("blkid -c /dev/null")
+ self.add_cmd_output("lsblk")
part_titlep = re.compile("^major")
blankp = re.compile("^$")
@@ -53,9 +53,9 @@ class filesys(Plugin, RedHatPlugin, UbuntuPlugin):
partlist.append('/dev/' + line.split()[-1])
except IOError:
exit(1)
- if os.path.exists("/sbin/hdparm"):
+ if os.path.exists("hdparm"):
for dev in partlist:
- ret, hdparm, time = self.call_ext_prog('/sbin/hdparm -g %s' %(dev))
+ ret, hdparm, time = self.call_ext_prog('hdparm -g %s' %(dev))
if(ret == 0):
start_geo = hdparm.strip().split("\n")[-1].strip().split()[-1]
if(start_geo == "0"):
@@ -69,8 +69,8 @@ class filesys(Plugin, RedHatPlugin, UbuntuPlugin):
devlist.append(dev)
for i in devlist:
- self.add_cmd_output("/sbin/parted -s %s print" % (i))
+ self.add_cmd_output("parted -s %s print" % (i))
if self.get_option('dumpe2fs'):
for extfs in izip(self.do_regex_find_all(r"^(/dev/.+) on .+ type ext.\s+", mounts)):
- self.add_cmd_output("/sbin/dumpe2fs %s" % (extfs))
+ self.add_cmd_output("dumpe2fs %s" % (extfs))
diff --git a/sos/plugins/ftp.py b/sos/plugins/ftp.py
index 7dc4676d..693b8cbd 100644
--- a/sos/plugins/ftp.py
+++ b/sos/plugins/ftp.py
@@ -13,7 +13,6 @@
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin
-from os.path import exists
class ftp(Plugin, RedHatPlugin):
"""FTP server related information
diff --git a/sos/plugins/general.py b/sos/plugins/general.py
index 1e9f9edb..dc57ba95 100644
--- a/sos/plugins/general.py
+++ b/sos/plugins/general.py
@@ -42,19 +42,19 @@ class General(Plugin):
"/root/anaconda-ks.cfg"])
limit = self.get_option("syslogsize")
- self.add_cmd_output("/bin/dmesg", suggest_filename="dmesg_now")
+ self.add_cmd_output("dmesg", suggest_filename="dmesg_now")
self.add_copy_spec_limit("/var/log/messages*", sizelimit = limit)
self.add_copy_spec_limit("/var/log/secure*", sizelimit = limit)
- self.add_cmd_output("/usr/bin/hostid")
- self.add_cmd_output("/bin/hostname", root_symlink="hostname")
- self.add_cmd_output("/bin/date", root_symlink="date")
- self.add_cmd_output("/usr/bin/uptime", root_symlink="uptime")
- self.add_cmd_output("/bin/dmesg")
- self.add_cmd_output("/usr/sbin/alternatives --display java",
+ self.add_cmd_output("hostid")
+ self.add_cmd_output("hostname", root_symlink="hostname")
+ self.add_cmd_output("date", root_symlink="date")
+ self.add_cmd_output("uptime", root_symlink="uptime")
+ self.add_cmd_output("dmesg")
+ self.add_cmd_output("alternatives --display java",
root_symlink="java")
- self.add_cmd_output("/usr/bin/readlink -f /usr/bin/java")
- self.add_cmd_output("/usr/bin/tree /var/lib")
- self.add_cmd_output("/bin/ls -lR /var/lib")
+ self.add_cmd_output("readlink -f /usr/bin/java")
+ self.add_cmd_output("tree /var/lib")
+ self.add_cmd_output("ls -lR /var/lib")
class RedHatGeneral(General, RedHatPlugin):
@@ -120,3 +120,4 @@ class UbuntuGeneral(DebianGeneral, UbuntuPlugin):
"/var/log/unattended-upgrades",
"/var/log/upstart"
])
+
diff --git a/sos/plugins/gluster.py b/sos/plugins/gluster.py
index 6383938b..b5670993 100644
--- a/sos/plugins/gluster.py
+++ b/sos/plugins/gluster.py
@@ -76,7 +76,7 @@ class gluster(Plugin, RedHatPlugin):
pass
def setup(self):
- self.add_cmd_output("/usr/sbin/gluster peer status")
+ self.add_cmd_output("gluster peer status")
# check package version handling rename of glusterfs-core -> glusterfs
pkg = self.policy().pkg_by_name("glusterfs-core");
diff --git a/sos/plugins/hardware.py b/sos/plugins/hardware.py
index ef6359ff..92c84829 100644
--- a/sos/plugins/hardware.py
+++ b/sos/plugins/hardware.py
@@ -45,31 +45,24 @@ class hardware(Plugin):
"/sys/state",
"/sys/firmware/acpi/tables",
"/var/log/mcelog"])
- self.add_cmd_output("""/bin/echo -e "lspci:\n" ; /sbin/lspci ; /bin/echo -e "\nlspci -nvv:\n" ; /sbin/lspci -nvv ; /bin/echo -e "\nlspci -tv:\n" ; /sbin/lspci -tv""", suggest_filename = "lspci", root_symlink = "lspci")
+ self.add_cmd_output("""echo -e "lspci:\n" ; lspci ; echo -e "\nlspci -nvv:\n" ; /sbin/lspci -nvv ; echo -e "\nlspci -tv:\n" ; /sbin/lspci -tv""", suggest_filename = "lspci", root_symlink = "lspci")
- self.add_cmd_output("/usr/sbin/dmidecode", root_symlink = "dmidecode")
+ self.add_cmd_output("dmidecode", root_symlink = "dmidecode")
- if os.path.exists("/usr/bin/cpufreq-info"):
- self.add_cmd_output("/usr/bin/cpufreq-info")
- if os.path.exists("/usr/bin/cpupower"):
- self.add_cmd_output("/usr/bin/cpupower info")
- self.add_cmd_output("/usr/bin/cpupower frequency-info")
+ self.add_cmd_output("cpufreq-info")
+ self.add_cmd_output("cpupower info")
+ self.add_cmd_output("cpupower frequency-info")
if self.policy().get_arch().endswith("386"):
- self.add_cmd_output("/usr/sbin/x86info -a")
+ self.add_cmd_output("x86info -a")
- if os.path.exists("/usr/bin/lsusb"):
- lsusb_path = "/usr/bin/lsusb"
- else:
- lsusb_path = "/usr/bin/lsusb"
+ self.add_cmd_output("lsusb")
+ self.add_cmd_output("lsusb -v")
+ self.add_cmd_output("lsusb -t")
- self.add_cmd_output("%s"% lsusb_path)
- self.add_cmd_output("%s -v"% lsusb_path)
- self.add_cmd_output("%s -t"% lsusb_path)
-
- self.add_cmd_output("/usr/bin/lshal")
- self.add_cmd_output("/usr/bin/systool -c fc_host -v")
- self.add_cmd_output("/usr/bin/systool -c scsi_host -v")
+ self.add_cmd_output("lshal")
+ self.add_cmd_output("systool -c fc_host -v")
+ self.add_cmd_output("systool -c scsi_host -v")
class RedHatHardware(hardware, RedHatPlugin):
"""hardware related information for Red Hat distribution
@@ -78,7 +71,7 @@ class RedHatHardware(hardware, RedHatPlugin):
def setup(self):
super(RedHatHardware, self).setup()
hwpaths = glob("/usr/share/rhn/up2date*client/hardware.py")
- if (len(hwpaths) == 0):
+ if (len(hwpaths) == 0):
return
self.add_cmd_output(hwpaths[0])
diff --git a/sos/plugins/i18n.py b/sos/plugins/i18n.py
index a8a09c7c..891e71bd 100644
--- a/sos/plugins/i18n.py
+++ b/sos/plugins/i18n.py
@@ -19,4 +19,4 @@ class i18n(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""
def setup(self):
self.add_copy_specs(["/etc/X11/xinit/xinput.d/*", "/etc/locale.conf"])
- self.add_cmd_output("/usr/bin/locale")
+ self.add_cmd_output("locale")
diff --git a/sos/plugins/infiniband.py b/sos/plugins/infiniband.py
index 59cc5078..dcb8e44f 100644
--- a/sos/plugins/infiniband.py
+++ b/sos/plugins/infiniband.py
@@ -30,10 +30,10 @@ class infiniband(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"/etc/ofed/openib.conf",
"/etc/ofed/opensm.conf"])
- self.add_cmd_output("/usr/bin/ibv_devices")
- self.add_cmd_output("/usr/bin/ibv_devinfo")
- self.add_cmd_output("/usr/sbin/ibstat")
- self.add_cmd_output("/usr/sbin/ibstatus")
- self.add_cmd_output("/usr/sbin/ibhosts")
+ self.add_cmd_output("ibv_devices")
+ self.add_cmd_output("ibv_devinfo")
+ self.add_cmd_output("ibstat")
+ self.add_cmd_output("ibstatus")
+ self.add_cmd_output("ibhosts")
return
diff --git a/sos/plugins/initrd.py b/sos/plugins/initrd.py
index ef6b6225..69cffb9b 100644
--- a/sos/plugins/initrd.py
+++ b/sos/plugins/initrd.py
@@ -20,7 +20,7 @@ class initrd(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""
def setup(self):
for initrd in glob('/boot/initrd-*.img'):
- self.add_cmd_output("/bin/zcat "+initrd+" | /bin/cpio "+
+ self.add_cmd_output("zcat "+initrd+" | cpio "+
"--extract --to-stdout init" )
def default_enabled(self):
diff --git a/sos/plugins/ipa.py b/sos/plugins/ipa.py
index 293ebe28..3bbf71cd 100644
--- a/sos/plugins/ipa.py
+++ b/sos/plugins/ipa.py
@@ -15,9 +15,8 @@
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin
-from os.path import exists
-class ipa(Plugin, RedHatPlugin):
+class Ipa(Plugin, RedHatPlugin):
"""IPA diagnostic information
"""
diff --git a/sos/plugins/iscsi.py b/sos/plugins/iscsi.py
index 3d5423b8..2a49ee4c 100644
--- a/sos/plugins/iscsi.py
+++ b/sos/plugins/iscsi.py
@@ -13,15 +13,15 @@
## along with this program; if not, write to the Free Software
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
+from sos.plugins import Plugin, RedHatPlugin
-class iscsi(Plugin):
+class Iscsi(Plugin):
"""iscsi-initiator related information
"""
plugin_name = "iscsi"
-class RedHatIscsi(iscsi, RedHatPlugin):
+class RedHatIscsi(Iscsi, RedHatPlugin):
"""iscsi-initiator related information Red Hat based distributions
"""
diff --git a/sos/plugins/iscsitarget.py b/sos/plugins/iscsitarget.py
index 284fe36b..1657e6cb 100644
--- a/sos/plugins/iscsitarget.py
+++ b/sos/plugins/iscsitarget.py
@@ -17,30 +17,31 @@
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
-class iscsitarget(Plugin):
+class Iscsitarget(Plugin):
"""iscsi-target related information
"""
plugin_name = "iscsitarget"
-class RedHatIscsiTarget(Plugin, RedHatPlugin):
+class RedHatIscsiTarget(Iscsitarget, RedHatPlugin):
"""iscsi-target related information for Red Hat distributions
"""
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")
-class DebianIscsiTarget(iscsitarget, DebianPlugin, UbuntuPlugin):
+class DebianIscsiTarget(Iscsitarget, DebianPlugin, UbuntuPlugin):
"""iscsi-target related information for Debian based distributions
"""
packages = ('iscsitarget',)
def setup(self):
- super(DebianIscsi, self).setup()
+ super(DebianIscsiTarget, self).setup()
self.add_copy_specs([
"/etc/iet",
"/etc/sysctl.d/30-iscsitarget.conf",
diff --git a/sos/plugins/jboss.py b/sos/plugins/jboss.py
deleted file mode 100644
index f36ba1d0..00000000
--- a/sos/plugins/jboss.py
+++ /dev/null
@@ -1,713 +0,0 @@
-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
- __jbossHome=None
- __haveJava=False
- __twiddleCmd=None
- __jbossSystemJarDirs = [ "client", "lib" , "common/lib" ]
- __jbossServerConfigDirs = ["all", "default", "minimal", "production", "standard", "web"]
- __jbossHTMLBody=None
-
- def __getJbossHome(self):
- """
- Will attempt to locate the JBoss installation dir in either jboss.home or
- scrape it from the environment variable JBOSS_HOME.
- Returns:
- True JBOSS_HOME is set and the path exists. False otherwise.
- """
- if self.get_option("home"):
- ## Prefer this value first over the ENV
- self.__jbossHome=self.get_option("home")
- self.add_alert("INFO: The JBoss installation directory supplied to SOS is " +
- self.__jbossHome)
- elif os.environ.get("JBOSS_HOME"):
- self.__jbossHome=os.environ.get("JBOSS_HOME")
- self.add_alert("INFO: The JBoss installation directory (i.e. JBOSS_HOME) from the environment is " +
- self.__jbossHome)
- else:
- self.add_alert("ERROR: The JBoss installation directory was not supplied.\
- The JBoss SOS plug-in cannot continue.")
- return False
-
- if os.path.exists(self.__jbossHome):
- ## We need to set JBOSS_CLASSPATH otherwise some twiddle commands will not work.
- jbossClasspath=None
- tmp=os.path.join(self.__jbossHome, "lib")
- if os.path.exists(tmp):
- jbossClasspath=tmp + os.sep + "*" + os.pathsep
- else:
- self.add_alert("WARN: The JBoss lib directory does not exist. Dir(%s) " % tmp)
-
- tmp=os.path.join(self.__jbossHome, "common" , "lib")
- if os.path.exists(tmp):
- jbossClasspath+=tmp + os.sep + "*"
- else:
- self.add_alert("WARN: The JBoss lib directory does not exist. Dir(%s) " % tmp)
-
- os.environ['JBOSS_CLASSPATH']=jbossClasspath
-
- return True
- else:
- msg = "ERROR: The path to the JBoss installation directory does not exist. Path is: " + self.__jbossHome
- print msg
- self.add_alert(msg)
- return False
-
- def __getJavaHome(self):
- """
- This SOS plug-in makes extensive use of JBoss' twiddle program and twiddle uses Java. As such, we
- need to ensure that java and JAVA_HOME is known to the plug-in so that it can use Java.
- This function will put JAVA_HOME and JAVA_HOME/bin into the environment if they're not already
- there.
- """
- javaHome=None
- java="bin/java"
-
- if self.get_option("javahome"):
- ## Prefer this value first over the ENV
- javaHome=self.get_option("javahome")
- self.add_alert("INFO: The Java installation directory supplied to SOS is " +
- javaHome)
- elif os.environ.get("JAVA_HOME"):
- javaHome=os.environ.get("JAVA_HOME")
- self.add_alert("INFO: The Java installation directory (i.e. JAVA_HOME) from the environment is " +
- javaHome)
- else:
- ## Test to see if Java is already in the PATH
- (status, output, rtime) = self.call_ext_prog("java -version")
- if (status == 0):
- self.add_alert("INFO: The Java installation directory is in the system path.")
- return True
- else:
- self.add_alert("ERROR: The Java installation directory was not supplied.\
- The JBoss SOS plug-in will not collect twiddle data.")
- return False
-
-
- java=os.path.join(javaHome, java)
- if os.path.exists(java) and os.access(java, os.X_OK):
- os.environ['JAVA_HOME']=javaHome
- ## Place the supplied Java at the *head* of the path.
- os.environ['PATH'] = os.path.join(javaHome, "bin") + os.pathsep + os.environ['PATH']
- return True
- else:
- msg = "ERROR: The path to the Java installation directory does not exist. Path is: %s" % (javaHome)
- print msg
- self.add_alert(msg)
- return False
-
-
- def __getJMXCredentials(self):
- """
- Read the JMX credentials from the option list.
- Returns:
- A formatted credential string for twiddle consumption if both user and pass
- are supplied. None otherwise.
- """
- credential = None
- ## Let's make a best effort not to pass expansions or escapes to the shell
- ## by strong quoting the user's input
- if self.get_option("user"):
- credential=" -u '" + self.get_option("user") + "' "
- if self.get_option("pass"):
- credential+=" -p '" + self.get_option("pass") + "' "
- else:
- credential=None
- return credential
-
- def __updateServerConfigDirs(self):
- """
- By default this plug-in will attempt to collect logs from every
- JBoss server configuration directory (i.e. profile). The
- user may have supplied a limited list, as such, we must respect
- that wish.
- Returns:
- Nothing. Will update __jbossServerConfigDirs if the user
- supplied a limited list.
- """
- if self.get_option("profile"):
- profiles=self.get_option("profile")
- ## I'd rather use comma as the delimiter but get_option doesn't seem to be passing it through.
- ## Since we are using spaces as the delimiter, we need to filter out empty list elements
- ## if the user did something like ' all default web '.
- profiles=profiles.split(' ')
- ## Flter(None doesn't work. Allows 0.
- self.__jbossServerConfigDirs=filter(lambda x: len(x), profiles)
- return
-
- def __buildTwiddleCmd(self):
- """
- Utility function to build the twiddle command with/without credentials
- so that it can be used by later fcns. If twiddle is found
- """
- ## In the off-chance that SOS is ever ported to cygwin or this plugin
- ## is ported to win...
- if platform.system() == "Windows":
- self.__twiddleCmd=os.path.join(self.__jbossHome, "bin", "twiddle.bat")
- else:
- self.__twiddleCmd=os.path.join(self.__jbossHome, "bin", "twiddle.sh")
-
- if os.path.exists(self.__twiddleCmd) and os.access(self.__twiddleCmd, os.X_OK):
- credential = self.__getJMXCredentials()
- if credential:
- self.__twiddleCmd += credential
- else:
- ## Reset twiddlecmd to None
- self.add_alert("ERROR: The twiddle program could not be found. Program=%s" % (self.__twiddleCmd))
- self.__twiddleCmd = None
-
- return
-
- def __createHTMLBodyStart(self):
- """
- The free-form HTML that can be inserted into the SOS report with add_custom_text is within
- a <p> block. We need to add a few pieces of HTML so that all of our subsequent data will
- be rendered properly.
- """
- self.__jbossHTMLBody = """
- <br/>
- <br/>
- <script type="text/javascript">
- <!--
- function show(h) {
- var tbl = document.getElementById(h);
- tbl.style.display = 'block';
- }
- function hide(h) {
- var tbl = document.getElementById(h);
- tbl.style.display = 'none';
- }
- // -->
- </script>
- <b>JBoss SOS Report Table of Contents</b>
- <ul style="list-style-type: square">
- <li><a href="#system-jar-info">JBoss System Jar Information</a>
- </li>
- <li><a href="#profile-jar-info">JBoss Server Configurations Jar Information</a>
- </li>
- <li><a href="#jboss-home-directory-tree">JBOSS_HOME Directory Tree</a>
- </li>
- <li><a href="#jboss-system-mbean-data">JBoss JMX MBean Data from <tt>jboss.system:*</tt></a>
- </li>
- <li><a href="#jboss-mbean-data">JBoss JMX MBean Data from <tt>jboss:*</tt></a>
- </li>
- <li><a href="#jboss-mbean-summary">JBoss MBean Summary</a>
- </li>
- <li><a href="#jboss-messaging">JBoss JMX Messaging MBean Data from <tt>jboss.messaging:*</tt></a>
- </li>
- <li><a href="#jboss-j2ee">JBoss JMX J2EE MBean Data from <tt>jboss.j2ee:*</tt></a>
- </li>
- <li><a href="#jboss-vfs">JBoss JMX VFS MBean Data from <tt>jboss.vfs:*</tt></a>
- </li>
- <li><a href="#jboss-jsr77-data">JBoss JSR77 Data</a>
- </li>
- </ul>
- <br/>
- <br/>
- """
-
- def __getMd5(self, file):
- """
- Will perform an MD5 sum on a given file and return the file's message digest. This function
- will not read the entire file into memory, instead, it will consume the file in 128 byte
- chunks. This might be slightly slower but, the intent of a SOS report is to collect data from
- a system that could be under stress and we shouldn't stress it more by loading entire Jars into
- real memory.
-
- Note: This fcn expects hashlib; however, this isn't always available. If it isn't then
- we will use md5sum
- """
-
- retVal="????????????????????????????????"
-
- try:
- import hashlib
- try:
- fd = open(file,"rb")
- except IOError, ioe:
- msg = "ERROR: Unable to open %s for reading. Error: " % (file,ioe)
- print msg
- self.add_alert(msg)
-
- md5 = hashlib.md5()
- data = fd.read(self.__MD5_CHUNK_SIZE)
- while data:
- md5.update(data)
- data = fd.read(self.__MD5_CHUNK_SIZE)
- retVal = md5.hexdigest()
- except ImportError, e:
- process = subprocess.Popen(['md5sum', file],
- shell=False,
- stdout=subprocess.PIPE,
- stderr=subprocess.PIPE)
- result = process.communicate()
- if (process.returncode == 0):
- retVal = result[0].partition(' ')[0]
- else:
- msg = "ERROR: Unable to compute md5sum of %s. Msg (%s)" % (file, result[1])
- print msg
- self.add_alert(msg)
-
- return retVal
-
-
- def __getManifest(self, jarFile):
- """
- Given a jar file, this function will extract the Manifest and return it's contents
- as a string.
- """
- manifest=None
- try:
- zf = zipfile.ZipFile(jarFile)
- try:
- manifest=zf.read("META-INF/MANIFEST.MF")
- except Exception, e:
- msg="ERROR: reading manifest from %s. Error: %s" % (jarFile, e)
- print msg
- self.add_alert(msg)
- zf.close()
- except Exception, e:
- msg="ERROR: reading contents of %s. Error: %s" % (jarFile, e)
- print msg
- self.add_alert(msg)
- return manifest
-
- def __getStdJarInfo(self):
-
- self.__jbossHTMLBody += """
- <div id="system-jar-info" style="font-weight: bold;">&ndash; JBoss System Jar Information</div>
- """
-
- for dir in self.__jbossSystemJarDirs:
- path=os.path.join(self.__jbossHome, dir)
- if os.path.exists(path):
- nicePath=path.replace(os.sep, "-")
- self.__jbossHTMLBody += """
- <div>
- &mdash; Summary of Jar Files in JBoss System Directory
- <tt>%s</tt>
- ( <a href="javascript:show('%s')">Show</a> / <a
- href="javascript:hide('%s')">Hide</a> ):
- </div>
- <div id="%s" style="overflow: hidden; display: none">
- <ul style="list-style-type: square">
- """ % (path,nicePath,nicePath,nicePath)
-
- found= False
- for jarFile in find("*.jar", path):
- found= True
- nicePath=jarFile.replace(os.sep, "-")
- self.__jbossHTMLBody += """
- <li>Jar File: <tt>%s</tt><br/>
- MD5: <tt>%s</tt>
- <br /> Manifest File (
- <a href="javascript:show('%s')">Show</a> /
- <a href="javascript:hide('%s')">Hide</a> ):<br />
- <div id="%s" style="overflow: hidden; display: none">
- <pre>
- %s
- </pre>
- </div>
- </li>
- """ % (jarFile,
- self.__getMd5(jarFile),
- nicePath,
- nicePath,
- nicePath,
- self.__getManifest(jarFile))
-
- if not found:
- self.add_alert("WARN: No jars found in JBoss system path (" + path + ").")
- self.__jbossHTMLBody += """
- </ul>
- </div>
- """
- else:
- self.add_alert("ERROR: JBoss system path (" + path + ") does not exist.")
- return
-
- def __getServerConfigJarInfo(self, configDirAry):
-
- self.__jbossHTMLBody += """
- <br/>
- <br/>
- <div id="profile-jar-info" style="font-weight: bold;">&ndash; JBoss Server Configurations Jar Information</div>
- """
- for dir in configDirAry:
- serverDir = os.path.join("server", dir)
- path=os.path.join(self.__jbossHome, serverDir)
- if os.path.exists(path):
- nicePath=path.replace(os.sep, "-")
- self.__jbossHTMLBody += """
- <div>
- &mdash; Summary of Jar Files in the <tt>%s</tt> JBoss Server Configuration
- ( <a href="javascript:show('%s')">Show</a> / <a
- href="javascript:hide('%s')">Hide</a> ):
- </div>
- <div id="%s" style="overflow: hidden; display: none">
- <ul style="list-style-type: square">
- """ % (dir, nicePath,nicePath,nicePath)
-
- found = False
- for jarFile in find("*.jar", path):
- found = True
- nicePath=jarFile.replace(os.sep, "-")
- self.__jbossHTMLBody += """
- <li id="system-jar-info">Jar File: <tt>%s</tt><br/>
- MD5: <tt>%s</tt>
- <br /> Manifest File (
- <a href="javascript:show('%s')">Show</a> /
- <a href="javascript:hide('%s')">Hide</a> ):<br />
- <div id="%s" style="overflow: hidden; display: none">
- <pre>
- %s
- </pre>
- </div>
- </li>
- """ % (jarFile,
- self.__getMd5(jarFile),
- nicePath,
- nicePath,
- nicePath,
- self.__getManifest(jarFile))
-
- if not found:
- self.add_alert("WARN: No jars found in the JBoss server configuration (%s)." % (path))
-
- self.__jbossHTMLBody += """
- </ul>
-</div>
- """
- else:
- self.add_alert("ERROR: JBoss server configuration path (" + path + ") does not exist.")
-
- return
-
- def __getJBossHomeTree(self):
- """
- This function will execute the "tree" command on JBOSS_HOME.
- """
- self.__jbossHTMLBody += """
- <br/>
- <br/>
- <div id="jboss-home-directory-tree" style="font-weight: bold;">&ndash; JBOSS_HOME Directory Tree</div>
-
- <div>
- &mdash; JBOSS_HOME Tree
- ( <a href="javascript:show('jboss-home-tree')">Show</a> / <a
- href="javascript:hide('jboss-home-tree')">Hide</a> ):
- </div>
- <div id="jboss-home-tree" style="overflow: hidden; display: none">
- <pre>
- """
- try:
- output = DirTree(self.__jbossHome).as_string()
- self.__jbossHTMLBody += """
-%s
- </pre>
- </div>
- """ % (output)
- except Exception, e:
- self.__jbossHTMLBody += """
- ERROR: Unable to generate <tt>tree</tt> on JBOSS_HOME.
- Exception: %s
- </pre>
- </div>
- """ % e
- return
-
- def __getMbeanData(self, dataTitle, divId, twiddleOpts):
- credentials = ""
- if self.__haveJava and self.__twiddleCmd:
- self.__jbossHTMLBody += """
- <div>
- &mdash; %s
- ( <a href="javascript:show('%s')">Show</a> / <a
- href="javascript:hide('%s')">Hide</a> ):
- </div>
- <div id="%s" style="overflow: hidden; display: none">
- <table style="margin-left: 30px;font-size:14px">
- <tr>
- <td align="left">
- Twiddle Options:
- </td>
- <td align="left"><tt>%s</tt></td>
- </tr>
- </table>
- <pre>
-
- """ % (dataTitle, divId, divId, divId,twiddleOpts)
- cmd = "%s %s" % (self.__twiddleCmd, twiddleOpts)
-
- proc = subprocess.Popen(shlex.split(cmd), stderr=subprocess.STDOUT, stdout=subprocess.PIPE)
- output = proc.communicate()[0]
- status = proc.returncode
- if status == 0 and output:
- self.__jbossHTMLBody += output.strip()
- else:
- self.__jbossHTMLBody += """
- ERROR: Unable to collect %s data.
- Output: %s
- Status: %d
- """ % (twiddleOpts, output, status)
- else:
- self.__jbossHTMLBody += "ERROR: Unable to collect data twiddle or Java is missing."
-
- self.__jbossHTMLBody += """
- </pre>
- </div>
- """
- return
-
- def __getTwiddleData(self):
- """
- This function co-locates all of the calls to twiddle so that they can be easily disabled.
- """
-
- ## Get jboss.system.* Data
- self.__jbossHTMLBody += """
- <br/>
- <br/>
- <div id="jboss-system-mbean-data" style="font-weight: bold;">&ndash; JBoss JMX MBean Data from <tt>jboss.system:*</tt></div>
- """
- self.__getMbeanData("JBoss Server Info",
- "jboss-server-info",
- " get 'jboss.system:type=ServerInfo' ")
- self.__getMbeanData("JBoss Server Config Info",
- "jboss-server-config-info",
- " get 'jboss.system:type=ServerConfig' ")
- self.__getMbeanData("JBoss CXF Server Config Info",
- "jboss-cxfserver-config-info",
- " get 'jboss.ws:service=ServerConfig' ")
- self.__getMbeanData("JBoss Memory Pool Info",
- "jboss-memory-pool-info",
- " invoke 'jboss.system:type=ServerInfo' listMemoryPools true ")
- self.__getMbeanData("JBoss Thread CPU Utilization",
- "jboss-thread-cpu-info",
- " invoke 'jboss.system:type=ServerInfo' listThreadCpuUtilization ")
- self.__getMbeanData("JBoss Thread Dump",
- "jboss-thread-dump",
- " invoke 'jboss.system:type=ServerInfo' listThreadDump ")
- self.__getMbeanData("JBoss Logging Config Info",
- "jboss-logging-config-info",
- " get 'jboss.system:service=Logging,type=Log4jService' ")
-
- ## Get jboss.* Data
- self.__jbossHTMLBody += """
- <br/>
- <br/>
- <div id="jboss-mbean-data" style="font-weight: bold;">&ndash; JBoss JMX MBean Data from <tt>jboss:*</tt></div>
- """
- self.__getMbeanData("JBoss System Properties",
- "jboss-system-properties-info",
- " invoke 'jboss:name=SystemProperties,type=Service' showAll ")
-
- self.__getMbeanData("JBoss JNDI List View",
- "jboss-jndi-list-info",
- " invoke 'jboss:service=JNDIView' list true ")
-
- ## MBean Summary
- self.__jbossHTMLBody += """
- <br/>
- <br/>
- <div id="jboss-mbean-summary" style="font-weight: bold;">&ndash; JBoss MBean Summary</div>
- """
- self.__getMbeanData("JBoss MBean Vendor/Version Info",
- "jboss-vendor-version",
- " get 'JMImplementation:type=MBeanServerDelegate' ")
- self.__getMbeanData("JBoss MBean Count",
- "jboss-mbean-count",
- " serverinfo -c ")
- self.__getMbeanData("JBoss MBean List",
- "jboss-mbean-list",
- " serverinfo -l ")
-
- ##JBoss Messaging Data
- self.__jbossHTMLBody += """
- <br/>
- <br/>
- <div id="jboss-messaging" style="font-weight: bold;">&ndash; JBoss JMX Messaging MBean Data from <tt>jboss.messaging:*</tt></div>
- """
- self.__getMbeanData("JBoss Message Counters",
- "jboss-message-counters",
- " invoke 'jboss.messaging:service=ServerPeer' listMessageCountersAsHTML ")
-
- self.__getMbeanData("JBoss Prepared Transactions Table",
- "jboss-prepared-transactions",
- " invoke 'jboss.messaging:service=ServerPeer' listAllPreparedTransactions ")
-
- self.__getMbeanData("JBoss Active Clients Table",
- "jboss-active-clients",
- " invoke 'jboss.messaging:service=ServerPeer' showActiveClientsAsHTML ")
-
- ## Get j2ee Data query 'jboss.j2ee:*'
- self.__jbossHTMLBody += """
- <br/>
- <br/>
- <div id="jboss-j2ee" style="font-weight: bold;">&ndash; JBoss JMX J2EE MBean Data from <tt>jboss.j2ee:*</tt></div>
- """
- self.__getMbeanData("JBoss J2EE MBeans",
- "jboss-j2ee-mbeans",
- " query 'jboss.j2ee:*' ")
-
- ## VFS
- self.__jbossHTMLBody += """
- <br/>
- <br/>
- <div id="jboss-vfs" style="font-weight: bold;">&ndash; JBoss JMX VFS MBean Data from <tt>jboss.vfs:*</tt></div>
- """
- self.__getMbeanData("JBoss VFS Cached Contexts",
- "jboss-vfs-contexts",
- " invoke 'jboss.vfs:service=VFSCacheStatistics' listCachedContexts ")
-
- ## Get jsr77 Data
- self.__jbossHTMLBody += """
- <br/>
- <br/>
- <div id="jboss-jsr77-data" style="font-weight: bold;">&ndash; JBoss JSR77 Data</div>
- """
- self.__getMbeanData("JBoss JSR77 Data",
- "jboss-jsr77",
- " jsr77 ")
- return
-
-
- def __getFiles(self, configDirAry):
- """
- This function will collect files from JBOSS_HOME for analysis. The scope of files to
- be collected are determined by options to this SOS plug-in.
- """
-
- for dir in configDirAry:
- path=os.path.join(self.__jbossHome, "server", dir)
- ## First add forbidden files
- self.add_forbidden_path(os.path.join(path, "tmp"))
- self.add_forbidden_path(os.path.join(path, "work"))
- self.add_forbidden_path(os.path.join(path, "data"))
-
- if os.path.exists(path):
- ## First get everything in the conf dir
- confDir=os.path.join(path, "conf")
- self.do_copy_file_or_dir(confDir)
- ## Log dir next
- logDir=os.path.join(path, "log")
-
- for logFile in find("*", logDir):
- self.add_copy_spec_limit(logFile, self.get_option("logsize"))
- ## Deploy dir
- deployDir=os.path.join(path, "deploy")
-
- for deployFile in find("*", deployDir, max_depth=1):
- self.add_copy_spec(deployFile)
-
- ## Get application deployment descriptors if designated.
- if self.option_enabled("appxml"):
- appxml=self.get_option("appxml")
- ## I'd rather use comma as the delimiter but get_option doesn't seem to be passing it through.
- ## Since we are using spaces as the delimiter, we need to filter out empty list elements
- ## if the user did something like ' all default web '.
- appxml=appxml.split(' ')
- ## Flter(None doesn't work. Allows 0.
- appxml=filter(lambda x: len(x), appxml)
- for app in appxml:
- pat = os.path.join("*%s*" % (app,), "WEB-INF")
- for file in find("*.xml", deployDir, path_pattern=pat):
- self.add_copy_spec(file)
- return
-
- def check_enabled(self):
- if not self.__getJbossHome():
- return False
- return True
-
- def setup(self):
-
- ## We need to know where JBoss is installed and if we can't find it we
- ## must exit immediately.
- if not self.__getJbossHome():
- self.exit_please()
- return
-
- ## Check to see if the user passed in a limited list of server config jars.
- self.__updateServerConfigDirs()
-
- ## Generate HTML Body for report
- self.__createHTMLBodyStart()
-
- ## Generate hashes of the stock Jar files for the report.
- if self.get_option("stdjar"):
- self.__getStdJarInfo()
-
- ## Generate hashes for the Jars in the various profiles
- if self.get_option("servjar"):
- self.__getServerConfigJarInfo(self.__jbossServerConfigDirs)
-
- ## Generate a Tree for JBOSS_HOME
- self.__getJBossHomeTree()
-
- if self.get_option("twiddle"):
- ## We need to know where Java is installed or at least ensure that it
- ## is available to the plug-in so that we can run twiddle.
- self.__haveJava = self.__getJavaHome()
- self.__buildTwiddleCmd()
- self.__getTwiddleData()
-
-
- self.add_custom_text(self.__jbossHTMLBody)
-
- self.__getFiles(self.__jbossServerConfigDirs)
-
- return
-
- def postproc(self):
- """
- Obfuscate passwords.
- """
-
- for dir in self.__jbossServerConfigDirs:
- path=os.path.join(self.__jbossHome, "server", dir)
- ## Really annoying that there appears to be no vehicle to
- ## say I want ignore case...argh!
- self.do_file_sub(os.path.join(path,"conf","login-config.xml"),
- r"\"[Pp][Aa][Ss][Ss][Ww][Oo][Rr][Dd]\".*>.*</[Mm][Oo][Dd][Uu][Ll][Ee]-[Oo][Pp][Tt][Ii][Oo][Nn].*>",
- r'"password">********</module-option>')
-
- tmp = os.path.join(path,"conf", "props")
- for propFile in find("*-users.properties", tmp):
- self.do_file_sub(propFile,
- r"=(.*)",
- r'=********')
-
- ## Remove PW from -ds.xml files
- tmp=os.path.join(path, "deploy")
- for dsFile in find("*-ds.xml", tmp):
- self.do_file_sub(dsFile,
- r"<[Pp][Aa][Ss][Ss][Ww][Oo][Rr][Dd].*>.*</[Pp][Aa][Ss][Ss][Ww][Oo][Rr][Dd].*>",
- r"<password>********</password>")
- return
diff --git a/sos/plugins/kdump.py b/sos/plugins/kdump.py
index 6cd7e89d..ebe17ede 100644
--- a/sos/plugins/kdump.py
+++ b/sos/plugins/kdump.py
@@ -13,7 +13,6 @@
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
-from os.path import exists
class kdump(Plugin):
"""Kdump related information
diff --git a/sos/plugins/kernel.py b/sos/plugins/kernel.py
index 2922d123..4ebf3575 100644
--- a/sos/plugins/kernel.py
+++ b/sos/plugins/kernel.py
@@ -13,7 +13,7 @@
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
-import os, re
+import os
class kernel(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""kernel related information
@@ -22,21 +22,19 @@ class kernel(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
module_file = ""
def setup(self):
- self.add_cmd_output("/bin/uname -a", root_symlink = "uname")
- self.module_file = self.get_cmd_output_now("/sbin/lsmod", root_symlink = "lsmod")
+ self.add_cmd_output("uname -a", root_symlink = "uname")
+ self.module_file = self.get_cmd_output_now("lsmod", root_symlink = "lsmod")
if self.get_option('modinfo'):
runcmd = ""
- ret, mods, rtime = self.call_ext_prog('/sbin/lsmod | /bin/cut -f1 -d" " 2>/dev/null | /bin/grep -v Module 2>/dev/null')
+ ret, mods, rtime = self.call_ext_prog('lsmod | cut -f1 -d" " 2>/dev/null | grep -v Module 2>/dev/null')
for kmod in mods.split('\n'):
if '' != kmod.strip():
runcmd = runcmd + " " + kmod
if len(runcmd):
- self.add_cmd_output("/sbin/modinfo " + runcmd)
+ self.add_cmd_output("modinfo " + runcmd)
- self.add_cmd_output("/sbin/sysctl -a")
- if os.path.isfile("/sbin/ksyms"):
- self.add_cmd_output("/sbin/ksyms")
+ self.add_cmd_output("sysctl -a")
self.add_copy_specs([
"/proc/sys/kernel/random/boot_id",
"/sys/module/*/parameters",
@@ -63,4 +61,4 @@ class kernel(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"/proc/timer*",
"/proc/lock*"])
- self.add_cmd_output("/usr/sbin/dkms status")
+ self.add_cmd_output("dkms status")
diff --git a/sos/plugins/kernelrt.py b/sos/plugins/kernelrt.py
index a03d7e08..7d7daa16 100644
--- a/sos/plugins/kernelrt.py
+++ b/sos/plugins/kernelrt.py
@@ -32,4 +32,4 @@ class kernel_rt(Plugin, RedHatPlugin):
self.add_copy_spec('/sys/devices/system/clocksource/clocksource0/available_clocksource')
self.add_copy_spec('/sys/devices/system/clocksource/clocksource0/current_clocksource')
if self.is_installed('tuna'):
- self.add_cmd_output('/usr/bin/tuna -CP | /ust/bin/head -20')
+ self.add_cmd_output('tuna -CP | /usthead -20')
diff --git a/sos/plugins/kvm.py b/sos/plugins/kvm.py
index dbc94033..e94ac0a1 100644
--- a/sos/plugins/kvm.py
+++ b/sos/plugins/kvm.py
@@ -38,8 +38,8 @@ class kvm(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
self.add_copy_spec("/sys/module/kvm_amd/srcversion")
self.add_copy_spec("/sys/module/ksm/srcversion")
if self.get_option('topOutput'):
- self.add_cmd_output("/usr/bin/top -b -d 1 -n 5")
- self.add_cmd_output("/usr/bin/kvm_stat --once")
+ self.add_cmd_output("top -b -d 1 -n 5")
+ self.add_cmd_output("kvm_stat --once")
def postproc(self):
if self._debugfs_cleanup and os.path.ismount("/sys/kernel/debug"):
diff --git a/sos/plugins/landscape.py b/sos/plugins/landscape.py
index f544ebb7..c31dea70 100644
--- a/sos/plugins/landscape.py
+++ b/sos/plugins/landscape.py
@@ -13,7 +13,6 @@
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, UbuntuPlugin
-import os
class Landscape(Plugin, UbuntuPlugin):
"""
@@ -69,4 +68,4 @@ class Landscape(Plugin, UbuntuPlugin):
r"registration_password[***]"
)
- \ No newline at end of file
+
diff --git a/sos/plugins/ldap.py b/sos/plugins/ldap.py
index 42f2db3a..3fce4278 100644
--- a/sos/plugins/ldap.py
+++ b/sos/plugins/ldap.py
@@ -20,19 +20,7 @@ class Ldap(Plugin):
"""
plugin_name = "ldap"
-
- def setup(self):
- super(ldap, self).setup()
-
-class RedHatLdap(Ldap, RedHatPlugin):
- """LDAP related information for RedHat based distribution
- """
-
- files = ('/etc/openldap/ldap.conf',)
- packages = ('openldap', 'nss-pam-ldapd')
-
- def setup(self):
- super(RedHatLdap, self).setup()
+ ldap_conf = "/etc/openldap/ldap.conf"
def get_ldap_opts(self):
# capture /etc/openldap/ldap.conf options in dict
@@ -41,12 +29,22 @@ class RedHatLdap(Ldap, RedHatPlugin):
results={}
tmplist=[]
for i in ldapopts:
- t=self.do_regex_find_all(r"^(%s)\s+(.*)" % i,"/etc/openldap/ldap.conf")
+ t=self.do_regex_find_all(r"^(%s)\s+(.*)" % i,self.ldap_conf)
for x in t:
results[x[0]]=x[1].rstrip("\n")
return results
def setup(self):
+ super(Ldap, self).setup()
+
+class RedHatLdap(Ldap, RedHatPlugin):
+ """LDAP related information for RedHat based distribution
+ """
+
+ packages = ('openldap', 'nss-pam-ldapd')
+
+ def setup(self):
+ super(RedHatLdap, self).setup()
self.add_copy_specs(["/etc/ldap.conf", "/etc/openldap", "/etc/nslcd.conf"])
def postproc(self):
@@ -57,26 +55,12 @@ class DebianLdap(Ldap, DebianPlugin, UbuntuPlugin):
"""LDAP related information for Debian based distribution
"""
- def setup(self):
- super(DebianLdap, self).setup()
-
- files = ('/etc/ldap/ldap.conf',)
+ ldap_conf = "/etc/ldap/ldap.conf"
packages = ('slapd', 'ldap-utils')
- def get_ldap_opts(self):
- # capture /etc/ldap/ldap.conf options in dict
- # FIXME: possibly not hardcode these options in?
- ldapopts=["URI","BASE","TLS_CACERTDIR"]
- results={}
- tmplist=[]
- for i in ldapopts:
- t=self.do_regex_find_all(r"^(%s)\s+(.*)" % i,"/etc/ldap/ldap.conf")
- for x in t:
- results[x[0]]=x[1].rstrip("\n")
- return results
+ def setup(self):
+ super(DebianLdap, self).setup()
def setup(self):
self.add_copy_specs(["/etc/ldap/ldap.conf", "/etc/ldap/slapd.d"])
- def postproc(self):
- self.do_file_sub("/etc/ldap/ldap.conf", r"(\s*bindpw\s*)\S+", r"\1***")
diff --git a/sos/plugins/libraries.py b/sos/plugins/libraries.py
index 32db9c82..222df5a4 100644
--- a/sos/plugins/libraries.py
+++ b/sos/plugins/libraries.py
@@ -24,5 +24,5 @@ class libraries(Plugin, RedHatPlugin, UbuntuPlugin):
def setup(self):
self.add_copy_specs(["/etc/ld.so.conf", "/etc/ld.so.conf.d"])
if self.get_option("ldconfigv"):
- self.add_cmd_output("/sbin/ldconfig -v -N -X")
- self.add_cmd_output("/sbin/ldconfig -p -N -X")
+ self.add_cmd_output("ldconfig -v -N -X")
+ self.add_cmd_output("ldconfig -p -N -X")
diff --git a/sos/plugins/logrotate.py b/sos/plugins/logrotate.py
index 1886c17c..960e4b7e 100644
--- a/sos/plugins/logrotate.py
+++ b/sos/plugins/logrotate.py
@@ -19,7 +19,7 @@ class logrotate(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""
def setup(self):
- self.add_cmd_output("/usr/sbin/logrotate --debug /etc/logrotate.conf",
+ self.add_cmd_output("logrotate --debug /etc/logrotate.conf",
suggest_filename = "logrotate_debug")
self.add_copy_specs([
"/etc/logrotate*",
diff --git a/sos/plugins/lsbrelease.py b/sos/plugins/lsbrelease.py
index 4d576556..e3e996e9 100644
--- a/sos/plugins/lsbrelease.py
+++ b/sos/plugins/lsbrelease.py
@@ -21,6 +21,6 @@ class lsbrelease(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""
def setup(self):
- self.add_cmd_output("/usr/bin/lsb_release -a")
- self.add_cmd_output("/usr/bin/lsb_release -d", suggest_filename = "lsb_release", root_symlink = "lsb-release")
+ 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*")
diff --git a/sos/plugins/maas.py b/sos/plugins/maas.py
index 9d68d1f9..0ef61384 100644
--- a/sos/plugins/maas.py
+++ b/sos/plugins/maas.py
@@ -25,5 +25,5 @@ class maas(Plugin, UbuntuPlugin):
"/var/lib/maas",
"/var/log/maas*"])
self.add_cmd_output("maas dumpdata")
- self.add_cmd_output("/usr/bin/pg_dumpall")
+ self.add_cmd_output("pg_dumpall")
diff --git a/sos/plugins/memory.py b/sos/plugins/memory.py
index e5efd5c2..1124b575 100644
--- a/sos/plugins/memory.py
+++ b/sos/plugins/memory.py
@@ -25,6 +25,6 @@ class memory(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"/proc/slabinfo",
"/proc/pagetypeinfo"])
- self.add_cmd_output("/bin/dmesg | grep -e 'e820.' -e 'aperature.'")
- self.add_cmd_output("/usr/bin/free", root_symlink = "free")
- self.add_cmd_output("/usr/bin/free -m")
+ self.add_cmd_output("dmesg | grep -e 'e820.' -e 'aperature.'")
+ self.add_cmd_output("free", root_symlink = "free")
+ self.add_cmd_output("free -m")
diff --git a/sos/plugins/mrggrid.py b/sos/plugins/mrggrid.py
index 31bf29bc..2044985b 100644
--- a/sos/plugins/mrggrid.py
+++ b/sos/plugins/mrggrid.py
@@ -19,4 +19,4 @@ class mrggrid(Plugin, RedHatPlugin):
"""
def setup(self):
self.add_copy_spec("/etc/condor/condor_config")
- self.add_copy_spec("/usr/bin/condor_status")
+ self.add_copy_spec("condor_status")
diff --git a/sos/plugins/mysql.py b/sos/plugins/mysql.py
index fc7b1200..e3c971fe 100644
--- a/sos/plugins/mysql.py
+++ b/sos/plugins/mysql.py
@@ -20,35 +20,33 @@ class Mysql(Plugin):
"""
plugin_name = "mysql"
+ mysql_cnf = "/etc/my.cnf"
def setup(self):
super(Mysql, self).setup()
+ self.add_copy_specs([self.mysql_cnf,
+ "/var/log/mysql*"])
+
class RedHatMysql(Mysql, RedHatPlugin):
"""MySQL related information for RedHat based distributions
"""
- files = ('/etc/my.cnf',)
packages = ('mysql-server', 'mysql')
def setup(self):
+ self.mysql_cnf = "/etc/my.cnf"
super(RedHatMysql, self).setup()
- self.add_copy_specs([
- "/etc/my.cnf",
- "/etc/sysconfig/network",
- "/etc/ld.so.conf.d/mysql*",
- "/var/log/mysql*"])
+ self.add_copy_spec("/etc/ld.so.conf.d/mysql*")
+
class DebianMysql(Mysql, DebianPlugin, UbuntuPlugin):
"""MySQL related information for Debian based distributions
"""
- files = ('/etc/mysql/my.cnf',)
packages = ('mysql-server', 'mysql-common')
def setup(self):
+ self.mysql_cnf = "/etc/mysql/my.cnf"
super(DebianMysql, self).setup()
- self.add_copy_specs([
- "/etc/mysql/my.cnf",
- "/etc/mysql/conf.d/mysql*",
- "/var/log/mysql*"])
+ self.add_copy_spec("/etc/mysql/conf.d/mysql*")
diff --git a/sos/plugins/named.py b/sos/plugins/named.py
index e479b3c9..8a347f8e 100644
--- a/sos/plugins/named.py
+++ b/sos/plugins/named.py
@@ -14,13 +14,24 @@
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
import commands
-from os.path import normpath, join, exists
class Named(Plugin):
"""named related information
"""
plugin_name = "named"
+ named_conf = "/etc/named.conf"
+ config_files = named_conf
+
+ def setup(self):
+ for cfg in config_files:
+ if exists(cfg):
+ self.add_copy_spec(cfg)
+ self.add_copy_spec(self.get_dns_dir(cfg))
+ self.add_forbidden_path(join(self.get_dns_dir(cfg),
+ "chroot/dev"))
+ self.add_forbidden_path(join(self.get_dns_dir(cfg),
+ "chroot/proc"))
def get_dns_dir(self, config_file):
""" grab directory path from named{conf,boot}
@@ -31,34 +42,30 @@ class Named(Plugin):
else:
return ""
+ def postproc(self):
+ match = r"(\s*arg \"password )[^\"]*"
+ subst = r"\1******"
+ self.do_file_sub(named_conf, match, subst)
+
+
class RedHatNamed(Named, RedHatPlugin):
"""named related information for RedHat based distribution
"""
- files = ('/etc/named.conf', '/etc/sysconfig/named')
+ named_conf = "/etc/named.conf"
+ config_files = ("/etc/named.conf",
+ "/etc/named.boot")
+ files = (named_conf, '/etc/sysconfig/named')
packages = ('bind',)
def setup(self):
super(RedHatNamed, self).setup()
- config_files = ("/etc/named.conf",
- "/etc/named.boot")
- for cfg in config_files:
- if exists(cfg):
- self.add_copy_spec(cfg)
- self.add_copy_spec(self.get_dns_dir(cfg))
- self.add_forbidden_path(join(self.get_dns_dir(cfg),"chroot/dev"))
- self.add_forbidden_path(join(self.get_dns_dir(cfg),"chroot/proc"))
-
self.add_copy_spec("/etc/named/")
self.add_copy_spec("/etc/sysconfig/named")
self.add_cmd_output("klist -ket /etc/named.keytab")
self.add_forbidden_path("/etc/named.keytab")
return
- def postproc(self):
- match = r"(\s*arg \"password )[^\"]*"
- subst = r"\1******"
- self.do_file_sub("/etc/named.conf", match, subst)
class DebianNamed(Named, DebianPlugin, UbuntuPlugin):
"""named related information for Debian based distribution
@@ -66,23 +73,13 @@ class DebianNamed(Named, DebianPlugin, UbuntuPlugin):
files = ('/etc/bind/named.conf')
packages = ('bind9',)
-
- def setup(self):
- super(DebianNamed, self).setup()
- config_files = ("/etc/bind/named.conf",
+ named_conf = "/etc/bind/named.conf"
+ config_files = (named_conf,
"/etc/bind/named.conf.options",
"/etc/bind/named.conf.local")
- for cfg in config_files:
- if exists(cfg):
- self.add_copy_spec(cfg)
- self.add_copy_spec(self.get_dns_dir(cfg))
- self.add_forbidden_path(join(self.get_dns_dir(cfg),"chroot/dev"))
- self.add_forbidden_path(join(self.get_dns_dir(cfg),"chroot/proc"))
+ def setup(self):
+ super(DebianNamed, self).setup()
self.add_copy_spec("/etc/bind/")
return
- def postproc(self):
- match = r"(\s*arg \"password )[^\"]*"
- subst = r"\1******"
- self.do_file_sub("/etc/bind/named.conf", match, subst)
diff --git a/sos/plugins/netdump.py b/sos/plugins/netdump.py
index 235dd5f7..964e14e8 100644
--- a/sos/plugins/netdump.py
+++ b/sos/plugins/netdump.py
@@ -13,7 +13,6 @@
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin
-from os.path import exists
class netdump(Plugin, RedHatPlugin):
"""Netdump Configuration Information
diff --git a/sos/plugins/networking.py b/sos/plugins/networking.py
index 595dcd9e..8e1fb295 100644
--- a/sos/plugins/networking.py
+++ b/sos/plugins/networking.py
@@ -20,6 +20,9 @@ class Networking(Plugin):
"""network related information
"""
plugin_name = "networking"
+ trace_host = "www.example.com"
+ option_list = [("traceroute", "collects a traceroute to %s" % trace_host,
+ "slow", False)]
def setup(self):
super(Networking, self).setup()
@@ -58,9 +61,9 @@ class Networking(Plugin):
relevant rules in that table """
- (status, output, time) = self.call_ext_prog("/sbin/lsmod | grep -q "+tablename)
+ (status, output, time) = self.call_ext_prog("lsmod | grep -q "+tablename)
if status == 0:
- cmd = "/sbin/iptables -t "+tablename+" -nvL"
+ cmd = "iptables -t "+tablename+" -nvL"
self.add_cmd_output(cmd)
def setup(self):
@@ -72,77 +75,78 @@ class Networking(Plugin):
"/etc/xinetd.conf",
"/etc/xinetd.d",
"/etc/host*",
- "/etc/resolv.conf"])
- ip_addr_file=self.get_cmd_output_now("/sbin/ip -o addr", root_symlink = "ip_addr")
- ip_addr_out=self.call_ext_prog("/sbin/ip -o addr")
- self.add_cmd_output("/sbin/route -n", root_symlink = "route")
+ "/etc/resolv.conf"
+ "/etc/network*",
+ "/etc/NetworkManager/NetworkManager.conf",
+ "/etc/NetworkManager/system-connections",
+ "/etc/dnsmasq*"])
+
+ ip_addr_file=self.get_cmd_output_now("ip -o addr", root_symlink = "ip_addr")
+ ip_addr_out=self.call_ext_prog("ip -o addr")
+ self.add_cmd_output("route -n", root_symlink = "route")
self.collect_iptable("filter")
self.collect_iptable("nat")
self.collect_iptable("mangle")
- self.add_cmd_output("/bin/netstat -s")
- self.add_cmd_output("/bin/netstat -agn")
- self.add_cmd_output("/bin/netstat -neopa", root_symlink = "netstat")
- self.add_cmd_output("/sbin/ip route show table all")
- self.add_cmd_output("/sbin/ip -6 route show table all")
- self.add_cmd_output("/sbin/ip link")
- self.add_cmd_output("/sbin/ip address")
- self.add_cmd_output("/sbin/ifenslave -a")
- self.add_cmd_output("/sbin/ip mroute show")
- self.add_cmd_output("/sbin/ip maddr show")
- self.add_cmd_output("/sbin/ip neigh show")
+ self.add_cmd_output("netstat -s")
+ self.add_cmd_output("netstat -agn")
+ self.add_cmd_output("netstat -neopa", root_symlink = "netstat")
+ self.add_cmd_output("ip route show table all")
+ self.add_cmd_output("ip -6 route show table all")
+ self.add_cmd_output("ip link")
+ self.add_cmd_output("ip address")
+ self.add_cmd_output("ifenslave -a")
+ self.add_cmd_output("ip mroute show")
+ self.add_cmd_output("ip maddr show")
+ self.add_cmd_output("ip neigh show")
if ip_addr_out:
for eth in self.get_interface_name(ip_addr_out):
- self.add_cmd_output("/sbin/ethtool "+eth)
- self.add_cmd_output("/sbin/ethtool -i "+eth)
- self.add_cmd_output("/sbin/ethtool -k "+eth)
- self.add_cmd_output("/sbin/ethtool -S "+eth)
- self.add_cmd_output("/sbin/ethtool -a "+eth)
- self.add_cmd_output("/sbin/ethtool -c "+eth)
- self.add_cmd_output("/sbin/ethtool -g "+eth)
- self.add_cmd_output("/sbin/ethtool -g "+eth)
-
- if os.path.exists("/usr/sbin/brctl"):
- brctl_file=self.add_cmd_output("/usr/sbin/brctl show")
- brctl_out=self.call_ext_prog("/usr/sbin/brctl show")
+ self.add_cmd_output("ethtool "+eth)
+ self.add_cmd_output("ethtool -i "+eth)
+ self.add_cmd_output("ethtool -k "+eth)
+ self.add_cmd_output("ethtool -S "+eth)
+ self.add_cmd_output("ethtool -a "+eth)
+ self.add_cmd_output("ethtool -c "+eth)
+ self.add_cmd_output("ethtool -g "+eth)
+
+ if os.path.exists("brctl"):
+ brctl_file=self.add_cmd_output("brctl show")
+ brctl_out=self.call_ext_prog("brctl show")
if brctl_out:
for br_name in self.get_bridge_name(brctl_out):
- self.add_cmd_output("/usr/sbin/brctl showstp "+br_name)
+ self.add_cmd_output("brctl showstp "+br_name)
+
+ if self.get_option("traceroute"):
+ self.add_cmd_output("/bin/traceroute -n %s" % trace_host)
+
return
+ def postproc(self):
+ for root, dirs, files in os.walk("/etc/NetworkManager/system-connections"):
+ for net_conf in files:
+ self.do_file_sub("/etc/NetworkManager/system-connections/"+net_conf, r"psk=(.*)",r"psk=***")
+
class RedHatNetworking(Networking, RedHatPlugin):
"""network related information for RedHat based distribution
"""
- option_list = [("traceroute", "collects a traceroute to rhn.redhat.com", "slow", False)]
-
+ trace_host = "rhn.redhat.com"
def setup(self):
super(RedHatNetworking, self).setup()
- if self.get_option("traceroute"):
- self.add_cmd_output("/bin/traceroute -n rhn.redhat.com")
-
class UbuntuNetworking(Networking, UbuntuPlugin):
"""network related information for Ubuntu based distribution
"""
- option_list = [("traceroute", "collects a traceroute to archive.ubuntu.com", "slow", False)]
+ trace_host = "archive.ubuntu.com"
def setup(self):
super(UbuntuNetworking, self).setup()
self.add_copy_specs([
- "/etc/network*",
- "/etc/NetworkManager/NetworkManager.conf",
- "/etc/NetworkManager/system-connections",
- "/etc/resolvconf",
- "/etc/dnsmasq*",
+ "/etc/resolvconf",
"/etc/ufw",
"/var/log/ufw.Log",
"/etc/resolv.conf"])
self.add_cmd_output("/usr/sbin/ufw status")
self.add_cmd_output("/usr/sbin/ufw app list")
if self.get_option("traceroute"):
- self.add_cmd_output("/usr/sbin/traceroute -n archive.ubuntu.com")
+ self.add_cmd_output("/usr/sbin/traceroute -n %s" % trace_host)
- def postproc(self):
- for root, dirs, files in os.walk("/etc/NetworkManager/system-connections"):
- for net_conf in files:
- self.do_file_sub("/etc/NetworkManager/system-connections/"+net_conf, r"psk=(.*)",r"psk=***")
diff --git a/sos/plugins/nfsserver.py b/sos/plugins/nfsserver.py
index 1229dcf1..abe70e1d 100644
--- a/sos/plugins/nfsserver.py
+++ b/sos/plugins/nfsserver.py
@@ -39,5 +39,5 @@ class nfsserver(Plugin, RedHatPlugin):
"/var/lib/nfs/etab",
"/var/lib/nfs/xtab",
"/var/lib/nfs/rmtab"])
- self.add_cmd_output("/usr/sbin/rpcinfo -p localhost")
- self.add_cmd_output("/usr/sbin/nfsstat -a")
+ self.add_cmd_output("rpcinfo -p localhost")
+ self.add_cmd_output("nfsstat -a")
diff --git a/sos/plugins/ntp.py b/sos/plugins/ntp.py
index 86fcd115..dff9f985 100644
--- a/sos/plugins/ntp.py
+++ b/sos/plugins/ntp.py
@@ -23,7 +23,9 @@ class Ntp(Plugin):
packages = ('ntp',)
def setup(self):
- self.add_cmd_output("/usr/sbin/ntptime")
+ self.add_copy_spec("/etc/ntp.conf")
+ self.add_cmd_output("ntptime")
+
class RedHatNtp(Ntp, RedHatPlugin):
"""NTP related information for RedHat based distributions
@@ -31,7 +33,9 @@ class RedHatNtp(Ntp, RedHatPlugin):
def setup(self):
super(RedHatNtp, self).setup()
- self.add_cmd_output("/usr/bin/ntpstat")
+ self.add_copy_spec("/etc/sysconfig/ntpd")
+ self.add_cmd_output("ntpstat")
+
class DebianNtp(Ntp, DebianPlugin, UbuntuPlugin):
"""NTP related information for Debian based distributions
@@ -41,4 +45,3 @@ class DebianNtp(Ntp, DebianPlugin, UbuntuPlugin):
super(DebianNtp, self).setup()
self.add_copy_spec('/etc/default/ntp')
-
diff --git a/sos/plugins/openstack.py b/sos/plugins/openstack.py
index b6ea1756..48355792 100644
--- a/sos/plugins/openstack.py
+++ b/sos/plugins/openstack.py
@@ -32,7 +32,12 @@ class DebianOpenStack(openstack, DebianPlugin, UbuntuPlugin):
"""OpenStack related information for Debian based distributions
"""
- packages = ('glance',
+ packages = ('cinder-api',
+ 'cinder-backup',
+ 'cinder-common',
+ 'cinder-scheduler',
+ 'cinder-volume',
+ 'glance',
'glance-api',
'glance-client',
'glance-common',
@@ -73,6 +78,8 @@ class DebianOpenStack(openstack, DebianPlugin, UbuntuPlugin):
'swift-object',
'swift-proxy',
'swauth',
+ 'python-cinder',
+ 'python-cinderclient',
'python-django-horizon',
'python-glance',
'python-keystone',
@@ -88,40 +95,48 @@ class DebianOpenStack(openstack, DebianPlugin, UbuntuPlugin):
def setup(self):
# Nova
- if os.path.exists("/usr/bin/nova-manage"):
+ if os.path.exists("nova-manage"):
self.add_cmd_output(
- "/usr/bin/nova-manage config list 2>/dev/null | sort",
+ "nova-manage config list 2>/dev/null | sort",
suggest_filename="nova_config_list")
self.add_cmd_output(
- "/usr/bin/nova-manage service list 2>/dev/null",
+ "nova-manage service list 2>/dev/null",
suggest_filename="nova_service_list")
self.add_cmd_output(
- "/usr/bin/nova-manage db version 2>/dev/null",
+ "nova-manage db version 2>/dev/null",
suggest_filename="nova_db_version")
self.add_cmd_output(
- "/usr/bin/nova-manage fixed list 2>/dev/null",
+ "nova-manage fixed list 2>/dev/null",
suggest_filename="nova_fixed_ip_list")
self.add_cmd_output(
- "/usr/bin/nova-manage floating list 2>/dev/null",
+ "nova-manage floating list 2>/dev/null",
suggest_filename="nova_floating_ip_list")
self.add_cmd_output(
- "/usr/bin/nova-manage flavor list 2>/dev/null",
+ "nova-manage flavor list 2>/dev/null",
suggest_filename="nova_flavor_list")
self.add_cmd_output(
- "/usr/bin/nova-manage network list 2>/dev/null",
+ "nova-manage network list 2>/dev/null",
suggest_filename="nova_network_list")
self.add_cmd_output(
- "/usr/bin/nova-manage vm list 2>/dev/null",
+ "nova-manage vm list 2>/dev/null",
suggest_filename="nova_vm_list")
self.add_copy_specs(["/etc/nova/",
"/var/log/nova/",
"/etc/default/nova-volume",
"/etc/sudoers.d/nova_sudoers",
"/etc/logrotate.d/nova-*"])
+ # Cinder
+ if os.path.exists("/usr/bin/cinder-manage"):
+ self.addCmdOutput(
+ "/usr/bin/cinder-manage db version",
+ suggest_filename="cinder_db_version")
+ self.addCopySpecs(["/etc/cinder/",
+ "/var/log/cinder/",
+ "/etc/logrotate.d/cinder-*"])
# Glance
- if os.path.exists("/usr/bin/glance-manage"):
+ if os.path.exists("glance-manage"):
self.add_cmd_output(
- "/usr/bin/glance-manage db_version",
+ "glance-manage db_version",
suggest_filename="glance_db_version")
self.add_copy_specs(["/etc/glance/",
"/var/log/glance/",
@@ -163,7 +178,7 @@ class RedHatOpenStack(openstack, RedHatPlugin):
# If RHEL or Fedora then invoke script for openstack-status
if (os.path.isfile('/etc/redhat-release')
or os.path.isfile('/etc/fedora-release')):
- self.add_cmd_output("/usr/bin/openstack-status")
+ self.add_cmd_output("openstack-status")
# Nova
self.add_copy_specs(["/etc/nova/",
diff --git a/sos/plugins/openswan.py b/sos/plugins/openswan.py
index 6d17136d..2c4a1c01 100644
--- a/sos/plugins/openswan.py
+++ b/sos/plugins/openswan.py
@@ -15,7 +15,6 @@
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin
-from os.path import exists
class openswan(Plugin, RedHatPlugin):
"""ipsec related information
@@ -28,5 +27,5 @@ class openswan(Plugin, RedHatPlugin):
self.add_copy_specs([
"/etc/ipsec.conf",
"/etc/ipsec.d"])
- self.add_cmd_output("/usr/sbin/ipsec verify")
- self.add_cmd_output("/usr/sbin/ipsec barf")
+ self.add_cmd_output("ipsec verify")
+ self.add_cmd_output("ipsec barf")
diff --git a/sos/plugins/pam.py b/sos/plugins/pam.py
index 47f2b439..307a405b 100644
--- a/sos/plugins/pam.py
+++ b/sos/plugins/pam.py
@@ -19,23 +19,27 @@ class Pam(Plugin):
"""
plugin_name = "pam"
+ security_libs = ""
def setup(self):
self.add_copy_spec("/etc/pam.d")
self.add_copy_spec("/etc/security")
+ self.add_cmd_output("ls -lanF %s" % self.security_libs)
class RedHatPam(Pam, RedHatPlugin):
"""PAM related information for RedHat based distribution
"""
+ security_libs = "/lib*/security"
+
def setup(self):
super(RedHatPam, self).setup()
- self.add_cmd_output("/bin/ls -lanF /lib*/security")
class DebianPam(Pam, DebianPlugin, UbuntuPlugin):
"""PAM related information for Debian based distribution
"""
+ security_libs = "/lib/x86_64-linux-gnu/security"
+
def setup(self):
super(DebianPam, self).setup()
- self.add_cmd_output("/bin/ls -lanF /lib/x86_64-linux-gnu/security")
diff --git a/sos/plugins/postfix.py b/sos/plugins/postfix.py
index ed8e2fdd..6f0f9b4d 100644
--- a/sos/plugins/postfix.py
+++ b/sos/plugins/postfix.py
@@ -26,7 +26,7 @@ class Postfix(Plugin):
self.add_copy_specs([
"/etc/postfix/main.cf",
"/etc/postfix/master.cf"])
- self.add_cmd_output("/usr/sbin/postconf")
+ self.add_cmd_output("postconf")
class RedHatPostfix(Postfix, RedHatPlugin):
"""mail server related information for RedHat based distributions
diff --git a/sos/plugins/postgresql.py b/sos/plugins/postgresql.py
index 1ae269fb..0a8e5ac3 100644
--- a/sos/plugins/postgresql.py
+++ b/sos/plugins/postgresql.py
@@ -1,15 +1,14 @@
import os
-import fnmatch
-import shlex
-import subprocess
import tempfile
-from sos.plugins import Plugin, RedHatPlugin
+from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin
from sos.utilities import find
-class postgresql(Plugin, RedHatPlugin):
+class PostgreSQL(Plugin):
"""PostgreSQL related information"""
+ plugin_name = "postgresql"
+
packages = ('postgresql',)
tmp_dir = None
@@ -44,6 +43,17 @@ class postgresql(Plugin, RedHatPlugin):
else:
self.add_alert("WARN: password must be supplied to dump a database.")
+ def postproc(self):
+ import shutil
+ if self.tmp_dir:
+ shutil.rmtree(self.tmp_dir)
+
+class RedHatPostgreSQL(PostgreSQL, RedHatPlugin):
+ """PostgreSQL related information for Red Hat distributions"""
+
+ def setup(self):
+ super(RedHatPostgreSQL, self).setup()
+
# Copy PostgreSQL log files.
for file in find("*.log", self.get_option("pghome")):
self.add_copy_spec(file)
@@ -54,8 +64,22 @@ class postgresql(Plugin, RedHatPlugin):
self.add_copy_spec(os.path.join(self.get_option("pghome"), "data" , "PG_VERSION"))
self.add_copy_spec(os.path.join(self.get_option("pghome"), "data" , "postmaster.opts"))
+class DebianPostgreSQL(PostgreSQL, DebianPlugin, UbuntuPlugin):
+ """PostgreSQL related information for Debian/Ubuntu distributions"""
+
+ def setup(self):
+ super(DebianPostgreSQL, self).setup()
+
+ # Copy PostgreSQL log files.
+ self.add_copy_spec("/var/log/postgresql/*.log")
+ # Copy PostgreSQL config files.
+ self.add_copy_spec("/etc/postgresql/*/main/*.conf")
+
+ self.add_copy_spec("/var/lib/postgresql/*/main/PG_VERSION")
+ self.add_copy_spec("/var/lib/postgresql/*/main/postmaster.opts")
+
+
+
+
+
- def postproc(self):
- import shutil
- if self.tmp_dir:
- shutil.rmtree(self.tmp_dir)
diff --git a/sos/plugins/ppp.py b/sos/plugins/ppp.py
index 8f04a3f4..76e44046 100644
--- a/sos/plugins/ppp.py
+++ b/sos/plugins/ppp.py
@@ -15,7 +15,6 @@
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin
-from os.path import exists
class ppp(Plugin, RedHatPlugin):
"""ppp, wvdial and rp-pppoe related information
@@ -29,4 +28,4 @@ class ppp(Plugin, RedHatPlugin):
"/etc/wvdial.conf",
"/etc/ppp",
"/var/log/ppp"])
- self.add_cmd_output("/usr/sbin/adsl-status")
+ self.add_cmd_output("adsl-status")
diff --git a/sos/plugins/printing.py b/sos/plugins/printing.py
index fc85af22..45bea20a 100644
--- a/sos/plugins/printing.py
+++ b/sos/plugins/printing.py
@@ -26,6 +26,6 @@ class printing(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"/etc/cups/lpoptions",
"/etc/cups/ppd/*.ppd"])
self.add_copy_spec_limit("/var/log/cups", sizelimit=self.option_enabled("cupslogsize"))
- self.add_cmd_output("/usr/bin/lpstat -t")
- self.add_cmd_output("/usr/bin/lpstat -s")
- self.add_cmd_output("/usr/bin/lpstat -d")
+ self.add_cmd_output("lpstat -t")
+ self.add_cmd_output("lpstat -s")
+ self.add_cmd_output("lpstat -d")
diff --git a/sos/plugins/process.py b/sos/plugins/process.py
index f90dab83..3b06c7c4 100644
--- a/sos/plugins/process.py
+++ b/sos/plugins/process.py
@@ -13,19 +13,14 @@
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
-import time
import os
-class process(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
+class Process(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""process information
"""
def setup(self):
- self.add_cmd_output("/bin/ps auxwww", root_symlink = "ps")
- self.add_cmd_output("/bin/ps auxwwwm")
- self.add_cmd_output("/bin/ps alxwww")
- self.add_cmd_output("/usr/bin/pstree", root_symlink = "pstree")
- self.add_cmd_output("/usr/sbin/lsof -b +M -n -l", root_symlink = "lsof")
-
- def find_mountpoint(s):
- if (os.path.ismount(s) or len(s)==0): return s
- else: return mountpoint(os.path.split(s)[0])
+ self.add_cmd_output("ps auxwww", root_symlink = "ps")
+ self.add_cmd_output("ps auxwwwm")
+ self.add_cmd_output("ps alxwww")
+ self.add_cmd_output("pstree", root_symlink = "pstree")
+ self.add_cmd_output("lsof -b +M -n -l", root_symlink = "lsof")
diff --git a/sos/plugins/pxe.py b/sos/plugins/pxe.py
index 3284bf34..fcb1a4b7 100644
--- a/sos/plugins/pxe.py
+++ b/sos/plugins/pxe.py
@@ -19,6 +19,8 @@ class Pxe(Plugin):
"""PXE related information
"""
+ option_list = [("tftpboot", 'gathers content from the tftpboot path',
+ 'slow', False)]
plugin_name = "pxe"
@@ -29,8 +31,6 @@ class RedHatPxe(Pxe, RedHatPlugin):
files = ('/usr/sbin/pxeos',)
packages = ('system-config-netboot-cmd',)
- option_list = [("tftpboot", 'gathers content in /tftpboot', 'slow', False)]
-
def setup(self):
super(RedHatPxe, self).setup()
self.add_cmd_output("/usr/sbin/pxeos -l")
@@ -38,14 +38,13 @@ class RedHatPxe(Pxe, RedHatPlugin):
if self.get_option("tftpboot"):
self.add_copy_spec("/tftpboot")
+
class DebianPxe(Pxe, DebianPlugin, UbuntuPlugin):
"""PXE related information for Ubuntu based distributions
"""
packages = ('tftpd-hpa',)
- option_list = [("tftpboot", 'gathers content in /var/lib/tftpboot', 'slow', False)]
-
def setup(self):
super(DebianPxe, self).setup()
self.add_copy_spec("/etc/dhcp/dhcpd.conf")
diff --git a/sos/plugins/qpidd.py b/sos/plugins/qpidd.py
index a59251bf..8c3820d4 100644
--- a/sos/plugins/qpidd.py
+++ b/sos/plugins/qpidd.py
@@ -22,15 +22,15 @@ class qpidd(Plugin, RedHatPlugin):
def setup(self):
""" performs data collection for mrg """
- self.add_cmd_output("/usr/bin/qpid-stat -e")
- self.add_cmd_output("/usr/bin/qpid-stat -b")
- self.add_cmd_output("/usr/bin/qpid-config")
- self.add_cmd_output("/usr/bin/qpid-config -b exchanges")
- self.add_cmd_output("/usr/bin/qpid-config -b queues")
- self.add_cmd_output("/usr/bin/qpid-stat -c")
- self.add_cmd_output("/usr/bin/qpid-route link list")
- self.add_cmd_output("/usr/bin/qpid-route route list")
- self.add_cmd_output("/bin/ls -lanR /var/lib/qpidd")
+ self.add_cmd_output("qpid-stat -e")
+ self.add_cmd_output("qpid-stat -b")
+ self.add_cmd_output("qpid-config")
+ self.add_cmd_output("qpid-config -b exchanges")
+ self.add_cmd_output("qpid-config -b queues")
+ self.add_cmd_output("qpid-stat -c")
+ self.add_cmd_output("qpid-route link list")
+ self.add_cmd_output("qpid-route route list")
+ self.add_cmd_output("ls -lanR /var/lib/qpidd")
self.add_copy_specs([
"/etc/qpidd.conf",
diff --git a/sos/plugins/quagga.py b/sos/plugins/quagga.py
index 28ba983f..703b4a54 100644
--- a/sos/plugins/quagga.py
+++ b/sos/plugins/quagga.py
@@ -15,7 +15,6 @@
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin
-from os.path import exists
class quagga(Plugin, RedHatPlugin):
"""quagga related information
diff --git a/sos/plugins/radius.py b/sos/plugins/radius.py
index 972b179c..e814526e 100644
--- a/sos/plugins/radius.py
+++ b/sos/plugins/radius.py
@@ -15,7 +15,6 @@
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
-from os.path import exists
class radius(Plugin):
"""radius related information
diff --git a/sos/plugins/rhn.py b/sos/plugins/rhn.py
index 0686c8bd..73e6c0e7 100644
--- a/sos/plugins/rhn.py
+++ b/sos/plugins/rhn.py
@@ -66,16 +66,16 @@ class rhn(Plugin, RedHatPlugin):
"/var/log/nocpulse/TSDBLocalQueue/TSDBLocalQueue.log"])
self.add_copy_spec("/root/ssl-build")
- self.add_cmd_output("/usr/bin/rhn-schema-version",
+ self.add_cmd_output("rhn-schema-version",
root_symlink = "database-schema-version")
- self.add_cmd_output("/usr/bin/rhn-charsets",
+ self.add_cmd_output("rhn-charsets",
root_symlink = "database-character-sets")
if self.satellite:
self.add_copy_specs(["/etc/tnsnames.ora", "/etc/jabberd",
"/etc/tomcat6/", "/var/log/tomcat6/"])
- if os.path.exists("/usr/bin/spacewalk-debug"):
- self.add_cmd_output("/usr/bin/spacewalk-debug --dir %s"
+ if os.path.exists("spacewalk-debug"):
+ self.add_cmd_output("spacewalk-debug --dir %s"
% os.path.join(self.commons['dstroot'],
"sos_commands/rhn"))
diff --git a/sos/plugins/rpm.py b/sos/plugins/rpm.py
index 3acf7ec1..02a0de69 100644
--- a/sos/plugins/rpm.py
+++ b/sos/plugins/rpm.py
@@ -24,12 +24,12 @@ class rpm(Plugin, RedHatPlugin):
self.add_copy_spec("/var/log/rpmpkgs")
if self.get_option("rpmq"):
- self.add_cmd_output("/bin/rpm -qa --qf="
+ self.add_cmd_output("rpm -qa --qf="
"\"%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}~~"
"%{INSTALLTIME:date}\t%{INSTALLTIME}\t%{VENDOR}\n\""
- " --nosignature --nodigest | /bin/awk -F '~~' "
+ " --nosignature --nodigest | awk -F '~~' "
"'{printf \"%-59s %s\\n\",$1,$2}'|sort",
root_symlink = "installed-rpms")
if self.get_option("rpmva"):
- self.add_cmd_output("/bin/rpm -Va", root_symlink = "rpm-Va", timeout = 3600)
+ self.add_cmd_output("rpm -Va", root_symlink = "rpm-Va", timeout = 3600)
diff --git a/sos/plugins/s390.py b/sos/plugins/s390.py
index 5b5e8274..82164a4d 100644
--- a/sos/plugins/s390.py
+++ b/sos/plugins/s390.py
@@ -14,7 +14,6 @@
## along with this program; if not, write to the Free Software
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-import os
from sos.plugins import Plugin, RedHatPlugin
class s390(Plugin, RedHatPlugin):
@@ -51,20 +50,20 @@ class s390(Plugin, RedHatPlugin):
"/etc/src_vipa.conf",
"/etc/ccwgroup.conf",
"/etc/chandev.conf"])
- self.add_cmd_output("/sbin/lscss")
- self.add_cmd_output("/sbin/lsdasd")
- self.add_cmd_output("/sbin/lstape")
+ self.add_cmd_output("lscss")
+ self.add_cmd_output("lsdasd")
+ self.add_cmd_output("lstape")
self.add_cmd_output("find /sys -type f")
self.add_cmd_output("find /proc/s390dbf -type f")
- self.add_cmd_output("/sbin/qethconf list_all")
- ret, dasd_dev, rtime = self.call_ext_prog("/bin/ls /dev/dasd?")
+ self.add_cmd_output("qethconf list_all")
+ ret, dasd_dev, rtime = self.call_ext_prog("ls /dev/dasd?")
for x in dasd_dev.split('\n'):
- self.add_cmd_output("/sbin/dasdview -x -i -j -l -f %s" % (x,))
- self.add_cmd_output("/sbin/fdasd -p %s" % (x,))
+ self.add_cmd_output("dasdview -x -i -j -l -f %s" % (x,))
+ self.add_cmd_output("fdasd -p %s" % (x,))
try:
rhelver = self.policy().rhel_version()
if rhelver == 5:
- self.add_cmd_output("/sbin/lsqeth")
- self.add_cmd_output("/sbin/lszfcp")
+ self.add_cmd_output("lsqeth")
+ self.add_cmd_output("lszfcp")
except:
rhelver = None
diff --git a/sos/plugins/samba.py b/sos/plugins/samba.py
index 2f34179f..d4e2fe82 100644
--- a/sos/plugins/samba.py
+++ b/sos/plugins/samba.py
@@ -23,19 +23,20 @@ class Samba(Plugin):
self.add_copy_specs([
"/etc/samba",
"/var/log/samba/*",])
- self.add_cmd_output("/usr/bin/testparm -s -v")
+ self.add_cmd_output("wbinfo -g")
+ self.add_cmd_output("wbinfo -u")
+ self.add_cmd_output("testparm -s -v")
+
class RedHatSamba(Samba, RedHatPlugin):
"""Samba related information for RedHat based distributions
"""
def setup(self):
super(RedHatSamba, self).setup()
+ # FIXME: krb5 specific
self.add_copy_specs([
"/etc/krb5.conf",
"/etc/krb5.keytab"])
- self.add_cmd_output("/usr/bin/wbinfo -g")
- self.add_cmd_output("/usr/bin/wbinfo -u")
- self.add_cmd_output("/usr/bin/testparm -s -v")
class DebianSamba(Samba, DebianPlugin, UbuntuPlugin):
"""Samba related information for Debian based distributions
diff --git a/sos/plugins/sar.py b/sos/plugins/sar.py
index 5a00372e..8bb9c37f 100644
--- a/sos/plugins/sar.py
+++ b/sos/plugins/sar.py
@@ -20,7 +20,7 @@ class sar(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""
sapath='/var/log/sa'
- sarcmd='/usr/bin/sar'
+ sarcmd='sar'
files = (sapath, sarcmd)
def setup(self):
@@ -51,7 +51,7 @@ class sar(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
if fname[0:2] == 'sa' and fname[2] != 'r':
sar_filename = 'sar' + fname[2:4]
if sar_filename not in dir_list:
- sar_command = "/bin/sh -c \"LANG=C /usr/bin/sar " \
+ sar_command = "sh -c \"LANG=C sar " \
+ "-A -f /var/log/sa/" + fname + "\""
self.add_cmd_output(sar_command, sar_filename)
self.add_copy_spec("/var/log/sa/sar*")
diff --git a/sos/plugins/selinux.py b/sos/plugins/selinux.py
index 0d3c6d3a..c3501eec 100644
--- a/sos/plugins/selinux.py
+++ b/sos/plugins/selinux.py
@@ -21,9 +21,8 @@ class selinux(Plugin, RedHatPlugin):
def setup(self):
# sestatus is always collected in check_enabled()
self.add_copy_spec("/etc/selinux")
- self.add_cmd_output("/usr/bin/selinuxconfig")
if self.get_option('fixfiles'):
- self.add_cmd_output("/sbin/fixfiles check")
+ self.add_cmd_output("fixfiles check")
self.add_forbidden_path("/etc/selinux/targeted")
if not self.policy().pkg_by_name('setroubleshoot'):
@@ -32,7 +31,7 @@ class selinux(Plugin, RedHatPlugin):
# Check for SELinux denials and capture raw output from sealert
if self.policy().default_runlevel() in self.policy().runlevel_by_service("setroubleshoot"):
# TODO: fixup regex for more precise matching
- sealert=do_regex_find_all(r"^.*setroubleshoot:.*(sealert\s-l\s.*)","/var/log/messages")
+ sealert=do_regex_findall(r"^.*setroubleshoot:.*(sealert\s-l\s.*)","/var/log/messages")
if sealert:
for i in sealert:
self.add_cmd_output("%s" % i)
@@ -40,7 +39,7 @@ class selinux(Plugin, RedHatPlugin):
"possible fixes stated in the sealert output.")
def check_enabled(self):
try:
- if self.get_cmd_output_now("/usr/sbin/sestatus", root_symlink = "sestatus").split(":")[1].strip() == "disabled":
+ if self.get_cmd_output_now("sestatus", root_symlink = "sestatus").split(":")[1].strip() == "disabled":
return False
except:
pass
diff --git a/sos/plugins/smartcard.py b/sos/plugins/smartcard.py
index 0488f019..969aa611 100644
--- a/sos/plugins/smartcard.py
+++ b/sos/plugins/smartcard.py
@@ -15,8 +15,6 @@
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin
-import os
-from time import time
class smartcard(Plugin, RedHatPlugin):
"""Smart Card related information
@@ -30,6 +28,6 @@ class smartcard(Plugin, RedHatPlugin):
"/etc/reader.conf",
"/etc/reader.conf.d/",
"/etc/pam_pkcs11/"])
- self.add_cmd_output("/usr/bin/pkcs11_inspect debug")
- self.add_cmd_output("/usr/bin/pklogin_finder debug")
- self.add_cmd_output("/bin/ls -nl /usr/lib*/pam_pkcs11/")
+ self.add_cmd_output("pkcs11_inspect debug")
+ self.add_cmd_output("pklogin_finder debug")
+ self.add_cmd_output("ls -nl /usr/lib*/pam_pkcs11/")
diff --git a/sos/plugins/soundcard.py b/sos/plugins/soundcard.py
index c52c57c4..b92b4c51 100644
--- a/sos/plugins/soundcard.py
+++ b/sos/plugins/soundcard.py
@@ -12,23 +12,43 @@
## along with this program; if not, write to the Free Software
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-from sos.plugins import Plugin, RedHatPlugin
+from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
import os
-class soundcard(Plugin, RedHatPlugin):
+class Soundcard(Plugin):
""" Sound card information
"""
+ plugin_name = "soundcard"
+
def default_enabled(self):
return False
def setup(self):
+ self.add_copy_spec("/proc/asound/*")
+ self.add_cmd_output("lspci | grep -i audio")
+ self.add_cmd_output("aplay -l")
+ self.add_cmd_output("aplay -L")
+ self.add_cmd_output("amixer")
+ self.add_cmd_output("lsmod | grep snd | awk '{print $1}'",\
+ suggest_filename = "sndmodules_loaded")
+
+class RedHatSoundcard(Soundcard, RedHatPlugin):
+ """ Sound card information for RedHat distros
+ """
+
+ def setup(self):
+ super(RedHatSoundcard, self).setup()
+
self.add_copy_specs([
- "/proc/asound/*",
"/etc/alsa/*",
"/etc/asound.*"])
- self.add_cmd_output("/sbin/lspci | grep -i audio")
- self.add_cmd_output("/usr/bin/aplay -l")
- self.add_cmd_output("/usr/bin/aplay -L")
- self.add_cmd_output("/usr/bin/amixer")
- self.add_cmd_output("/sbin/lsmod | /bin/grep snd | /bin/awk '{print $1}'", suggest_filename = "sndmodules_loaded")
+
+class DebianSoundcard(Soundcard, DebianPlugin, UbuntuPlugin):
+ """ Sound card information for Debian/Ubuntu distros
+ """
+
+ def setup(self):
+ super(DebianSoundcard, self).setup()
+
+ self.add_copy_spec("/etc/pulse/*")
diff --git a/sos/plugins/squid.py b/sos/plugins/squid.py
index a83c45a1..dae5759f 100644
--- a/sos/plugins/squid.py
+++ b/sos/plugins/squid.py
@@ -13,7 +13,6 @@
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
-import os
class squid(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""squid related information
diff --git a/sos/plugins/startup.py b/sos/plugins/startup.py
index 06c72f3c..76d85efe 100644
--- a/sos/plugins/startup.py
+++ b/sos/plugins/startup.py
@@ -22,7 +22,6 @@ class Startup(Plugin):
option_list = [("servicestatus", "get a status of all running services", "slow", False)]
def setup(self):
-
if self.get_option('servicestatus'):
self.add_cmd_output("/sbin/service --status-all")
self.add_cmd_output("/sbin/runlevel")
@@ -34,7 +33,6 @@ class RedHatStartup(Startup, RedHatPlugin):
def setup(self):
super(RedHatStartup, self).setup()
self.add_copy_spec("/etc/rc.d")
-
self.add_cmd_output("/sbin/chkconfig --list", root_symlink = "chkconfig")
class DebianStartup(Startup, DebianPlugin, UbuntuPlugin):
diff --git a/sos/plugins/sunrpc.py b/sos/plugins/sunrpc.py
index a59fa678..dff6ed80 100644
--- a/sos/plugins/sunrpc.py
+++ b/sos/plugins/sunrpc.py
@@ -14,7 +14,7 @@
## along with this program; if not, write to the Free Software
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
+from sos.plugins import Plugin, RedHatPlugin
class sunrpc(Plugin):
"""Sun RPC related information
@@ -30,7 +30,7 @@ class sunrpc(Plugin):
return False
def setup(self):
- self.add_cmd_output("/usr/sbin/rpcinfo -p localhost")
+ self.add_cmd_output("rpcinfo -p localhost")
return
class RedHatSunrpc(sunrpc, RedHatPlugin):
@@ -48,7 +48,7 @@ class RedHatSunrpc(sunrpc, RedHatPlugin):
# service = 'rpcbind-boot'
#
# def setup(self):
-# self.add_cmd_output("/usr/sbin/rpcinfo -p localhost")
+# self.add_cmd_output("rpcinfo -p localhost")
# return
diff --git a/sos/plugins/system.py b/sos/plugins/system.py
index f9e1e4d5..a3a76767 100644
--- a/sos/plugins/system.py
+++ b/sos/plugins/system.py
@@ -37,7 +37,7 @@ class RedHatSystem(system, RedHatPlugin):
self.add_forbidden_path(
"/proc/sys/net/ipv6/neigh/*/base_reachable_time")
- self.add_cmd_output("/usr/bin/crontab -l")
+ self.add_cmd_output("crontab -l")
class DebianSystem(system, DebianPlugin, UbuntuPlugin):
"""core system related information for Debian and Ubuntu
@@ -55,5 +55,5 @@ class DebianSystem(system, DebianPlugin, UbuntuPlugin):
self.add_forbidden_path(
"/proc/sys/net/ipv6/neigh/*/base_reachable_time")
- self.add_cmd_output("/usr/bin/crontab -l")
+ self.add_cmd_output("crontab -l")
diff --git a/sos/plugins/systemd.py b/sos/plugins/systemd.py
index 84a3e759..046fb227 100644
--- a/sos/plugins/systemd.py
+++ b/sos/plugins/systemd.py
@@ -14,8 +14,7 @@
## along with this program; if not, write to the Free Software
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
-import os
+from sos.plugins import Plugin, RedHatPlugin
class systemd(Plugin, RedHatPlugin):
""" Information on systemd and related subsystems
diff --git a/sos/plugins/systemtap.py b/sos/plugins/systemtap.py
index 23ccddc1..039a9b91 100644
--- a/sos/plugins/systemtap.py
+++ b/sos/plugins/systemtap.py
@@ -20,9 +20,9 @@ class systemtap(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""SystemTap information
"""
- files = ('/usr/bin/stap',)
+ files = ('stap',)
packages = ('systemtap', 'systemtap-runtime')
def setup(self):
- self.add_cmd_output("/usr/bin/stap -V 2")
- self.add_cmd_output("/bin/uname -r")
+ self.add_cmd_output("stap -V 2")
+ self.add_cmd_output("uname -r")
diff --git a/sos/plugins/sysvipc.py b/sos/plugins/sysvipc.py
index 8cb3b4aa..f1089495 100644
--- a/sos/plugins/sysvipc.py
+++ b/sos/plugins/sysvipc.py
@@ -26,4 +26,4 @@ class sysvipc(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"/proc/sysvipc/msg",
"/proc/sysvipc/sem",
"/proc/sysvipc/shm"])
- self.add_cmd_output("/usr/bin/ipcs")
+ self.add_cmd_output("ipcs")
diff --git a/sos/plugins/tftpserver.py b/sos/plugins/tftpserver.py
index 9374642d..4a4018f4 100644
--- a/sos/plugins/tftpserver.py
+++ b/sos/plugins/tftpserver.py
@@ -15,7 +15,6 @@
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin
-from os.path import exists
class tftpserver(Plugin, RedHatPlugin):
"""tftpserver related information
@@ -25,4 +24,4 @@ class tftpserver(Plugin, RedHatPlugin):
packages = ('tftp-server',)
def setup(self):
- self.add_cmd_output("/bin/ls -lanR /tftpboot")
+ self.add_cmd_output("ls -lanR /tftpboot")
diff --git a/sos/plugins/vmware.py b/sos/plugins/vmware.py
index 7836c7e8..d7d39f82 100644
--- a/sos/plugins/vmware.py
+++ b/sos/plugins/vmware.py
@@ -13,16 +13,15 @@
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin
-from os.path import exists
class vmware(Plugin, RedHatPlugin):
"""VMWare related information
"""
- files = ('/usr/bin/vmware','/usr/init.d/vmware-tools')
+ files = ('vmware','/usr/init.d/vmware-tools')
def setup(self):
- self.add_cmd_output("/usr/bin/vmware -v")
+ self.add_cmd_output("vmware -v")
self.add_copy_specs(["/etc/vmware/locations",
"/etc/vmware/config",
"/proc/vmmemctl"])
diff --git a/sos/plugins/xen.py b/sos/plugins/xen.py
index a8b1110e..0a5684fa 100644
--- a/sos/plugins/xen.py
+++ b/sos/plugins/xen.py
@@ -17,7 +17,7 @@ import os
import re
from stat import *
-class xen(Plugin, RedHatPlugin):
+class Xen(Plugin, RedHatPlugin):
"""Xen related information
"""
def determine_xen_host(self):
@@ -49,9 +49,9 @@ class xen(Plugin, RedHatPlugin):
"/proc/xen/xsd_kva",
"/proc/xen/xsd_port"])
# determine if CPU has PAE support
- self.add_cmd_output("/bin/grep pae /proc/cpuinfo")
+ self.add_cmd_output("grep pae /proc/cpuinfo")
# determine if CPU has Intel-VT or AMD-V support
- self.add_cmd_output("/bin/egrep -e 'vmx|svm' /proc/cpuinfo")
+ self.add_cmd_output("egrep -e 'vmx|svm' /proc/cpuinfo")
def setup(self):
host_type = self.determine_xen_host()
@@ -73,15 +73,15 @@ class xen(Plugin, RedHatPlugin):
"/sys/hypervisor/compilation",
"/sys/hypervisor/properties",
"/sys/hypervisor/type"])
- self.add_cmd_output("/usr/sbin/xm dmesg")
- self.add_cmd_output("/usr/sbin/xm info")
- self.add_cmd_output("/usr/sbin/xm list")
- self.add_cmd_output("/usr/sbin/xm list --long")
- self.add_cmd_output("/usr/sbin/brctl show")
+ self.add_cmd_output("xm dmesg")
+ self.add_cmd_output("xm info")
+ self.add_cmd_output("xm list")
+ self.add_cmd_output("xm list --long")
+ self.add_cmd_output("brctl show")
self.dom_collect_proc()
if self.is_running_xenstored():
self.add_copy_spec("/sys/hypervisor/uuid")
- self.add_cmd_output("/usr/bin/xenstore-ls")
+ self.add_cmd_output("xenstore-ls")
else:
# we need tdb instead of xenstore-ls if cannot get it.
self.add_copy_spec("/var/lib/xenstored/tdb")
diff --git a/sos/plugins/xinetd.py b/sos/plugins/xinetd.py
index 5c76bd1c..8c3945e0 100644
--- a/sos/plugins/xinetd.py
+++ b/sos/plugins/xinetd.py
@@ -15,9 +15,8 @@
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
-import os
-class xinetd(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
+class Xinetd(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""xinetd information
"""
diff --git a/sos/plugins/yum.py b/sos/plugins/yum.py
index 17684f21..18519df3 100644
--- a/sos/plugins/yum.py
+++ b/sos/plugins/yum.py
@@ -13,9 +13,8 @@
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin
-import os
-class yum(Plugin, RedHatPlugin):
+class Yum(Plugin, RedHatPlugin):
"""yum information
"""
@@ -35,7 +34,7 @@ class yum(Plugin, RedHatPlugin):
"/var/log/yum.log"])
# Get a list of channels the machine is subscribed to.
- self.add_cmd_output("/usr/bin/yum -C repolist")
+ self.add_cmd_output("yum -C repolist")
# candlepin info
self.add_forbidden_path("/etc/pki/entitlements/key.pem")
@@ -52,13 +51,13 @@ class yum(Plugin, RedHatPlugin):
if self.get_option("yumlist"):
# List various information about available packages
- self.add_cmd_output("/usr/bin/yum list")
+ 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("/usr/bin/yum-debug-dump '%s'" % os.path.join(self.commons['dstroot'],"yum-debug-dump"))
- ret, output, rtime = self.call_ext_prog("/usr/bin/yum-debug-dump")
+ # self.add_cmd_output("yum-debug-dump '%s'" % os.path.join(self.commons['dstroot'],"yum-debug-dump"))
+ ret, output, rtime = self.call_ext_prog("yum-debug-dump")
try:
- self.add_cmd_output("/bin/zcat %s" % (output.split()[-1],))
+ self.add_cmd_output("zcat %s" % (output.split()[-1],))
except IndexError:
pass
diff --git a/sos/policies/__init__.py b/sos/policies/__init__.py
index d99207ba..522aaff5 100644
--- a/sos/policies/__init__.py
+++ b/sos/policies/__init__.py
@@ -5,6 +5,8 @@ import re
import platform
import time
import fnmatch
+import sys
+from os import environ
from sos.utilities import ImporterHelper, \
import_module, \
@@ -133,16 +135,20 @@ No changes will be made to system configuration.
vendor = "Unknown"
vendor_url = "http://www.example.com/"
vendor_text = ""
+ PATH = ""
def __init__(self):
"""Subclasses that choose to override this initializer should call
super() to ensure that they get the required platform bits attached.
- super(SubClass, self).__init__()"""
+ super(SubClass, self).__init__(). Policies that require runtime
+ tests to construct PATH must call self.set_exec_path() after
+ modifying PATH in their own initializer."""
self._parse_uname()
self.report_name = self.hostname
self.ticket_number = None
self.package_manager = PackageManager()
self._valid_subclasses = []
+ self.set_exec_path()
def get_valid_subclasses(self):
return [IndependentPlugin] + self._valid_subclasses
@@ -221,6 +227,12 @@ No changes will be made to system configuration.
def set_commons(self, commons):
self.commons = commons
+ def _set_PATH(self, path):
+ environ['PATH'] = path
+
+ def set_exec_path(self):
+ self._set_PATH(self.PATH)
+
def is_root(self):
"""This method should return true if the user calling the script is
considered to be a superuser"""
@@ -377,6 +389,7 @@ class LinuxPolicy(Policy):
distro = "Linux"
vendor = "None"
+ PATH = "/bin:/sbin:/usr/bin:/usr/sbin"
def __init__(self):
super(LinuxPolicy, self).__init__()
diff --git a/sos/policies/debian.py b/sos/policies/debian.py
index 8423f175..b6009aa8 100644
--- a/sos/policies/debian.py
+++ b/sos/policies/debian.py
@@ -7,6 +7,12 @@ class DebianPolicy(LinuxPolicy):
distro = "Debian"
vendor = "the Debian project"
vendor_url = "http://www.debian.org/"
+ report_name = ""
+ ticket_number = ""
+ package_manager = PackageManager("dpkg-query -W -f='${Package}|${Version}\\n' \*")
+ valid_subclasses = [DebianPlugin]
+ PATH = "/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games" \
+ + ":/usr/loca/sbin:/usr/local/bin"
def __init__(self):
super(DebianPolicy, self).__init__()
diff --git a/sos/policies/redhat.py b/sos/policies/redhat.py
index 7677b806..7a26d811 100644
--- a/sos/policies/redhat.py
+++ b/sos/policies/redhat.py
@@ -40,14 +40,24 @@ class RedHatPolicy(LinuxPolicy):
super(RedHatPolicy, self).__init__()
self.report_name = ""
self.ticket_number = ""
- self.package_manager = PackageManager('rpm -qa --queryformat "%{NAME}|%{VERSION}\\n"')
+ self.package_manager = PackageManager(
+ 'rpm -qa --queryformat "%{NAME}|%{VERSION}\\n"')
self.valid_subclasses = [RedHatPlugin]
+ # handle PATH for UsrMove
+ if self.package_manager.all_pkgs()['filesystem']['version'][0] == '3':
+ self.PATH = "/usr/sbin:/usr/bin:/root/bin"
+ else:
+ self.PATH = "/sbin:/bin:/usr/sbin:/usr/bin:/root/bin"
+ self.PATH += os.pathsep + "/usr/local/bin"
+ self.PATH += os.pathsep + "/usr/local/sbin"
+ self.set_exec_path()
+
@classmethod
def check(self):
- """This method checks to see if we are running on Red Hat. It must be overriden
- by concrete subclasses to return True when running on a Fedora, RHEL or other
- Red Hat distribution or False otherwise."""
+ """This method checks to see if we are running on Red Hat. It must be
+ overriden by concrete subclasses to return True when running on a
+ Fedora, RHEL or other Red Hat distribution or False otherwise."""
return False
def runlevel_by_service(self, name):
diff --git a/sos/utilities.py b/sos/utilities.py
index ae4763df..fcc78c54 100644
--- a/sos/utilities.py
+++ b/sos/utilities.py
@@ -35,7 +35,6 @@ import tarfile
import hashlib
import logging
import fnmatch
-import selinux
from contextlib import closing
try:
diff --git a/tests/plugin_tests.py b/tests/plugin_tests.py
index 09d4c2ac..9f8817d2 100644
--- a/tests/plugin_tests.py
+++ b/tests/plugin_tests.py
@@ -4,7 +4,8 @@ import tempfile
from StringIO import StringIO
from sos.plugins import Plugin, regex_findall, sos_relative_path, mangle_command
-from sos.utilities import Archive
+from sos.archive import TarFileArchive, ZipFileArchive
+import sos.policies
PATH = os.path.dirname(__file__)
@@ -18,7 +19,7 @@ def create_file(size):
f.close()
return f.name
-class MockArchive(Archive):
+class MockArchive(TarFileArchive):
def __init__(self):
self.m = {}
@@ -77,9 +78,7 @@ class ForbiddenMockPlugin(Plugin):
class EnablerPlugin(Plugin):
- is_installed = False
-
- def isInstalled(self, pkg):
+ def is_installed(self, pkg):
return self.is_installed
@@ -206,15 +205,15 @@ class PluginTests(unittest.TestCase):
self.assertEquals(p.get_option_as_list("opt"), ['testing'])
def test_copy_dir(self):
- self.mp.doCopyFileOrDir("tests")
+ self.mp.do_copy_file_or_dir("tests")
self.assertEquals(self.mp.archive.m["tests/plugin_tests.py"], 'tests/plugin_tests.py')
def test_copy_dir_sub(self):
- self.mp.doCopyFileOrDir("tests", sub=("tests/", "foobar/"))
+ self.mp.do_copy_file_or_dir("tests", sub=("tests/", "foobar/"))
self.assertEquals(self.mp.archive.m["tests/plugin_tests.py"], 'foobar/plugin_tests.py')
def test_copy_dir_bad_path(self):
- self.mp.doCopyFileOrDir("not_here_tests")
+ self.mp.do_copy_file_or_dir("not_here_tests")
self.assertEquals(self.mp.archive.m, {})
def test_copy_dir_forbidden_path(self):
@@ -223,7 +222,7 @@ class PluginTests(unittest.TestCase):
})
p.archive = MockArchive()
p.setup()
- p.doCopyFileOrDir("tests")
+ p.do_copy_file_or_dir("tests")
self.assertEquals(p.archive.m, {})
@@ -269,7 +268,7 @@ class AddCopySpecLimitTests(unittest.TestCase):
class CheckEnabledTests(unittest.TestCase):
def setUp(self):
- self.mp = EnablerPlugin({})
+ self.mp = EnablerPlugin({'policy': sos.policies.load()})
def test_checks_for_file(self):
f = j("tail_test.txt")
@@ -278,7 +277,6 @@ class CheckEnabledTests(unittest.TestCase):
def test_checks_for_package(self):
self.mp.packages = ('foo',)
- self.mp.is_installed = True
self.assertTrue(self.mp.check_enabled())
def test_allows_bad_tuple(self):
@@ -300,18 +298,18 @@ class RegexSubTests(unittest.TestCase):
self.mp.archive = MockArchive()
def test_file_never_copied(self):
- self.assertEquals(0, self.mp.doFileSub("never_copied", r"^(.*)$", "foobar"))
+ self.assertEquals(0, self.mp.do_file_sub("never_copied", r"^(.*)$", "foobar"))
def test_no_replacements(self):
self.mp.add_copy_spec(j("tail_test.txt"))
self.mp.collect()
- replacements = self.mp.doFileSub(j("tail_test.txt"), r"wont_match", "foobar")
+ replacements = self.mp.do_file_sub(j("tail_test.txt"), r"wont_match", "foobar")
self.assertEquals(0, replacements)
def test_replacements(self):
self.mp.add_copy_spec(j("tail_test.txt"))
self.mp.collect()
- replacements = self.mp.doFileSub(j("tail_test.txt"), r"(tail)", "foobar")
+ replacements = self.mp.do_file_sub(j("tail_test.txt"), r"(tail)", "foobar")
self.assertEquals(1, replacements)
self.assertTrue("foobar" in self.mp.archive.m.get(j('tail_test.txt')))
diff --git a/tests/test_exe.py b/tests/test_exe.py
index f35d93f0..09b2813e 100755
--- a/tests/test_exe.py
+++ b/tests/test_exe.py
@@ -1,2 +1,2 @@
-#!/usr/bin/env python
+#!/usr/bin/python
print "executed"