sosreport/ 0000755 0001750 0001750 00000000000 12271442132 011246 5 ustar zef zef sosreport/sos.conf 0000644 0001750 0001750 00000000400 12254061770 012721 0 ustar zef zef [general]
#ftp_upload_url = ftp://example.com/incoming
#gpg_keyring = /usr/share/sos/rhsupport.pub
#gpg_recipient = support@redhat.com
smtp_server = None
[plugins]
#disable = rpm, selinux, dovecot
[tunables]
#rpm.rpmva = off
#general.syslogsize = 15
sosreport/setup.py 0000644 0001750 0001750 00000004242 12254061770 012770 0 ustar zef zef #!/usr/bin/env python
from distutils.core import setup
from distutils.command.build import build
from distutils.command.install_data import install_data
from distutils.dep_util import newer
from distutils.log import warn, info, error
import glob
import os
import subprocess
import sys
from sos import __version__ as VERSION
PO_DIR = 'po'
MO_DIR = os.path.join('build', 'mo')
class BuildData(build):
def run(self):
build.run(self)
for po in glob.glob(os.path.join(PO_DIR, '*.po')):
lang = os.path.basename(po[:-3])
mo = os.path.join(MO_DIR, lang, 'sos.mo')
directory = os.path.dirname(mo)
if not os.path.exists(directory):
os.makedirs(directory)
if newer(po, mo):
try:
rc = subprocess.call(['msgfmt', '-o', mo, po])
if rc != 0:
raise Warning("msgfmt returned %d" % (rc,))
except Exception as e:
error("Failed gettext.")
sys.exit(1)
class InstallData(install_data):
def run(self):
self.data_files.extend(self._find_mo_files())
install_data.run(self)
def _find_mo_files(self):
data_files = []
for mo in glob.glob(os.path.join(MO_DIR, '*', 'sos.mo')):
lang = os.path.basename(os.path.dirname(mo))
dest = os.path.join('share', 'locale', lang, 'LC_MESSAGES')
data_files.append((dest, [mo]))
return data_files
setup(name='sosreport',
version=VERSION,
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
support technicians and developers.""",
author='Bryn M. Reeves',
author_email='bmr@redhat.com',
url='https://github.com/sosreport/sosreport',
license="GPLv2+",
scripts=['sosreport'],
data_files=[
('share/man/man1', ['man/en/sosreport.1']),
('share/man/man5', ['man/en/sos.conf.5']),
],
packages=['sos', 'sos.plugins', 'sos.policies'],
cmdclass={'build': BuildData, 'install_data': InstallData},
requires=['six'],
)
sosreport/sos.spec 0000644 0001750 0001750 00000060165 12271430455 012743 0 ustar zef zef %{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
Summary: A set of tools to gather troubleshooting information from a system
Name: sos
Version: 3.1
Release: 1%{?dist}
Group: Applications/System
Source0: http://people.redhat.com/breeves/sos/releases/sos-%{version}.tar.gz
License: GPLv2+
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
BuildArch: noarch
Url: http://fedorahosted.org/sos
BuildRequires: python-devel
BuildRequires: gettext
BuildRequires: python-six
Requires: libxml2-python
Requires: rpm-python
Requires: tar
Requires: bzip2
Requires: xz
Requires: python-six
%description
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
support technicians and developers.
%prep
%setup -q
%build
make
%install
rm -rf ${RPM_BUILD_ROOT}
make DESTDIR=${RPM_BUILD_ROOT} install
%find_lang %{name} || echo 0
%clean
rm -rf ${RPM_BUILD_ROOT}
%files -f %{name}.lang
%defattr(-,root,root,-)
%{_sbindir}/sosreport
%{_datadir}/%{name}
%{python_sitelib}/*
%{_mandir}/man1/*
%{_mandir}/man5/*
%doc AUTHORS README.md LICENSE
%config(noreplace) %{_sysconfdir}/sos.conf
%changelog
* Mon Jun 10 2013 Bryn M. Reeves = 3.0-1
- New upstream release
* Thu May 23 2013 Bryn M. Reeves = 2.2-39
- Always invoke tar with '-f-' option
Resolves: bz966602
* Mon Jan 21 2013 Bryn M. Reeves = 2.2-38
- Fix interactive mode regression when --ticket unspecified
Resolves: bz822113
* Fri Jan 18 2013 Bryn M. Reeves = 2.2-37
- Fix propagation of --ticket parameter in interactive mode
Resolves: bz822113
* Thu Jan 17 2013 Bryn M. Reeves = 2.2-36
- Revert OpenStack patch
Resolves: bz840057
* Wed Jan 9 2013 Bryn M. Reeves = 2.2-35
- Report --name and --ticket values as defaults
Resolves: bz822113
- Fix device-mapper command execution logging
Resolves: bz824378
- Fix data collection and rename PostreSQL module to pgsql
Resolves: bz852049
* Fri Oct 19 2012 Bryn M. Reeves = 2.2-34
- Add support for content delivery hosts to RHUI module
Resolves: bz821323
* Thu Oct 18 2012 Bryn M. Reeves = 2.2-33
- Add Red Hat Update Infrastructure module
Resolves: bz821323
- Collect /proc/iomem in hardware module
Resolves: bz840975
- Collect subscription-manager output in general module
Resolves: bz825968
- Collect rhsm log files in general module
Resolves: bz826312
- Fix exception in gluster module on non-gluster systems
Resolves: bz849546
- Fix exception in psql module when dbname is not given
Resolves: bz852049
* Wed Oct 17 2012 Bryn M. Reeves = 2.2-32
- Collect /proc/pagetypeinfo in memory module
Resolves: bz809727
- Strip trailing newline from command output
Resolves: bz850433
- Add sanlock module
Resolves: bz850779
- Do not collect archived accounting files in psacct module
Resolves: bz850542
- Call spacewalk-debug from rhn module to collect satellite data
Resolves: bz859142
* Mon Oct 15 2012 Bryn M. Reeves = 2.2-31
- Avoid calling volume status when collecting gluster statedumps
Resolves: bz849546
- Use a default report name if --name is empty
Resolves: bz822113
- Quote tilde characters passed to shell in RPM module
Resolves: bz821005
- Collect KDC and named configuration in ipa module
Resolves: bz825149
- Sanitize hostname characters before using as report path
Resolves: bz822174
- Collect /etc/multipath in device-mapper module
Resolves: bz817093
- New plug-in for PostgreSQL
Resolves: bz852049
- Add OpenStack module
Resolves: bz840057
- Avoid deprecated sysctls in /proc/sys/net
Resolves: bz834594
- Fix error logging when calling external programs
Resolves: bz824378
- Use ip instead of ifconfig to generate network interface lists
Resolves: bz833170
* Wed May 23 2012 Bryn M. Reeves = 2.2-29
- Collect the swift configuration directory in gluster module
Resolves: bz822442
- Update IPA module and related plug-ins
Resolves: bz812395
* Fri May 18 2012 Bryn M. Reeves = 2.2-28
- Collect mcelog files in the hardware module
Resolves: bz810702
* Wed May 02 2012 Bryn M. Reeves = 2.2-27
- Add nfs statedump collection to gluster module
Resolves: bz752549
* Tue May 01 2012 Bryn M. Reeves = 2.2-26
- Use wildcard to match possible libvirt log paths
Resolves: bz814474
* Mon Apr 23 2012 Bryn M. Reeves = 2.2-25
- Add forbidden paths for new location of gluster private keys
Resolves: bz752549
* Fri Mar 9 2012 Bryn M. Reeves = 2.2-24
- Fix katello and aeolus command string syntax
Resolves: bz752666
- Remove stray hunk from gluster module patch
Resolves: bz784061
* Thu Mar 8 2012 Bryn M. Reeves = 2.2-22
- Correct aeolus debug invocation in CloudForms module
Resolves: bz752666
- Update gluster module for gluster-3.3
Resolves: bz784061
- Add additional command output to gluster module
Resolves: bz768641
- Add support for collecting gluster configuration and logs
Resolves: bz752549
* Wed Mar 7 2012 Bryn M. Reeves = 2.2-19
- Collect additional diagnostic information for realtime systems
Resolves: bz789096
- Improve sanitization of RHN user and case number in report name
Resolves: bz771393
- Fix verbose output and debug logging
Resolves: bz782339
- Add basic support for CloudForms data collection
Resolves: bz752666
- Add support for Subscription Asset Manager diagnostics
Resolves: bz752670
* Tue Mar 6 2012 Bryn M. Reeves = 2.2-18
- Collect fence_virt.conf in cluster module
Resolves: bz760995
- Fix collection of /proc/net directory tree
Resolves: bz730641
- Gather output of cpufreq-info when present
Resolves: bz760424
- Fix brctl showstp output when bridges contain multiple interfaces
Resolves: bz751273
- Add /etc/modprobe.d to kernel module
Resolves: bz749919
- Ensure relative symlink targets are correctly handled when copying
Resolves: bz782589
- Fix satellite and proxy package detection in rhn plugin
Resolves: bz749262
- Collect stderr output from external commands
Resolves: bz739080
- Collect /proc/cgroups in the cgroups module
Resolve: bz784874
- Collect /proc/irq in the kernel module
Resolves: bz784862
- Fix installed-rpms formatting for long package names
Resolves: bz767827
- Add symbolic links for truncated log files
Resolves: bz766583
- Collect non-standard syslog and rsyslog log files
Resolves: bz771501
- Use correct paths for tomcat6 in RHN module
Resolves: bz749279
- Obscure root password if present in anacond-ks.cfg
Resolves: bz790402
- Do not accept embedded forward slashes in RHN usernames
Resolves: bz771393
- Add new sunrpc module to collect rpcinfo for gluster systems
Resolves: bz784061
* Tue Nov 1 2011 Bryn M. Reeves = 2.2-17
- Do not collect subscription manager keys in general plugin
Resolves: bz750607
* Fri Sep 23 2011 Bryn M. Reeves = 2.2-16
- Fix execution of RHN hardware.py from hardware plugin
Resolves: bz736718
- Fix hardware plugin to support new lsusb path
Resolves: bz691477
* Fri Sep 09 2011 Bryn M. Reeves = 2.2-15
- Fix brctl collection when a bridge contains no interfaces
Resolves: bz697899
- Fix up2dateclient path in hardware plugin
Resolves: bz736718
* Mon Aug 15 2011 Bryn M. Reeves = 2.2-14
- Collect brctl show and showstp output
Resolves: bz697899
- Collect nslcd.conf in ldap plugin
Resolves: bz682124
* Sun Aug 14 2011 Bryn M. Reeves = 2.2-11
- Truncate files that exceed specified size limit
Resolves: bz683219
- Add support for collecting Red Hat Subscrition Manager configuration
Resolves: bz714293
- Collect /etc/init on systems using upstart
Resolves: bz694813
- Don't strip whitespace from output of external programs
Resolves: bz713449
- Collect ipv6 neighbour table in network module
Resolves: bz721163
- Collect basic cgroups configuration data
Resolves: bz729455
* Sat Aug 13 2011 Bryn M. Reeves = 2.2-10
- Fix collection of data from LVM2 reporting tools in devicemapper plugin
Resolves: bz704383
- Add /proc/vmmemctl collection to vmware plugin
Resolves: bz709491
* Fri Aug 12 2011 Bryn M. Reeves = 2.2-9
- Collect yum repository list by default
Resolves: bz600813
- Add basic Infiniband plugin
Resolves: bz673244
- Add plugin for scsi-target-utils iSCSI target
Resolves: bz677124
- Fix autofs plugin LC_ALL usage
Resolves: bz683404
- Fix collection of lsusb and add collection of -t and -v outputs
Resolves: bz691477
- Extend data collection by qpidd plugin
Resolves: bz726360
- Add ethtool pause, coalesce and ring (-a, -c, -g) options to network plugin
Resolves: bz726427
* Thu Apr 07 2011 Bryn M. Reeves = 2.2-8
- Use sha256 for report digest when operating in FIPS mode
Resolves: bz689387
* Tue Apr 05 2011 Bryn M. Reeves = 2.2-7
- Fix parted and dumpe2fs output on s390
Resolves: bz622784
* Fri Feb 25 2011 Bryn M. Reeves = 2.2-6
- Fix collection of chkconfig output in startup.py
Resolves: bz659467
- Collect /etc/dhcp in dhcp.py plugin
Resolves: bz676522
- Collect dmsetup ls --tree output in devicemapper.py
Resolves: bz675559
- Collect lsblk output in filesys.py
Resolves: bz679433
* Thu Feb 24 2011 Bryn M. Reeves = 2.2-4
- Fix collection of logs and config files in sssd.py
Resolves: bz624162
- Add support for collecting entitlement certificates in rhn.py
Resolves: bz678665
* Thu Feb 03 2011 Bryn M. Reeves = 2.2-3
- Fix cluster plugin dlm lockdump for el6
Resolves: bz622407
- Add sssd plugin to collect configuration and logs
Resolves: bz624162
- Collect /etc/anacrontab in system plugin
Resolves: bz622527
- Correct handling of redhat-release for el6
Resolves: bz622528
* Thu Jul 29 2010 Adam Stokes = 2.2-2
- Resolves: bz582259
- Resolves: bz585942
- Resolves: bz584253
- Resolves: bz581817
* Thu Jun 10 2010 Adam Stokes = 2.2-0
- Resolves: bz581921
- Resolves: bz584253
- Resolves: bz562651
- Resolves: bz566170
- Resolves: bz586450
- Resolves: bz588223
- Resolves: bz559737
- Resolves: bz586405
- Resolves: bz598978
- Resolves: bz584763
* Wed Apr 28 2010 Adam Stokes = 2.1-0
- Resolves: bz585923
- Resolves: bz585942
- Resolves: bz586409
- Resolves: bz586389
- Resolves: bz548096
- Resolves: bz557828
- Resolves: bz563637
- Resolves: bz584253
- Resolves: bz462823
- Resolves: bz528881
- Resolves: bz566170
- Resolves: bz578787
- Resolves: bz581817
- Resolves: bz581826
- Resolves: bz584695
- Resolves: bz568637
- Resolves: bz584767
- Resolves: bz586370
* Mon Apr 12 2010 Adam Stokes = 2.0-0
- Resolves: bz580015
* Tue Mar 30 2010 Adam Stokes = 1.9-3
- fix setup.py to autocompile translations and man pages
- rebase 1.9
* Fri Mar 19 2010 Adam Stokes = 1.9-2
- updated translations
* Thu Mar 04 2010 Adam Stokes = 1.9-1
- version bump 1.9
- replaced compression utility with xz
- strip threading/multiprocessing
- simplified progress indicator
- pylint update
- put global vars in class container
- unittests
- simple profiling
- make use of xgettext as pygettext is deprecated
* Mon Jan 18 2010 Adam Stokes = 1.8-21
- more sanitizing options for log files
- rhbz fixes from RHEL version merged into trunk
- progressbar update
* Tue Nov 19 2009 Adam Stokes = 1.8-20
- dont copy unwanted files due to symlinks
- More plugin enhancements
* Tue Nov 5 2009 Adam Stokes = 1.8-18
- Option to enable selinux fixfiles check
- Start of replacing Thread module with multiprocessing
- Update translations
- More checks against conf file versus command line opts
* Tue Sep 9 2009 Adam Stokes = 1.8-16
- Update rh-upload-core to rh-upload and allows general files
- Fix cluster plugin with pwd mangling invalidating xml
- Cluster support detecting invalid fence_id and fence states
- Read variables from conf file
* Thu Jul 23 2009 Adam Stokes = 1.8-14
- resolves: rhbz512536 wrong group in spec file
- resolves: rhbz498398 A series of refactoring patches to sos
- resolves: rhbz501149 A series of refactoring patches to sos (2)
- resolves: rhbz503804 remove obsolete translation
- resolves: rhbz502455 tricking sosreport into rm -rf /
- resolves: rhbz501146 branding in fedora
* Mon Jul 20 2009 Adam Stokes = 1.8-13
- Add requirements for tar,bzip2 during minimal installs
- More merges from reports against RHEL version of plugins
- Remove unecessary definition of localdir in spec
* Wed May 05 2009 Adam Stokes - 1.8-11
- Remove all instances of sysrq
- Consistent macro usage in spec
* Wed Feb 25 2009 Fedora Release Engineering - 1.8-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
* Mon Dec 29 2008 Adam Stokes - 1.8-5
- removed source defines as python manifest handles this
* Fri Dec 19 2008 Adam Stokes - 1.8-4
- spec cleanup, fixed license, source
- reworked Makefile to build properly
* Thu Oct 23 2008 Adam Stokes - 1.8-1
- Resolves: bz459845 collect krb5.conf
- Resolves: bz457880 include output of xm list and xm list --long
- Resolves: bz457919 add support for openswan and ipsec-tools
- Resolves: bz456378 capture elilo configuration
- Resolves: bz445007 s390 support
- Resolves: bz371251 hangs when running with a xen kernel where xend has not been started
- Resolves: bz452705 Add /root/anaconda-ks-cfg to sosreport archive
- Resolves: bz445510 Do not rely on env to execute python
- Resolves: bz446868 add support for emc devices
- Resolves: bz453797 fails to generate fdisk -l
- Resolves: bz433183 does not collect ext3 information
- Resolves: bz444838 systool is passed deprecated arguments
- Resolves: bz455096 add %{INSTALLTIME:date} to rpm --qf collection
- Resolves: bz332211 avoid hazardous filenames
* Wed Nov 21 2007 Navid Sheikhol-Eslami - 1.8-0
- Resolves: bz368261 sosGetCommandOutput() does not block on hung processes
- Resolves: bz361861 work-around missing traceback.format_exc() in RHEL4
- Resolves: bz394781 device-mapper: use /sbin/lvm_dump to collect dm related info
- Resolves: bz386691 unattended --batch option
- Resolves: bz371251 sos could hang when accessing /sys/hypervisor/uuid
- selinux: always collect sestatus
- added many languages
- added --debug option which causes exceptions not to be trapped
- updated to sysreport-1.4.3-13.el5
- ftp upload to dropbox with --upload
- cluster: major rewrite to support different versions of RHEL
- cluster: check rg_test for errors
- minor changes in various plug-ins (yum, networking, process, kernel)
- fixed some exceptions in threads which were not properly trapped
- veritas: don't run rpm -qa every time
- using rpm's python bindings instead of external binary
- corrected autofs and ldap plugin that were failing when debug option was not found in config file.
- implemented built-in checkdebug() that uses self.files and self.packages to make the decision
- missing binaries are properly detected now.
- better doExitCode handling
- fixed problem with rpm module intercepting SIGINT
- error when user specifies an invalid plugin or plugin option
- named: fixed indentation
- replaced isOptionEnabled() with getOption()
- tune2fs and fdisk were not always run against the correct devices/mountpoint
- added gpg key to package
- updated README with new svn repo and contributors
- updated manpage
- better signal handling
- caching of rpm -q outputs
- report filename includes rhnUsername if available
- report encryption via gpg and support pubkey
- autofs: removed redundant files
- filesys: better handling of removable devices
- added sosReadFile() returns a file's contents
- return after looping inside a directory
- collect udevinfo for each block device
- simply collect output of fdisk -l in one go
- handle sysreport invocation properly (warn if shell is interactive, otherwise spawn sysreport.legacy)
- progress bar don't show 100% until finished() is called
- Resolves: bz238778 added lspci -t
- now runs on RHEL3 as well (python 2.2)
- replaced commonPrefix() with faster code
- filesys: one fdisk -l for all
- selinux: collect fixfilex check output
- devicemapper: collect udevinfo for all block devices
- cluster: validate node names according to RFC 2181
- systemtap: cleaned up and added checkenabled() method
- added kdump plugin
- added collection of /etc/inittab
- Resolves: bz332151 apply regex to case number in sysreport for RHEL4
- Resolves: bz332211 apply regex to case number in sysreport for RHEL5
- Resolves: bz400111 sos incorrectly reports cluster data in SMP machine
* Wed Aug 13 2007 Navid Sheikhol-Eslami - 1.7-8
- added README.rh-upload-core
* Mon Aug 13 2007 Navid Sheikhol-Eslami - 1.7-7
- Resolves: bz251927 SOS errata needs to be respin to match 4.6 code base
- added extras/rh-upload-core script from David Mair
* Mon Aug 9 2007 Navid Sheikhol-Eslami - 1.7-6
- more language fixes
- added arabic, italian and french
- package prepared for release
- included sysreport as sysreport.legacy
* Mon Aug 9 2007 Navid Sheikhol-Eslami - 1.7-5
- package obsoletes sysreport and creates a link pointing to sosreport
- added some commands in cluster and process plugins
- fixed html output (wrong links to cmds, thanks streeter)
- process: back down sleep if D state doesn't change
- Resolves: bz241277 Yum Plugin for sos
- Resolves: bz247520 Spelling mistake in sosreport output
- Resolves: bz247531 Feature: plugin to gather initial ramdisk scripts
- Resolves: bz248252 sos to support language localization
- Resolves: bz241282 Make SOS for RHEL 4
* Mon Aug 1 2007 Navid Sheikhol-Eslami - 1.7-4
- catch KeyboardInterrupt when entering sosreport name
- added color output for increased readability
- list was sorted twice, removing latter .sort()
* Mon Jul 31 2007 Navid Sheikhol-Eslami - 1.7-3
- added preliminary problem diagnosis support
- better i18n initialization
- better user messages
- more progressbar fixes
- catch and log python exceptions in report
- use python native commands to create symlinks
- limit concurrent running threads
* Mon Jul 28 2007 Navid Sheikhol-Eslami - 1.7-2
- initial language localization support
- added italian translation
* Mon Jul 16 2007 Navid Sheikhol-Eslami - 1.7-1
- split up command outputs in sub-directories (sos_command/plugin/command instead of sos_command/plugin.command)
- fixed doExitCode() calling thread.wait() instead of join()
- curses menu is disabled by default
- multithreading is enabled by default
- major progressbar changes (now has ETA)
- multithreading fixes
- plugins class descriptions shortened to fix better in --list-plugins
- rpm -Va in plugins/rpm.py sets eta_weight to 200 (plugin 200 longer than other plugins, for ETA calculation)
- beautified command output filenames in makeCommandFilename()
* Mon Jul 12 2007 Navid Sheikhol-Eslami - 1.7-0
- curses menu disabled by default (enable with -c)
- sosreport output friendlier to the user (and similar to sysreport)
- smarter plugin listing which also shows options and disable/enabled plugins
- require root permissions only for actual sosreport generation
- fix in -k where option value was treated as string instead of int
- made progressbar wider (60 chars)
- selinux plugin is enabled only if selinux is also enabled on the system
- made some errors less verbose to the user
- made sosreport not copy files pointed by symbolic links (same as sysreport, we don't need /usr/bin/X or /sbin/ifup)
- copy links as links (cp -P)
- added plugin get_description() that returns a short decription for the plugin
- guess sosreport name from system's name
* Mon Jul 5 2007 Navid Sheikhol-Eslami - 1.6-5
- Yet more fixes to make package Fedora compliant.
* Mon Jul 5 2007 Navid Sheikhol-Eslami - 1.6-4
- More fixes to make package Fedora compliant.
* Mon Jul 2 2007 Navid Sheikhol-Eslami - 1.6-3
- Other fixes to make package Fedora compliant.
* Mon Jul 2 2007 Navid Sheikhol-Eslami - 1.6-2
- Minor fixes.
* Mon Jul 2 2007 Navid Sheikhol-Eslami - 1.6-1
- Beautified output of --list-plugins.
- GPL licence is now included in the package.
- added python-devel requirement for building package
- Resolves: bz241282 fixed incompatibility with python from RHEL4
* Fri May 25 2007 Steve Conklin - 1.5-1
- Bumped version
* Fri May 25 2007 Steve Conklin - 1.4-2
- Fixed a backtrace on nonexistent file in kernel plugin (thanks, David Robinson)
* Mon Apr 30 2007 Steve Conklin - 1.4-1
- Fixed an error in option handling
- Forced the file generated by traceroute to not end in .com
- Fixed a problem with manpage
- Added optional traceroute collection to networking plugin
- Added clalance's patch to gather iptables info.
- Fixes to the device-mapper plugin
- Fixed a problem with installation of man page
* Mon Apr 16 2007 Steve Conklin - 1.3-3
- including patches to fix the following:
- Resolves: bz219745 sosreport needs a man page
- Resolves: bz219667 sosreport does not terminate cleanly on ^C
- Resolves: bz233375 Make SOS flag the situation when running on a fully virtu...
- Resolves: bz234873 rhel5 sos needs to include rpm-va by default
- Resolves: bz219669 sosreport multi-threaded option sometimes fails
- Resolves: bz219671 RFE for sosreport - allow specification of plugins to be run
- Resolves: bz219672 RFE - show progress while sosreport is running
- Resolves: bz219673 Add xen information gathering to sosreport
- Resolves: bz219675 Collect information related to the new driver update model
- Resolves: bz219877 'Cancel' button during option selection only cancels sele...
* Tue Feb 20 2007 John Berninger - 1.3-2
- Add man page
* Fri Dec 15 2006 Steve Conklin - 1.3-1
- really fixed bz_219654
* Fri Dec 15 2006 Steve Conklin - 1.2-1
- fixed a build problem
* Fri Dec 15 2006 Steve Conklin - 1.1-1
- Tighten permissions of tmp directory so only readable by creator bz_219657
- Don't print message 'Problem at path ...' bz_219654
- Removed useless message bz_219670
- Preserve file modification times bz_219674
- Removed unneeded message about files on copyProhibitedList bz_219712
* Wed Aug 30 2006 Steve Conklin - 1.0-1
- Seperated upstream and RPM versioning
* Mon Aug 21 2006 Steve Conklin - 0.1-11
- Code cleanup, fixed a regression in threading
* Mon Aug 14 2006 Steve Conklin - 0.1-10
- minor bugfixes, added miltithreading option, setup now quiet
* Mon Jul 17 2006 Steve Conklin - 0.1-9
- migrated to svn on 108.redhat.com, fixed a problem with command output linking in report
* Mon Jun 19 2006 Steve Conklin - 0.1-6
- Added LICENSE file containing GPL
* Wed May 31 2006 Steve Conklin - 0.1-5
- Added fixes to network plugin and prepped for Fedora submission
* Wed May 31 2006 John Berninger - 0.1-4
- Reconsolidated subpackages into one package per discussion with sconklin
* Mon May 22 2006 John Berninger - 0.1-3
- Added ftp, ldap, mail, named, samba, squid SOS plugins
- Fixed various errors in kernel and hardware plugins
* Mon May 22 2006 John Benringer - 0.1-2
- split off cluster plugin into subpackage
- correct file payload lists
* Mon May 22 2006 John Berninger - 0.1-1
- initial package build
sosreport/sos/ 0000755 0001750 0001750 00000000000 12271442132 012052 5 ustar zef zef sosreport/sos/sosreport.py 0000644 0001750 0001750 00000121371 12271430455 014476 0 ustar zef zef """
Gather information about a system and report it using plugins
supplied for application-specific information
"""
## sosreport.py
## gather information about a system and report it
## Copyright (C) 2006 Steve Conklin
### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
# pylint: disable-msg = W0611
# pylint: disable-msg = W0702
# pylint: disable-msg = R0912
# pylint: disable-msg = R0914
# pylint: disable-msg = R0915
# pylint: disable-msg = R0913
# pylint: disable-msg = E0611
# pylint: disable-msg = E1101
# pylint: disable-msg = R0904
# pylint: disable-msg = R0903
import sys
import traceback
import os
import logging
from optparse import OptionParser, Option
from sos.plugins import import_plugin
from sos.utilities import ImporterHelper
from stat import ST_UID, ST_GID, ST_MODE, ST_CTIME, ST_ATIME, ST_MTIME, S_IMODE
from time import strftime, localtime
from collections import deque
import textwrap
import tempfile
from sos import _sos as _
from sos import __version__
import sos.policies
from sos.archive import TarFileArchive, ZipFileArchive
from sos.reporting import Report, Section, Command, CopiedFile, CreatedFile, Alert, Note, PlainTextReport
# PYCOMPAT
import six
from six.moves import zip
if six.PY3:
from configparser import ConfigParser
else:
from ConfigParser import ConfigParser
from six import print_
class TempFileUtil(object):
def __init__(self, tmp_dir):
self.tmp_dir = tmp_dir
self.files = []
def new(self):
fd, fname = tempfile.mkstemp(dir=self.tmp_dir)
fobj = open(fname, 'w')
self.files.append((fname, fobj))
return fobj
def clean(self):
for fname, f in self.files:
try:
f.flush()
f.close()
except Exception as e:
pass
try:
os.unlink(fname)
except Exception as e:
pass
self.files = []
class OptionParserExtended(OptionParser):
""" Show examples """
def print_help(self, out=sys.stdout):
""" Prints help content including examples """
OptionParser.print_help(self, out)
print_()
print_( "Some examples:")
print_()
print_( " enable cluster plugin only and collect dlm lockdumps:")
print_( " # sosreport -o cluster -k cluster.lockdump")
print_()
print_( " disable memory and samba plugins, turn off rpm -Va collection:")
print_( " # sosreport -n memory,samba -k rpm.rpmva=off")
print_()
class SosOption(Option):
"""Allow to specify comma delimited list of plugins"""
ACTIONS = Option.ACTIONS + ("extend",)
STORE_ACTIONS = Option.STORE_ACTIONS + ("extend",)
TYPED_ACTIONS = Option.TYPED_ACTIONS + ("extend",)
def take_action(self, action, dest, opt, value, values, parser):
""" Performs list extension on plugins """
if action == "extend":
try:
lvalue = value.split(",")
except:
pass
else:
values.ensure_value(dest, deque()).extend(lvalue)
else:
Option.take_action(self, action, dest, opt, value, values, parser)
class XmlReport(object):
""" Report build class """
def __init__(self):
try:
import libxml2
except ImportError:
self.enabled = False
return
else:
self.enabled = False
return
self.doc = libxml2.newDoc("1.0")
self.root = self.doc.newChild(None, "sos", None)
self.commands = self.root.newChild(None, "commands", None)
self.files = self.root.newChild(None, "files", None)
def add_command(self, cmdline, exitcode, stdout = None, stderr = None,
f_stdout=None, f_stderr=None, runtime=None):
""" Appends command run into report """
if not self.enabled:
return
cmd = self.commands.newChild(None, "cmd", None)
cmd.setNsProp(None, "cmdline", cmdline)
cmdchild = cmd.newChild(None, "exitcode", str(exitcode))
if runtime:
cmd.newChild(None, "runtime", str(runtime))
if stdout or f_stdout:
cmdchild = cmd.newChild(None, "stdout", stdout)
if f_stdout:
cmdchild.setNsProp(None, "file", f_stdout)
if stderr or f_stderr:
cmdchild = cmd.newChild(None, "stderr", stderr)
if f_stderr:
cmdchild.setNsProp(None, "file", f_stderr)
def add_file(self, fname, stats):
""" Appends file(s) added to report """
if not self.enabled:
return
cfile = self.files.newChild(None, "file", None)
cfile.setNsProp(None, "fname", fname)
cchild = cfile.newChild(None, "uid", str(stats[ST_UID]))
cchild = cfile.newChild(None, "gid", str(stats[ST_GID]))
cfile.newChild(None, "mode", str(oct(S_IMODE(stats[ST_MODE]))))
cchild = cfile.newChild(None, "ctime", strftime('%a %b %d %H:%M:%S %Y',
localtime(stats[ST_CTIME])))
cchild.setNsProp(None, "tstamp", str(stats[ST_CTIME]))
cchild = cfile.newChild(None, "atime", strftime('%a %b %d %H:%M:%S %Y',
localtime(stats[ST_ATIME])))
cchild.setNsProp(None, "tstamp", str(stats[ST_ATIME]))
cchild = cfile.newChild(None, "mtime", strftime('%a %b %d %H:%M:%S %Y',
localtime(stats[ST_MTIME])))
cchild.setNsProp(None, "tstamp", str(stats[ST_MTIME]))
def serialize(self):
""" Serializes xml """
if not self.enabled:
return
self.ui_log.info(self.doc.serialize(None, 1))
def serialize_to_file(self, fname):
""" Serializes to file """
if not self.enabled:
return
outf = tempfile.NamedTemporaryFile()
outf.write(self.doc.serialize(None, 1))
outf.flush()
self.archive.add_file(outf.name, dest=fname)
outf.close()
class SoSOptions(object):
_list_plugins = False
_noplugins = []
_enableplugins = []
_onlyplugins = []
_plugopts = []
_usealloptions = False
_batch = False
_build = False
_verbosity = 0
_quiet = False
_debug = False
_ticket_number = ""
_customer_name = ""
_config_file = ""
_tmp_dir = ""
_report = True
_profiler = False
_compression_type = 'auto'
_options = None
def __init__(self, args=None):
if args:
self._options = self._parse_args(args)
else:
self._options = None
def _check_options_initialized(self):
if self._options != None:
raise ValueError("SoSOptions object already initialized "
+ "from command line")
@property
def list_plugins(self):
if self._options != None:
return self._options.list_plugins
return self._list_plugins
@list_plugins.setter
def list_plugins(self, value):
self._check_options_initialized()
if not isinstance(value, bool):
raise TypeError("SoSOptions.list_plugins expects a boolean")
self._list_plugins = value
@property
def noplugins(self):
if self._options != None:
return self._options.noplugins
return self._noplugins
@noplugins.setter
def noplugins(self, value):
self._check_options_initialized()
self._noplugins = value
@property
def enableplugins(self):
if self._options != None:
return self._options.enableplugins
return self._enableplugins
@enableplugins.setter
def enableplugins(self):
self._check_options_initialized()
self._enableplugins = value
@property
def onlyplugins(self):
if self._options != None:
return self._options.onlyplugins
return self._onlyplugins
@onlyplugins.setter
def onlyplugins(self, value):
self._check_options_initialized()
self._onlyplugins = value
@property
def plugopts(self):
if self._options != None:
return self._options.plugopts
return self._plugopts
@plugopts.setter
def plugopts(self, value):
# If we check for anything it should be itterability.
#if not isinstance(value, list):
# raise TypeError("SoSOptions.plugopts expects a list")
self._plugopts = value
@property
def usealloptions(self):
if self._options != None:
return self._options.usealloptions
return self._usealloptions
@usealloptions.setter
def usealloptions(self, value):
self._check_options_initialized()
if not isinsance(value, bool):
raise TypeError("SoSOptions.usealloptions expects a boolean")
self._usealloptions = value
@property
def batch(self):
if self._options != None:
return self._options.batch
return self._batch
@batch.setter
def batch(self, value):
self._check_options_initialized()
if not isinstance(value, bool):
raise TypeError("SoSOptions.batch expects a boolean")
self._batch = value
@property
def build(self):
if self._options != None:
return self._options.build
return self._build
@build.setter
def build(self):
self._check_options_initialized()
if not isinstance(value, bool):
raise TypeError("SoSOptions.build expects a boolean")
self._build = value
@property
def verbosity(self):
if self._options != None:
return self._options.verbosity
return self._verbosity
@verbosity.setter
def verbosity(self, value):
self._check_options_initialized()
if value < 0 or value > 3:
raise ValueError("SoSOptions.verbosity expects a value [0..3]")
self._verbosity = value
@property
def quiet(self):
if self._options != None:
return self._options.quiet
return self._quiet
@quiet.setter
def quiet(self, value):
self._check_options_initialized()
if not isinstance(value, bool):
raise TypeError("SoSOptions.quiet expects a boolean")
self._quiet = value
@property
def debug(self):
if self._options != None:
return self._options.debug
return self._debug
@debug.setter
def debug(self, value):
self._check_options_initialized()
if not isinstance(value, bool):
raise TypeError("SoSOptions.debug expects a boolean")
self._debug = value
@property
def ticket_number(self):
if self._options != None:
return self._options.ticket_number
return self._ticket_number
@ticket_number.setter
def ticket_number(self, value):
self._check_options_initialized()
self._ticket_number = value
@property
def customer_name(self):
if self._options != None:
return self._options.customer_name
return self._customer_name
@customer_name.setter
def customer_name(self, value):
self._check_options_initialized()
self._customer_name = value
@property
def config_file(self):
if self._options != None:
return self._options.config_file
return self._config_file
@config_file.setter
def config_file(self, value):
self._check_options_initialized()
self._config_file = value
@property
def tmp_dir(self):
if self._options != None:
return self._options.tmp_dir
return self._tmp_dir
@tmp_dir.setter
def tmp_dir(self, value):
self._check_options_initialized()
self._tmp_dir = value
@property
def report(self):
if self._options != None:
return self._options.report
return self._report
@report.setter
def report(self, value):
self._check_options_initialized()
if not isinstance(value, bool):
raise TypeError("SoSOptions.report expects a boolean")
self._report = value
@property
def profiler(self):
if self._options != None:
return self._options.profiler
return self._profiler
@profiler.setter
def profiler(self, value):
self._check_options_initialized()
if not isinstance(value, bool):
raise TypeError("SoSOptions.profiler expects a boolean")
self._profiler = value
@property
def compression_type(self):
if self._options != None:
return self._options.compression_type
return self._compression_type
@compression_type.setter
def compression_type(self, value):
self._check_options_initialized()
self._compression_type = value
def _parse_args(self, args):
""" Parse command line options and arguments"""
self.parser = parser = OptionParserExtended(option_class=SosOption)
parser.add_option("-l", "--list-plugins", action="store_true",
dest="list_plugins", default=False,
help="list plugins and available plugin options")
parser.add_option("-n", "--skip-plugins", action="extend",
dest="noplugins", type="string",
help="disable these plugins", default = deque())
parser.add_option("-e", "--enable-plugins", action="extend",
dest="enableplugins", type="string",
help="enable these plugins", default = deque())
parser.add_option("-o", "--only-plugins", action="extend",
dest="onlyplugins", type="string",
help="enable these plugins only", default = deque())
parser.add_option("-k", "--plugin-option", action="extend",
dest="plugopts", type="string",
help="plugin options in plugname.option=value format (see -l)",
default = deque())
parser.add_option("-a", "--alloptions", action="store_true",
dest="usealloptions", default=False,
help="enable all options for loaded plugins")
parser.add_option("--batch", action="store_true",
dest="batch", default=False,
help="batch mode - do not prompt interactively")
parser.add_option("--build", action="store_true", \
dest="build", default=False, \
help="keep sos tree available and dont package results")
parser.add_option("-v", "--verbose", action="count",
dest="verbosity",
help="increase verbosity")
parser.add_option("", "--quiet", action="store_true",
dest="quiet", default=False,
help="only print fatal errors")
parser.add_option("--debug", action="count",
dest="debug",
help="enable interactive debugging using the python debugger")
parser.add_option("--ticket-number", action="store",
dest="ticket_number",
help="specify ticket number")
parser.add_option("--name", action="store",
dest="customer_name",
help="specify report name")
parser.add_option("--config-file", action="store",
dest="config_file",
help="specify alternate configuration file")
parser.add_option("--tmp-dir", action="store",
dest="tmp_dir",
help="specify alternate temporary directory", default=None)
parser.add_option("--no-report", action="store_true",
dest="report",
help="Disable HTML/XML reporting", default=False)
parser.add_option("--profile", action="store_true",
dest="profiler",
help="turn on profiling", default=False)
parser.add_option("-z", "--compression-type", dest="compression_type",
help="compression technology to use [auto, zip, gzip, bzip2, xz] (default=auto)",
default="auto")
return parser.parse_args(args)[0]
class SoSReport(object):
def __init__(self, args):
self.loaded_plugins = deque()
self.skipped_plugins = deque()
self.all_options = deque()
self.xml_report = XmlReport()
self.global_plugin_options = {}
self.archive = None
self.tempfile_util = None
try:
import signal
signal.signal(signal.SIGTERM, self.get_exit_handler())
except Exception:
pass # not available in java, but we don't care
#self.opts = self.parse_options(args)[0]
self.opts = SoSOptions(args)
self._set_debug()
self._read_config()
self.policy = sos.policies.load()
self._is_root = self.policy.is_root()
self.tmpdir = os.path.abspath(
self.policy.get_tmp_dir(self.opts.tmp_dir))
if not os.path.isdir(self.tmpdir) \
or not os.access(self.tmpdir, os.W_OK):
# write directly to stderr as logging is not initialised yet
sys.stderr.write("temporary directory %s " % self.tmpdir \
+ "does not exist or is not writable\n")
self._exit(1)
self.tempfile_util = TempFileUtil(self.tmpdir)
self._set_directories()
def print_header(self):
self.ui_log.info("\n%s\n" % _("sosreport (version %s)" % (__version__,)))
def get_commons(self):
return {
'cmddir': self.cmddir,
'logdir': self.logdir,
'rptdir': self.rptdir,
'tmpdir': self.tmpdir,
'soslog': self.soslog,
'proflog' : self.proflog,
'policy': self.policy,
'verbosity': self.opts.verbosity,
'xmlreport': self.xml_report,
'cmdlineopts': self.opts,
'config': self.config,
'global_plugin_options': self.global_plugin_options,
}
def get_temp_file(self):
return self.tempfile_util.new()
def _set_archive(self):
if self.opts.compression_type not in ('auto', 'zip', 'bzip2', 'gzip', 'xz'):
raise Exception("Invalid compression type specified. Options are:" +
"auto, zip, bzip2, gzip and xz")
archive_name = os.path.join(self.tmpdir,self.policy.get_archive_name())
if self.opts.compression_type == 'auto':
auto_archive = self.policy.preferred_archive_name()
self.archive = auto_archive(archive_name, self.tmpdir)
elif self.opts.compression_type == 'zip':
self.archive = ZipFileArchive(archive_name, self.tmpdir)
else:
self.archive = TarFileArchive(archive_name, self.tmpdir)
def _make_archive_paths(self):
self.archive.makedirs(self.cmddir, 0o755)
self.archive.makedirs(self.logdir, 0o755)
self.archive.makedirs(self.rptdir, 0o755)
def _set_directories(self):
self.cmddir = 'sos_commands'
self.logdir = 'sos_logs'
self.rptdir = 'sos_reports'
def _set_debug(self):
if self.opts.debug:
sys.excepthook = self._exception
self.raise_plugins = True
else:
self.raise_plugins = False
@staticmethod
def _exception(etype, eval_, etrace):
""" Wrap exception in debugger if not in tty """
if hasattr(sys, 'ps1') or not sys.stderr.isatty():
# we are in interactive mode or we don't have a tty-like
# device, so we call the default hook
sys.__excepthook__(etype, eval_, etrace)
else:
import traceback, pdb
# we are NOT in interactive mode, print the exception...
traceback.print_exception(etype, eval_, etrace, limit=2, file=sys.stdout)
print_()
# ...then start the debugger in post-mortem mode.
pdb.pm()
def _exit(self, error=0):
raise SystemExit()
# sys.exit(error)
def get_exit_handler(self):
def exit_handler(signum, frame):
self._exit()
return exit_handler
def _read_config(self):
self.config = ConfigParser()
if self.opts.config_file:
config_file = self.opts.config_file
else:
config_file = '/etc/sos.conf'
try:
self.config.readfp(open(config_file))
except IOError:
pass
def _setup_logging(self):
# main soslog
self.soslog = logging.getLogger('sos')
self.soslog.setLevel(logging.DEBUG)
self.sos_log_file = self.get_temp_file()
self.sos_log_file.close()
flog = logging.FileHandler(self.sos_log_file.name)
flog.setFormatter(logging.Formatter('%(asctime)s %(levelname)s: %(message)s'))
flog.setLevel(logging.INFO)
self.soslog.addHandler(flog)
if not self.opts.quiet:
console = logging.StreamHandler(sys.stderr)
console.setFormatter(logging.Formatter('%(message)s'))
if self.opts.verbosity and self.opts.verbosity > 1:
console.setLevel(logging.DEBUG)
flog.setLevel(logging.DEBUG)
elif self.opts.verbosity and self.opts.verbosity > 0:
console.setLevel(logging.INFO)
else:
console.setLevel(logging.WARNING)
self.soslog.addHandler(console)
# ui log
self.ui_log = logging.getLogger('sos_ui')
self.ui_log.setLevel(logging.INFO)
self.sos_ui_log_file = self.get_temp_file()
self.sos_ui_log_file.close()
ui_fhandler = logging.FileHandler(self.sos_ui_log_file.name)
ui_fhandler.setFormatter(logging.Formatter('%(asctime)s %(levelname)s: %(message)s'))
self.ui_log.addHandler(ui_fhandler)
if not self.opts.quiet:
ui_console = logging.StreamHandler(sys.stdout)
ui_console.setFormatter(logging.Formatter('%(message)s'))
ui_console.setLevel(logging.INFO)
self.ui_log.addHandler(ui_console)
# profile logging
if self.opts.profiler:
self.proflog = logging.getLogger('sosprofile')
self.proflog.setLevel(logging.DEBUG)
self.sos_profile_log_file = self.get_temp_file()
plog = logging.FileHandler(self.sos_profile_log_file.name)
plog.setFormatter(logging.Formatter('%(message)s'))
plog.setLevel(logging.DEBUG)
self.proflog.addHandler(plog)
else:
self.proflog = logging.getLogger('sosprofile')
self.proflog.setLevel(logging.FATAL)
def _finish_logging(self):
logging.shutdown()
# the logging module seems to persist in the jython/jboss/eap world
# so the handlers need to be removed
for logger in [logging.getLogger(x) for x in ('sos', 'sosprofile', 'sos_ui')]:
for h in logger.handlers:
logger.removeHandler(h)
if getattr(self, "sos_log_file", None):
self.archive.add_file(self.sos_log_file.name, dest=os.path.join('sos_logs', 'sos.log'))
if getattr(self, "sos_profile_log_file", None):
self.archive.add_file(self.sos_profile_log_file.name, dest=os.path.join('sos_logs', 'profile.log'))
if getattr(self, "sos_ui_log_file", None):
self.archive.add_file(self.sos_ui_log_file.name, dest=os.path.join('sos_logs', 'ui.log'))
def _get_disabled_plugins(self):
disabled = []
if self.config.has_option("plugins", "disable"):
disabled = [plugin.strip() for plugin in
self.config.get("plugins", "disable").split(',')]
return disabled
def _is_skipped(self, plugin_name):
return (plugin_name in self.opts.noplugins or
plugin_name in self._get_disabled_plugins())
def _is_inactive(self, plugin_name, pluginClass):
return (not pluginClass(self.get_commons()).check_enabled() and
not plugin_name in self.opts.enableplugins and
not plugin_name in self.opts.onlyplugins)
def _is_not_default(self, plugin_name, pluginClass):
return (not pluginClass(self.get_commons()).default_enabled() and
not plugin_name in self.opts.enableplugins and
not plugin_name in self.opts.onlyplugins)
def _is_not_specified(self, plugin_name):
return (self.opts.onlyplugins and
not plugin_name in self.opts.onlyplugins)
def _skip(self, plugin_class, reason="unknown"):
self.skipped_plugins.append((
plugin_class.name(),
plugin_class(self.get_commons()),
reason
))
def _load(self, plugin_class):
self.loaded_plugins.append((
plugin_class.name(),
plugin_class(self.get_commons())
))
def load_plugins(self):
import sos.plugins
helper = ImporterHelper(sos.plugins)
plugins = helper.get_modules()
self.plugin_names = deque()
# validate and load plugins
for plug in plugins:
plugbase, ext = os.path.splitext(plug)
try:
plugin_classes = import_plugin(plugbase,
tuple(self.policy.valid_subclasses))
for plugin_class in plugin_classes:
if not self.policy.validatePlugin(plugin_class):
self.soslog.warning(_("plugin %s does not validate, skipping") % plug)
if self.opts.verbosity > 0:
self._skip(plugin_class, _("does not validate"))
continue
if plugin_class.requires_root and not self._is_root:
self.soslog.info(_("plugin %s requires root permissions to execute, skipping") % plug)
self._skip(plugin_class, _("requires root"))
continue
# plug-in is valid, let's decide whether run it or not
self.plugin_names.append(plugbase)
if self._is_skipped(plugbase):
self._skip(plugin_class, _("skipped"))
continue
if self._is_inactive(plugbase, plugin_class):
self._skip(plugin_class, _("inactive"))
continue
if self._is_not_default(plugbase, plugin_class):
self._skip(plugin_class, _("not default"))
continue
if self._is_not_specified(plugbase):
self._skip(plugin_class, _("not specified"))
continue
self._load(plugin_class)
except Exception as e:
self.soslog.warning(_("plugin %s does not install, skipping: %s") % (plug, e))
if self.raise_plugins:
raise
def _set_all_options(self):
if self.opts.usealloptions:
for plugname, plug in self.loaded_plugins:
for name, parms in zip(plug.opt_names, plug.opt_parms):
if type(parms["enabled"])==bool:
parms["enabled"] = True
def _set_tunables(self):
if self.config.has_section("tunables"):
if not self.opts.plugopts:
self.opts.plugopts = deque()
for opt, val in self.config.items("tunables"):
if not opt.split('.')[0] in self._get_disabled_plugins():
self.opts.plugopts.append(opt + "=" + val)
if self.opts.plugopts:
opts = {}
for opt in self.opts.plugopts:
# split up "general.syslogsize=5"
try:
opt, val = opt.split("=")
except:
val = True
else:
if val.lower() in ["off", "disable", "disabled", "false"]:
val = False
else:
# try to convert string "val" to int()
try:
val = int(val)
except:
pass
# split up "general.syslogsize"
try:
plug, opt = opt.split(".")
except:
plug = opt
opt = True
try:
opts[plug]
except KeyError:
opts[plug] = deque()
opts[plug].append( (opt, val) )
for plugname, plug in self.loaded_plugins:
if plugname in opts:
for opt, val in opts[plugname]:
if not plug.set_option(opt, val):
self.soslog.error('no such option "%s" for plugin '
'(%s)' % (opt,plugname))
self._exit(1)
del opts[plugname]
for plugname in opts.keys():
self.soslog.error('unable to set option for disabled or non-existing '
'plugin (%s)' % (plugname))
def _check_for_unknown_plugins(self):
import itertools
for plugin in itertools.chain(self.opts.onlyplugins,
self.opts.noplugins,
self.opts.enableplugins):
plugin_name = plugin.split(".")[0]
if not plugin_name in self.plugin_names:
self.soslog.fatal('a non-existing plugin (%s) was specified in the '
'command line' % (plugin_name))
self._exit(1)
def _set_plugin_options(self):
for plugin_name, plugin in self.loaded_plugins:
names, parms = plugin.get_all_options()
for optname, optparm in zip(names, parms):
self.all_options.append((plugin, plugin_name, optname, optparm))
def list_plugins(self):
if not self.loaded_plugins and not self.skipped_plugins:
self.soslog.fatal(_("no valid plugins found"))
return
if self.loaded_plugins:
self.ui_log.info(_("The following plugins are currently enabled:"))
self.ui_log.info("")
for (plugname, plug) in self.loaded_plugins:
self.ui_log.info(" %-20s %s" % (plugname, plug.get_description()))
else:
self.ui_log.info(_("No plugin enabled."))
self.ui_log.info("")
if self.skipped_plugins:
self.ui_log.info(_("The following plugins are currently disabled:"))
self.ui_log.info("")
for (plugname, plugclass, reason) in self.skipped_plugins:
self.ui_log.info(" %-20s %-14s %s" % (plugname,
reason,
plugclass.get_description()))
self.ui_log.info("")
if self.all_options:
self.ui_log.info(_("The following plugin options are available:"))
self.ui_log.info("")
for (plug, plugname, optname, optparm) in self.all_options:
# format option value based on its type (int or bool)
if type(optparm["enabled"]) == bool:
if optparm["enabled"] == True:
tmpopt = "on"
else:
tmpopt = "off"
else:
tmpopt = optparm["enabled"]
self.ui_log.info(" %-25s %-15s %s" % (
plugname + "." + optname, tmpopt, optparm["desc"]))
else:
self.ui_log.info(_("No plugin options available."))
self.ui_log.info("")
def batch(self):
if self.opts.batch:
self.ui_log.info(self.policy.get_msg())
else:
msg = self.policy.get_msg()
msg += _("Press ENTER to continue, or CTRL-C to quit.\n")
try:
raw_input(msg)
except:
self.ui_log.info("")
self._exit()
def _log_plugin_exception(self, plugin_name):
self.soslog.error("%s\n%s" % (plugin_name, traceback.format_exc()))
def prework(self):
try:
self.policy.pre_work()
self._set_archive()
self._make_archive_paths()
except Exception as e:
import traceback
traceback.print_exc(e)
self.ui_log.info(e)
self._exit(0)
def setup(self):
for plugname, plug in self.loaded_plugins:
try:
plug.archive = self.archive
plug.setup()
except KeyboardInterrupt:
raise
except:
if self.raise_plugins:
raise
else:
self._log_plugin_exception(plugname)
def version(self):
"""Fetch version information from all plugins and store in the report
version file"""
versions = []
versions.append("sosreport: %s" % __version__)
for plugname, plug in self.loaded_plugins:
versions.append("%s: %s" % (plugname, plug.version))
self.archive.add_string(content="\n".join(versions), dest='version.txt')
def collect(self):
self.ui_log.info(_(" Running plugins. Please wait ..."))
self.ui_log.info("")
plugruncount = 0
for i in zip(self.loaded_plugins):
plugruncount += 1
plugname, plug = i[0]
if not self.opts.quiet:
sys.stdout.write("\r Running %d/%d: %s... " % (plugruncount, len(self.loaded_plugins), plugname))
sys.stdout.flush()
try:
plug.collect()
except KeyboardInterrupt:
raise
except:
if self.raise_plugins:
raise
else:
self._log_plugin_exception(plugname)
self.ui_log.info("")
def report(self):
for plugname, plug in self.loaded_plugins:
for oneFile in plug.copied_files:
try:
self.xml_report.add_file(oneFile["srcpath"], os.stat(oneFile["srcpath"]))
except:
pass
self.xml_report.serialize_to_file(
os.path.join(self.rptdir, "sosreport.xml"))
def plain_report(self):
report = Report()
for plugname, plug in self.loaded_plugins:
section = Section(name=plugname)
for alert in plug.alerts:
section.add(Alert(alert))
if plug.custom_text:
section.add(Note(plug.custom_text))
for f in plug.copied_files:
section.add(CopiedFile(name=f['srcpath'],
href= ".." + f['dstpath']))
for cmd in plug.executed_commands:
section.add(Command(name=cmd['exe'], return_code=0,
href="../" + cmd['file']))
for content, f in plug.copy_strings:
section.add(CreatedFile(name=f))
report.add(section)
fd = self.get_temp_file()
fd.write(str(PlainTextReport(report)))
fd.flush()
self.archive.add_file(fd.name, dest=os.path.join('sos_reports', 'sos.txt'))
def html_report(self):
# Generate the header for the html output file
rfd = self.get_temp_file()
rfd.write("""
Sos System Report
""")
# Make a pass to gather Alerts and a list of module names
allAlerts = deque()
plugNames = deque()
for plugname, plug in self.loaded_plugins:
for alert in plug.alerts:
allAlerts.append('%s: %s' % (plugname, plugname,
alert))
plugNames.append(plugname)
# Create a table of links to the module info
rfd.write("
Loaded Plugins:
")
rfd.write("
\n")
rr = 0
for i in range(len(plugNames)):
rfd.write('
')
# Call the report method for each plugin
for plugname, plug in self.loaded_plugins:
try:
html = plug.report()
except:
if self.raise_plugins:
raise
else:
rfd.write(html)
rfd.write("")
rfd.flush()
self.archive.add_file(rfd.name, dest=os.path.join('sos_reports', 'sos.html'))
def postproc(self):
for plugname, plug in self.loaded_plugins:
try:
plug.postproc()
except:
if self.raise_plugins:
raise
def final_work(self):
# this must come before archive creation to ensure that log
# files are closed and cleaned up at exit.
self._finish_logging()
# package up the results for the support organization
if not self.opts.build:
print (_("Creating compressed archive..."))
# compression could fail for a number of reasons
try:
final_filename = self.archive.finalize(self.opts.compression_type)
except:
if self.opts.debug:
raise
else:
return False
else:
final_filename = self.archive.get_archive_path()
self.policy.display_results(final_filename, build = self.opts.build)
self.tempfile_util.clean()
return True
def verify_plugins(self):
if not self.loaded_plugins:
self.soslog.error(_("no valid plugins were enabled"))
return False
return True
def set_global_plugin_option(self, key, value):
self.global_plugin_options[key] = value;
def execute(self):
try:
self._setup_logging()
self.policy.set_commons(self.get_commons())
self.print_header()
self.load_plugins()
self._set_all_options()
self._set_tunables()
self._check_for_unknown_plugins()
self._set_plugin_options()
if self.opts.list_plugins:
self.list_plugins()
return True
# verify that at least one plug-in is enabled
if not self.verify_plugins():
return False
self.batch()
self.prework()
self.setup()
self.collect()
if not self.opts.report:
self.report()
self.html_report()
self.plain_report()
self.postproc()
self.version()
return self.final_work()
except (SystemExit, KeyboardInterrupt):
if self.archive:
self.archive.cleanup()
if self.tempfile_util:
self.tempfile_util.clean()
return False
def main(args):
"""The main entry point"""
sos = SoSReport(args)
sos.execute()
sosreport/sos/__init__.py 0000644 0001750 0001750 00000002146 12271430455 014173 0 ustar zef zef ## Copyright 2010 Red Hat, Inc.
## Author: Adam Stokes
## 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., 675 Mass Ave, Cambridge, MA 02139, USA.
"""
This module houses the i18n setup and message function. The default is to use
gettext to internationalize messages.
"""
__version__ = "3.1"
import gettext
gettext_dir = "/usr/share/locale"
gettext_app = "sos"
gettext.bindtextdomain(gettext_app, gettext_dir)
def _default(msg):
return gettext.dgettext(gettext_app, msg)
_sos = _default
sosreport/sos/plugins/ 0000755 0001750 0001750 00000000000 12271442123 013533 5 ustar zef zef sosreport/sos/plugins/openstack_heat.py 0000644 0001750 0001750 00000003777 12254061770 017121 0 ustar zef zef ## Copyright (C) 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos import plugins
class OpenStackHeat(plugins.Plugin):
"""openstack related information
"""
plugin_name = "openstack-heat"
option_list = [("log", "gathers openstack-heat logs", "slow", False)]
def setup(self):
# Heat
self.add_cmd_output(
"heat-manage db_version",
suggest_filename="heat_db_version")
self.add_copy_specs(["/etc/heat/",
"/var/log/heat/"])
class DebianOpenStack(OpenStackHeat,
plugins.DebianPlugin,
plugins.UbuntuPlugin):
"""OpenStackHeat related information for Debian based distributions."""
packages = ('heat-api',
'heat-api-cfn',
'heat-api-cloudwatch',
'heat-common',
'heat-engine',
'python-heat',
'python-heatclient')
class RedHatOpenStack(OpenStackHeat, plugins.RedHatPlugin):
"""OpenStackHeat related information for Red Hat distributions."""
packages = ('openstack-heat-api',
'openstack-heat-api-cfn',
'openstack-heat-api-cloudwatch',
'openstack-heat-cli',
'openstack-heat-common',
'openstack-heat-engine',
'python-heatclient')
sosreport/sos/plugins/kernelrt.py 0000644 0001750 0001750 00000002640 12254061770 015743 0 ustar zef zef # -*- python -*-
# -*- coding: utf-8 -*-
#
# Copyright 2012 Red Hat Inc.
# Guy Streeter
#
# 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; version 2.
#
# This application 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.
from sos.plugins import Plugin, RedHatPlugin
class KernelRT(Plugin, RedHatPlugin):
'''Information specific to the realtime kernel
'''
plugin_name = 'kernelrt'
# this file exists only when the realtime kernel is booted
# this plugin will not be called is this file does not exist
files = ('/sys/kernel/realtime',)
def setup(self):
self.add_copy_spec('/etc/rtgroups')
self.add_copy_spec('/proc/sys/kernel/sched_rt_period_us')
self.add_copy_spec('/proc/sys/kernel/sched_rt_runtime_us')
self.add_copy_spec('/sys/kernel/realtime')
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('tuna -CP | /usthead -20')
sosreport/sos/plugins/grub2.py 0000644 0001750 0001750 00000002371 12254061770 015137 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Grub2(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""Bootloader information
"""
plugin_name = 'grub2'
packages = ('grub2',)
def setup(self):
self.add_copy_specs([
"/etc/grub.d",
"/etc/grub2.cfg",
"/etc/default/grub",
"/boot/grub/grub.cfg",
"/boot/grub2/grub.cfg",
"/boot/grub2/grubenv"
])
self.add_cmd_output("ls -lanR /boot")
self.add_cmd_output("grub2-mkconfig")
sosreport/sos/plugins/gluster.py 0000644 0001750 0001750 00000007346 12254061770 015612 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
import time
import os.path
import os
import string
from sos.plugins import Plugin, RedHatPlugin
class Gluster(Plugin, RedHatPlugin):
'''gluster related information'''
plugin_name = 'gluster'
statedump_dir = '/tmp/glusterfs-statedumps'
packages = ["glusterfs", "glusterfs-core"]
files = ["/etc/glusterd", "/var/lib/glusterd"]
def default_enabled(self):
return True
def get_volume_names(self, volume_file):
"""Return a dictionary for which key are volume names according to the
output of gluster volume info stored in volume_file.
"""
out=[]
fp = open(volume_file, 'r')
for line in fp.readlines():
if not line.startswith("Volume Name:"):
continue
volname = line[14:-1]
out.append(volname)
fp.close()
return out
def make_preparations(self, name_dir):
try:
os.mkdir(name_dir);
except:
pass
fp = open ('/tmp/glusterdump.options', 'w');
data = 'path=' + name_dir + '\n';
fp.write(data);
fp.write('all=yes');
fp.close();
def wait_for_statedump(self, name_dir):
statedumps_present = 0;
statedump_entries = os.listdir(name_dir);
for statedump_file in statedump_entries:
statedumps_present = statedumps_present+1;
last_line = 'tmp';
ret = -1;
while ret == -1:
last_line = file(name_dir + '/' + statedump_file, "r").readlines()[-1];
ret = string.count (last_line, 'DUMP_END_TIME');
def postproc(self):
if not os.path.exists(self.statedump_dir):
return
try:
for dirs in os.listdir(self.statedump_dir):
os.remove(os.path.join(self.statedump_dir,dirs));
os.rmdir(self.statedump_dir);
os.unlink('/tmp/glusterdump.options');
except:
pass
def setup(self):
self.add_cmd_output("gluster peer status")
self.add_copy_spec("/var/lib/glusterd/")
self.add_forbidden_path("/var/lib/glusterd/geo-replication/secret.pem")
# collect unified file and object storage configuration
self.add_copy_spec("/etc/swift/")
# glusterfs-server rpm scripts stash this on migration to 3.3.x
self.add_copy_spec("/etc/glusterd.rpmsave")
# common to all versions
self.add_copy_spec("/etc/glusterfs")
self.make_preparations(self.statedump_dir)
#self.add_cmd_output("killall -USR1 glusterfs glusterfsd")
os.system("killall -USR1 glusterfs glusterfsd");
# let all the processes catch the signal and create statedump file
# entries.
time.sleep(1)
self.wait_for_statedump(self.statedump_dir)
self.add_copy_spec('/tmp/glusterdump.options')
self.add_copy_spec(self.statedump_dir)
self.add_cmd_output("gluster volume status")
# collect this last as some of the other actions create log entries
self.add_copy_spec("/var/log/glusterfs")
sosreport/sos/plugins/lilo.py 0000644 0001750 0001750 00000001740 12254061770 015054 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin
class Lilo(Plugin, RedHatPlugin, UbuntuPlugin):
"""Lilo information
"""
plugin_name = 'lilo'
packages = ('lilo',)
def setup(self):
self.add_copy_spec("/etc/lilo.conf")
self.add_cmd_output("lilo -q")
sosreport/sos/plugins/ssh.py 0000644 0001750 0001750 00000002044 12254061770 014710 0 ustar zef zef ## Copyright (C) 2007 Red Hat, Inc., Eugene Teo
### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Ssh(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""ssh-related information
"""
plugin_name = 'ssh'
def setup(self):
self.add_copy_specs(["/etc/ssh/ssh_config", "/etc/ssh/sshd_config"])
sosreport/sos/plugins/cs.py 0000644 0001750 0001750 00000007206 12254061770 014525 0 ustar zef zef ## Copyright (C) 2007-2010 Red Hat, Inc., Kent Lamb
## Marc Sauton
## Pierre Carrier
### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin
from os.path import exists
from glob import glob
class CertificateSystem(Plugin, RedHatPlugin):
"""Red Hat Certificate System 7.1, 7.3, 8.0 and dogtag related information
"""
plugin_name = 'certificatesystem'
def checkversion(self):
if self.is_installed("redhat-cs") or exists("/opt/redhat-cs"):
return 71
elif self.is_installed("rhpki-common") or len(glob("/var/lib/rhpki-*")):
return 73
# 8 should cover dogtag
elif self.is_installed("pki-common") or exists("/usr/share/java/pki"):
return 8
return False
def check_enabled(self):
if self.is_installed("redhat-cs") or \
self.is_installed("rhpki-common") or \
self.is_installed("pki-common") or \
exists("/opt/redhat-cs") or \
exists("/usr/share/java/rhpki") or \
exists("/usr/share/java/pki"):
return True
return False
def setup(self):
csversion = self.checkversion()
if not csversion:
self.add_alert("Red Hat Certificate System not found.")
return
if csversion == 71:
self.add_copy_specs([
"/opt/redhat-cs/slapd-*/logs/access",
"/opt/redhat-cs/slapd-*/logs/errors",
"/opt/redhat-cs/slapd-*/config/dse.ldif",
"/opt/redhat-cs/cert-*/errors",
"/opt/redhat-cs/cert-*/config/CS.cfg",
"/opt/redhat-cs/cert-*/access",
"/opt/redhat-cs/cert-*/errors",
"/opt/redhat-cs/cert-*/system",
"/opt/redhat-cs/cert-*/transactions",
"/opt/redhat-cs/cert-*/debug",
"/opt/redhat-cs/cert-*/tps-debug.log"])
if csversion == 73:
self.add_copy_specs([
"/var/lib/rhpki-*/conf/*cfg*",
"/var/lib/rhpki-*/conf/*.ldif",
"/var/lib/rhpki-*/logs/debug",
"/var/lib/rhpki-*/logs/catalina.*",
"/var/lib/rhpki-*/logs/ra-debug.log",
"/var/lib/rhpki-*/logs/transactions",
"/var/lib/rhpki-*/logs/system"])
if csversion in (73, 8):
self.add_copy_specs([
"/etc/dirsrv/slapd-*/dse.ldif",
"/var/log/dirsrv/slapd-*/access",
"/var/log/dirsrv/slapd-*/errors"])
if csversion == 8:
self.add_copy_specs([
"/etc/pki-*/CS.cfg",
"/var/lib/pki-*/conf/*cfg*",
"/var/log/pki-*/debug",
"/var/log/pki-*/catalina.*",
"/var/log/pki-*/ra-debug.log",
"/var/log/pki-*/transactions",
"/var/log/pki-*/system"])
sosreport/sos/plugins/libvirt.py 0000644 0001750 0001750 00000002304 12254061770 015565 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin
import glob
class Libvirt(Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin):
"""libvirt-related information
"""
plugin_name = 'libvirt'
def setup(self):
self.add_copy_specs(["/etc/libvirt/", "/var/log/libvirt*"])
def postproc(self):
for xmlfile in glob.glob("/etc/libvirt/qemu/*.xml"):
self.do_file_sub(xmlfile,
r"(\s*passwd=\s*')([^']*)('.*$)",
r"\1******\3")
sosreport/sos/plugins/rhui.py 0000644 0001750 0001750 00000002763 12254061770 015072 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin
import os
class Rhui(Plugin, RedHatPlugin):
"""Red Hat Update Infrastructure for Cloud Providers data
"""
plugin_name = 'rhui'
rhui_debug_path = "/usr/share/rh-rhua/rhui-debug.py"
packages = [ "rh-rhui-tools" ]
files = [ rhui_debug_path ]
def setup(self):
if self.is_installed("pulp-cds"):
cds = "--cds"
else:
cds = ""
rhui_debug_dst_path = os.path.join(self.get_cmd_path(),
self.commons['cmddir'], self.name())
try:
os.mkdir(rhui_debug_dst_path)
except:
return
self.add_cmd_output("python %s %s --dir %s"
% (self.rhui_debug_path, cds, rhui_debug_dst_path),
suggest_filename="rhui-debug")
return
sosreport/sos/plugins/mysql.py 0000644 0001750 0001750 00000003266 12254061770 015267 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
from os.path import exists
class Mysql(Plugin):
"""MySQL related information
"""
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
"""
packages = ('mysql-server', 'mysql')
def setup(self):
self.mysql_cnf = "/etc/my.cnf"
super(RedHatMysql, self).setup()
self.add_copy_spec("/etc/ld.so.conf.d/mysql*")
class DebianMysql(Mysql, DebianPlugin, UbuntuPlugin):
"""MySQL related information for Debian based distributions
"""
packages = ('mysql-server', 'mysql-common')
def setup(self):
self.mysql_cnf = "/etc/mysql/my.cnf"
super(DebianMysql, self).setup()
self.add_copy_spec("/etc/mysql/conf.d/mysql*")
sosreport/sos/plugins/rhevm.py 0000644 0001750 0001750 00000001511 12254061770 015232 0 ustar zef zef from sos.plugins import Plugin, RedHatPlugin
# Class name must be the same as file name and method names must not change
class RhevM(Plugin, RedHatPlugin):
"""RHEV-Manager related information"""
plugin_name = 'rhevm'
option_list = [("vdsmlogs", 'Directory containing all of the SOS logs from the RHEV hypervisor(s)', '', False)]
def setup(self):
# Copy rhevm config files.
self.add_copy_spec("/etc/rhevm")
self.add_copy_spec("/var/log/rhevm")
if self.get_option("vdsmlogs"):
self.add_copy_spec(self.get_option("vdsmlogs"))
def postproc(self):
"""
Obfuscate passwords.
"""
self.do_file_sub("/etc/rhevm/rhevm-config/rhevm-config.properties",
r"Password.type=(.*)",
r'Password.type=********')
sosreport/sos/plugins/__init__.py 0000644 0001750 0001750 00000066707 12271432722 015670 0 ustar zef zef ## This exports methods available for use by plugins for sos
## Copyright (C) 2006 Steve Conklin
### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
# pylint: disable-msg = R0902
# pylint: disable-msg = R0904
# pylint: disable-msg = W0702
# pylint: disable-msg = W0703
# pylint: disable-msg = R0201
# pylint: disable-msg = W0611
# pylint: disable-msg = W0613
from __future__ import with_statement
from sos.utilities import sos_get_command_output, import_module, grep, fileobj, tail
import os
import glob
import re
import traceback
from stat import *
from time import time
from itertools import *
import logging
import fnmatch
# PYCOMPAT
import six
from six.moves import zip, filter
try:
import json
except ImportError:
import simplejson as json
def common_prefix(l1, l2, common = None):
"""Returns a tuple like the following:
([common, elements, from l1, and l2], [[tails, from, l1], [tails, from, l2]])
>>> common_prefix(['usr','share','foo'], ['usr','share','bar'])
(['usr','share'], [['foo'], ['bar']])
"""
if common is None:
common = []
if len(l1) < 1 or len(l2) < 1 or l1[0] != l2[0]:
return (common, [l1, l2])
return common_prefix(l1[1:], l2[1:], common+[l1[0]])
def sos_relative_path(path1, path2, sep=os.path.sep, pardir=os.path.pardir):
'''Return a relative path from path1 equivalent to path path2. In
particular: the empty string, if path1 == path2; path2, if path1 and path2
have no common prefix.
'''
try:
common, (u1, u2) = common_prefix(path1.split(sep), path2.split(sep))
except AttributeError:
return path2
if not common:
return path2 # leave path absolute if nothing at all in common
return sep.join( [pardir]*len(u1) + u2 )
def regex_findall(regex, fname):
'''Return a list of all non overlapping matches in the string(s)'''
try:
with fileobj(fname) as f:
return re.findall(regex, f.read(), re.MULTILINE)
except AttributeError:
return []
def mangle_command(command):
# FIXME: this can be improved
mangledname = re.sub(r"^/(usr/|)(bin|sbin)/", "", command)
mangledname = re.sub(r"[^\w\-\.\/]+", "_", mangledname)
mangledname = re.sub(r"/", ".", mangledname).strip(" ._-")[0:64]
return mangledname
class PluginException(Exception):
pass
class Plugin(object):
""" This is the base class for sosreport plugins. Plugins should subclass
this and set the class variables where applicable.
plugin_name is a string returned by plugin.name(). If this is set to None
(the default) class_.__name__.tolower() will be returned. Be sure to set
this if you are defining multiple plugins that do the same thing on
different platforms.
requires_root is a boolean that specifies whether or not sosreport should
execute this plugin as a super user.
version is a string representing the version of the plugin. This can be
useful for post-collection tooling.
packages (files) is an iterable of the names of packages (the paths
of files) to check for before running this plugin. If any of these packages
or files is found on the system, the default implementation of check_enabled
will return True.
"""
plugin_name = None
requires_root = True
version = 'unversioned'
packages = ()
files = ()
def __init__(self, commons):
if not getattr(self, "option_list", False):
self.option_list = []
self.copied_files = []
self.executed_commands = []
self.alerts = []
self.custom_text = ""
self.opt_names = []
self.opt_parms = []
self.commons = commons
self.forbidden_paths = []
self.copy_paths = []
self.copy_strings = []
self.collect_cmds = []
self.soslog = self.commons['soslog'] if 'soslog' in self.commons else logging.getLogger('sos')
self.proflog = self.commons['proflog'] if 'proflog' in self.commons else logging.getLogger('sosprofile')
# get the option list into a dictionary
for opt in self.option_list:
self.opt_names.append(opt[0])
self.opt_parms.append({'desc':opt[1], 'speed':opt[2], 'enabled':opt[3]})
@classmethod
def name(class_):
"""Returns the plugin's name as a string. This should return a
lowercase string.
"""
if class_.plugin_name:
return class_.plugin_name
return class_.__name__.lower()
def policy(self):
return self.commons["policy"]
def is_installed(self, package_name):
'''Is the package $package_name installed?'''
return (self.policy().pkg_by_name(package_name) is not None)
def do_cmd_output_sub(self, cmd, regexp, subst):
'''Apply a regexp substitution to command output archived by sosreport.
cmd is the command name from which output is collected (i.e. excluding
parameters). The regexp can be a string or a compiled re object. The
substitution string, subst, is a string that replaces each occurrence
of regexp in each file collected from cmd. Internally 'cmd' is treated
as a glob with a leading and trailing '*' and each matching file from
the current module's command list is subjected to the replacement.
This function returns the number of replacements made.
'''
if self.commons['cmdlineopts'].profiler:
start_time = time()
globstr = '*' + cmd + '*'
self.soslog.debug("substituting '%s' for '%s' in commands matching %s"
% (subst, regexp, globstr))
if not self.executed_commands:
return 0
try:
for called in self.executed_commands:
# was anything collected?
if called['file'] == None:
continue
if fnmatch.fnmatch(called['exe'], globstr):
path = os.path.join(self.commons['cmddir'], called['file'])
self.soslog.debug("applying substitution to %s" % path)
readable = self.archive.open_file(path)
result, replacements = re.subn(
regexp, subst, readable.read())
if replacements:
self.archive.add_string(result, path)
else:
replacements = 0
except Exception as e:
msg = 'regex substitution failed for %s in plugin %s with: "%s"'
self.soslog.error(msg % (called['exe'], self.name(), e))
replacements = 0
if self.commons['cmdlineopts'].profiler:
time_passed = time() - start_time
self.proflog.debug("subst: %-75s time: %f"
% (globstr, time_passed))
return replacements
def do_file_sub(self, srcpath, regexp, subst):
'''Apply a regexp substitution to a file archived by sosreport.
srcpath is the path in the archive where the file can be found. regexp
can be a regexp string or a compiled re object. subst is a string to
replace each occurance of regexp in the content of srcpath.
This function returns the number of replacements made.
'''
if self.commons['cmdlineopts'].profiler:
start_time = time()
try:
path = self._get_dest_for_srcpath(srcpath)
self.soslog.debug("substituting '%s' for '%s' in %s"
% (subst, regexp, path))
if not path:
return 0
readable = self.archive.open_file(path)
result, replacements = re.subn(regexp, subst, readable.read())
if replacements:
self.archive.add_string(result, srcpath)
else:
replacements = 0
except Exception as e:
msg = 'regex substitution failed for %s in plugin %s with: "%s"'
self.soslog.error(msg % (path, self.name(), e))
replacements = 0
if self.commons['cmdlineopts'].profiler:
time_passed = time() - start_time
self.proflog.debug("subst : %-75s time: %f"
% (srcpath, time_passed))
return replacements
def do_regex_find_all(self, regex, fname):
return regex_findall(regex, fname)
def _path_in_path_list(self, path, path_list):
for p in path_list:
if p in path:
return True
return False
def copy_symlink(self, srcpath, sub=None):
# 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)))
if os.path.isdir(absdest):
self.soslog.debug("link %s is a directory, skipping..."
% linkdest)
return
if sub:
old, new = sub
reldest = srcpath.replace(old, new)
# 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)
self.copied_files.append({
'srcpath':srcpath,
'dstpath':srcpath,
'symlink':"yes",
'pointsto':linkdest})
def copy_dir(self, srcpath, sub=None):
for afile in os.listdir(srcpath):
self.do_copy_file_or_dir(os.path.join(srcpath, afile), dest=None, sub=sub)
def _get_dest_for_srcpath(self, srcpath):
for copied in self.copied_files:
if srcpath == copied["srcpath"]:
return copied["dstpath"]
return None
# Methods for copying files and shelling out
def do_copy_file_or_dir(self, srcpath, dest=None, sub=None):
# pylint: disable-msg = R0912
# pylint: disable-msg = R0915
'''Copy file or directory to the destination tree. If a directory, then
everything below it is recursively copied. A list of copied files are
saved for use later in preparing a report. sub can be used to rename
the destination of the file, sub should be a two-tuple of (old,new).
For example if you passed in ("etc","configurations") for use against
/etc/my_file.conf the file would end up at
/configurations/my_file.conf.
'''
if self.commons['cmdlineopts'].profiler:
start_time = time()
if self._path_in_path_list(srcpath, self.forbidden_paths):
self.soslog.debug("%s is in the forbidden path list" % srcpath)
return ''
if not os.path.exists(srcpath):
self.soslog.debug("file or directory %s does not exist" % srcpath)
return
if not dest:
dest = srcpath
if sub:
old, new = sub
dest = srcpath.replace(old, new)
if os.path.islink(srcpath):
self.copy_symlink(srcpath, sub=sub)
return
else:
if os.path.isdir(srcpath):
self.copy_dir(srcpath, sub=sub)
return
# if we get here, it's definitely a regular file (not a symlink or dir)
self.soslog.debug("copying file %s to %s" % (srcpath,dest))
try:
stat = os.stat(srcpath)
# if not readable(srcpath)
if not (stat.st_mode & 0o444):
# FIXME: reflect permissions in archive
self.archive.add_string("", dest)
else:
self.archive.add_file(srcpath, dest)
self.copied_files.append({
'srcpath':srcpath,
'dstpath':dest,
'symlink':"no"})
if self.commons['cmdlineopts'].profiler:
time_passed = time() - start_time
self.proflog.debug("copied: %-75s time: %f" % (srcpath, time_passed))
except Exception as e:
self.soslog.error("Unable to copy %s to %s" % (srcpath, dest))
self.soslog.error(traceback.format_exc())
def add_forbidden_path(self, forbiddenPath):
"""Specify a path to not copy, even if it's part of a copy_paths[]
entry.
"""
# Glob case handling is such that a valid non-glob is a reduced glob
for filespec in glob.glob(forbiddenPath):
self.forbidden_paths.append(filespec)
def get_all_options(self):
"""return a list of all options selected"""
return (self.opt_names, self.opt_parms)
def set_option(self, optionname, value):
'''set the named option to value.'''
for name, parms in zip(self.opt_names, self.opt_parms):
if name == optionname:
parms['enabled'] = value
return True
else:
return False
def option_enabled(self, optionname):
'''Deprecated, use get_option() instead'''
return self.get_option(optionname)
def get_option(self, optionname, default=0):
"""Returns the first value that matches 'optionname' in parameters
passed in via the command line or set via set_option or via the
global_plugin_options dictionary, in that order.
optionaname may be iterable, in which case the first option that
matches any of the option names is returned.
"""
def _check(key):
if hasattr(optionname, "__iter__"):
return key in optionname
else:
return key == optionname
for name, parms in zip(self.opt_names, self.opt_parms):
if _check(name):
val = parms['enabled']
if val != None:
return val
for key, value in six.iteritems(self.commons.get('global_plugin_options', {})):
if _check(key):
return value
return default
def get_option_as_list(self, optionname, delimiter=",", default=None):
'''Will try to return the option as a list separated by the
delimiter.
'''
option = self.get_option(optionname)
try:
opt_list = [opt.strip() for opt in option.split(delimiter)]
return list(filter(None, opt_list))
except Exception:
return default
def add_copy_spec_limit(self, copyspec, sizelimit=None, sub=None):
"""Add a file or glob but limit it to sizelimit megabytes. If fname is
a single file the file will be tailed to meet sizelimit. If the first
file in a glob is too large it will be tailed to meet the sizelimit.
"""
if not (copyspec and len(copyspec)):
return False
files = glob.glob(copyspec)
files.sort()
if len(files) == 0:
return
current_size = 0
limit_reached = False
sizelimit *= 1024 * 1024 # in MB
_file = None
for _file in files:
current_size += os.stat(_file)[ST_SIZE]
if sizelimit and current_size > sizelimit:
limit_reached = True
break
self.add_copy_spec(_file, sub)
if limit_reached:
file_name = _file
if sub:
old, new = sub
file_name = _file.replace(old, new)
if file_name[0] == os.sep:
file_name = file_name.lstrip(os.sep)
strfile = file_name.replace(os.path.sep, ".") + ".tailed"
self.add_string_as_file(tail(_file, sizelimit), strfile)
self.archive.add_link(os.path.join(
os.path.relpath('/', os.path.dirname(_file)), 'sos_strings',
self.name(), strfile), _file)
def add_copy_specs(self, copyspecs, sub=None):
for copyspec in copyspecs:
self.add_copy_spec(copyspec, sub)
def add_copy_spec(self, copyspec, sub=None):
"""Add a file specification (can be file, dir,or shell glob) to be
copied into the sosreport by this module.
"""
if not (copyspec and len(copyspec)):
# self.soslog.warning("invalid file path")
return False
# Glob case handling is such that a valid non-glob is a reduced glob
for filespec in glob.glob(copyspec):
if filespec not in self.copy_paths:
self.copy_paths.append((filespec, sub))
def get_command_output(self, prog, timeout=300):
(status, output, runtime) = sos_get_command_output(prog, timeout)
if status == 124:
self.soslog.warning("command '%s' timed out after %ds"
% (prog, timeout))
if status == 127:
self.soslog.warning("could not run '%s': command not found" % prog)
return (status, output, runtime)
def call_ext_prog(self, prog, timeout=300):
"""Execute a command independantly of the output gathering part of
sosreport.
"""
# pylint: disable-msg = W0612
return self.get_command_output(prog, timeout)
def check_ext_prog(self, prog):
"""Execute a command independently of the output gathering part of
sosreport and check the return code. Return True for a return code of 0
and False otherwise.
"""
(status, output, runtime) = self.call_ext_prog(prog)
return (status == 0)
def add_cmd_output(self, exe, suggest_filename=None, root_symlink=None, timeout=300):
"""Run a program and collect the output"""
self.collect_cmds.append( (exe, suggest_filename, root_symlink, timeout) )
def get_cmd_path(self):
"""Return a path into which this module should store collected
command output
"""
return os.path.join(self.archive.get_tmp_dir(),
'sos_commands', self.name())
def make_cmd_path(self, path):
"""Return a string representing an absolute path within this
plug-in's command output directory by apending the relative path
name 'path'.
"""
return os.path.join(self.get_cmd_path(), path)
def make_cmd_dirs(self, path):
"""Recursively create new subdirectories under this plug-in's
command output path.
"""
os.makedirs(self.make_cmd_path(path))
def file_grep(self, regexp, *fnames):
"""Returns lines matched in fnames, where fnames can either be
pathnames to files to grep through or open file objects to grep through
line by line.
"""
return grep(regexp, *fnames)
def mangle_command(self, exe):
return mangle_command(exe)
def make_command_filename(self, exe):
"""The internal function to build up a filename based on a command."""
outfn = os.path.join(self.commons['cmddir'], self.name(), self.mangle_command(exe))
# check for collisions
if os.path.exists(outfn):
inc = 2
while True:
newfn = "%s_%d" % (outfn, inc)
if not os.path.exists(newfn):
outfn = newfn
break
inc +=1
return outfn
def add_string_as_file(self, content, filename):
"""Add a string to the archive as a file named `filename`"""
self.copy_strings.append((content, filename))
def get_cmd_output_now(self, exe, suggest_filename=None, root_symlink=False, timeout=300):
"""Execute a command and save the output to a file for inclusion in the
report.
"""
if self.commons['cmdlineopts'].profiler:
start_time = time()
# pylint: disable-msg = W0612
status, shout, runtime = self.get_command_output(exe, timeout=timeout)
if (status == 127):
return None
if suggest_filename:
outfn = self.make_command_filename(suggest_filename)
else:
outfn = self.make_command_filename(exe)
outfn_strip = outfn[len(self.commons['cmddir'])+1:]
self.archive.add_string(shout, outfn)
if root_symlink:
self.archive.add_link(outfn, root_symlink)
# save info for later
self.executed_commands.append({'exe': exe, 'file':outfn_strip}) # save in our list
self.commons['xmlreport'].add_command(cmdline=exe,exitcode=status,f_stdout=outfn_strip,runtime=runtime)
if self.commons['cmdlineopts'].profiler:
time_passed = time() - start_time
self.proflog.debug("output: %-75s time: %f" % (exe, time_passed))
return outfn
# For adding output
def add_alert(self, alertstring):
"""Add an alert to the collection of alerts for this plugin. These
will be displayed in the report
"""
self.alerts.append(alertstring)
def add_custom_text(self, text):
"""Append text to the custom text that is included in the report. This
is freeform and can include html.
"""
self.custom_text += text
def collect(self):
"""Collect the data for a plugin."""
for path, sub in self.copy_paths:
self.do_copy_file_or_dir(path, sub=sub)
for string, file_name in self.copy_strings:
try:
self.archive.add_string(string,
os.path.join('sos_strings', self.name(), file_name))
except Exception as e:
self.soslog.debug("could not create %s, traceback follows: %s"
% (file_name, e))
for progs in zip(self.collect_cmds):
prog, suggest_filename, root_symlink, timeout = progs[0]
self.soslog.debug("collecting output of '%s'" % prog)
try:
self.get_cmd_output_now(prog, suggest_filename,
root_symlink, timeout)
except Exception as e:
self.soslog.debug("error collecting output of '%s' (%s)"
% (prog, e))
def get_description(self):
""" This function will return the description for the plugin"""
try:
return self.__doc__.strip()
except:
return ""
def check_enabled(self):
"""This method will be used to verify that a plugin should execute
given the condition of the underlying environment. The default
implementation will return True if neither class.files or
class.packages is specified. If either are specified the plugin will
check for the existence of any of the supplied files or packages and
return True if any exist. It is encouraged to override this method if
this behavior isn't applicable.
"""
# some files or packages have been specified for this package
if self.files or self.packages:
if isinstance(self.files, six.string_types):
self.files = [self.files]
if isinstance(self.packages, six.string_types):
self.packages = [self.packages]
return (any(os.path.exists(fname) for fname in self.files) or
any(self.is_installed(pkg) for pkg in self.packages))
return True
def default_enabled(self):
"""This devices whether a plugin should be automatically loaded or
only if manually specified in the command line."""
return True
def setup(self):
"""This method must be overridden to add the copy_paths, forbidden_paths,
and external programs to be collected at a minimum.
"""
pass
def postproc(self):
"""
perform any postprocessing. To be replaced by a plugin if desired
"""
pass
def report(self):
""" Present all information that was gathered in an html file that allows browsing
the results.
"""
# make this prettier
html = '\n' % self.name()
# Intro
html = html + "
Plugin " + self.name() + "
\n"
# Files
if len(self.copied_files):
html = html + "
Files copied:
\n"
for afile in self.copied_files:
html = html + '
%s' % \
(".." + afile['dstpath'], afile['srcpath'])
if (afile['symlink'] == "yes"):
html = html + " (symlink to %s)" % afile['pointsto']
html = html + '
\n'
html = html + "
\n"
# Command Output
if len(self.executed_commands):
html = html + "
Commands Executed:
\n"
# convert file name to relative path from our root
# don't use relpath - these are HTML paths not OS paths.
for cmd in self.executed_commands:
if cmd["file"] and len(cmd["file"]):
cmdOutRelPath = "../" + self.commons['cmddir'] \
+ "/" + cmd['file']
html = html + '
\n' % \
(cmdOutRelPath, cmd['exe'])
else:
html = html + '
%s
\n' % (cmd['exe'])
html = html + "
\n"
# Alerts
if len(self.alerts):
html = html + "
Alerts:
\n"
for alert in self.alerts:
html = html + '
%s
\n' % alert
html = html + "
\n"
# Custom Text
if (self.custom_text != ""):
html = html + "
Additional Information: \n"
html = html + self.custom_text + "
\n"
return html
class RedHatPlugin(object):
"""Tagging class to indicate that this plugin works with Red Hat Linux"""
pass
class UbuntuPlugin(object):
"""Tagging class to indicate that this plugin works with Ubuntu Linux"""
pass
class DebianPlugin(object):
"""Tagging class to indicate that this plugin works with Debian Linux"""
pass
class IndependentPlugin(object):
"""Tagging class that indicates this plugin can run on any platform"""
pass
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,
this defaults to (Plugin,).
"""
plugin_fqname = "sos.plugins.%s" % name
if not superclasses:
superclasses = (Plugin,)
return import_module(plugin_fqname, superclasses)
sosreport/sos/plugins/pam.py 0000644 0001750 0001750 00000002716 12254061770 014676 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Pam(Plugin):
"""PAM related information
"""
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()
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()
sosreport/sos/plugins/soundcard.py 0000644 0001750 0001750 00000003376 12254061770 016106 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
import os
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([
"/etc/alsa/*",
"/etc/asound.*"])
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/*")
sosreport/sos/plugins/psacct.py 0000644 0001750 0001750 00000003413 12254061770 015371 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Psacct(Plugin):
"""Process accounting related information
"""
option_list = [("all", "collect all process accounting files",
"slow", False)]
packages = [ "psacct" ]
class RedHatPsacct(Psacct, RedHatPlugin):
"""Process accounting related information for RedHat based distributions
"""
plugin_name = "psacct"
packages = [ "psacct" ]
def setup(self):
super(RedHatPsacct, self).setup()
self.add_copy_spec("/var/account/pacct")
if self.get_option("all"):
self.add_copy_spec("/var/account/pacct*.gz")
class DebianPsacct(Psacct, DebianPlugin, UbuntuPlugin):
"""Process accounting related information for Debian based distributions
"""
plugin_name = "acct"
packages = [ "acct" ]
def setup(self):
super(DebianPsacct, self).setup()
self.add_copy_specs(["/var/log/account/pacct", "/etc/default/acct"])
if self.get_option("all"):
self.add_copy_spec("/var/log/account/pacct*.gz")
sosreport/sos/plugins/block.py 0000644 0001750 0001750 00000003373 12254061770 015213 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
import os
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Block(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""Block device related information
"""
plugin_name = 'block'
def setup(self):
self.add_copy_spec("/proc/partitions")
self.add_cmd_output("lsblk")
self.add_cmd_output("blkid -c /dev/null")
self.add_cmd_output("ls -lanR /dev")
self.add_cmd_output("ls -lanR /sys/block")
# legacy location for non-/run distributions
self.add_copy_spec("/etc/blkid.tab")
self.add_copy_spec("/run/blkid/blkid.tab")
if os.path.isdir("/sys/block"):
for disk in os.listdir("/sys/block"):
if disk in [ ".", ".." ] or disk.startswith("ram"):
continue
disk_path = os.path.join('/dev/', disk)
self.add_cmd_output("udevadm info -ap /sys/block/%s" % (disk))
self.add_cmd_output("parted -s %s print" % (disk_path))
self.add_cmd_output("fdisk -l %s" % disk_path)
sosreport/sos/plugins/lsbrelease.py 0000644 0001750 0001750 00000002201 12254061770 016227 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
import os
class LsbRelease(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""Linux Standard Base information
"""
plugin_name = 'lsbrelease'
def setup(self):
self.add_cmd_output("lsb_release -a")
self.add_cmd_output("lsb_release -d", suggest_filename = "lsb_release", root_symlink = "lsb-release")
self.add_copy_spec("/etc/lsb-release*")
sosreport/sos/plugins/cron.py 0000644 0001750 0001750 00000002240 12254061770 015052 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Cron(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""Crontab information
"""
plugin_name = "cron"
files = ('/etc/crontab')
def setup(self):
self.add_copy_specs([
"/etc/cron*",
"/var/log/cron*",
"/var/spool/cron"
])
self.add_cmd_output("crontab -l -u root",
suggest_filename = "root_crontab")
sosreport/sos/plugins/apport.py 0000644 0001750 0001750 00000001742 12254061770 015424 0 ustar zef zef ## Copyright (c) 2012 Adam Stokes
## 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, DebianPlugin, UbuntuPlugin
class Apport(Plugin, DebianPlugin, UbuntuPlugin):
"""apport information
"""
plugin_name = 'apport'
def setup(self):
self.add_copy_spec("/etc/apport/*")
sosreport/sos/plugins/general.py 0000644 0001750 0001750 00000004753 12254061770 015541 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
import os
from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin
class General(Plugin):
"""basic system information"""
plugin_name = "general"
def setup(self):
self.add_copy_specs([
"/etc/init", # upstart
"/etc/event.d", # "
"/etc/inittab",
"/etc/sos.conf",
"/etc/sysconfig",
"/proc/stat",
"/var/log/pm/suspend.log",
"/var/log/up2date",
"/etc/hostid",
"/var/lib/dbus/machine-id",
"/etc/exports",
"/etc/localtime"
])
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("tree /var/lib")
self.add_cmd_output("ls -lR /var/lib")
class RedHatGeneral(General, RedHatPlugin):
"""Basic system information for RedHat based distributions"""
def setup(self):
super(RedHatGeneral, self).setup()
self.add_copy_specs([
"/etc/redhat-release",
"/etc/fedora-release",
])
def postproc(self):
self.do_file_sub("/etc/sysconfig/rhn/up2date",
r"(\s*proxyPassword\s*=\s*)\S+", r"\1***")
class DebianGeneral(General, DebianPlugin):
"""Basic system information for Debian based distributions"""
def setup(self):
super(DebianGeneral, self).setup()
self.add_copy_specs([
"/etc/default",
"/etc/lsb-release"
"/etc/debian_version",
])
class UbuntuGeneral(DebianGeneral):
"""Basic system information for Ubuntu based distributions"""
def setup(self):
super(UbuntuGeneral, self).setup()
self.add_copy_spec("/etc/os-release")
sosreport/sos/plugins/vmware.py 0000644 0001750 0001750 00000002126 12254061770 015415 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin
class VMWare(Plugin, RedHatPlugin):
"""VMWare related information
"""
plugin_name = 'vmware'
files = ('vmware','/usr/init.d/vmware-tools')
def setup(self):
self.add_cmd_output("vmware -v")
self.add_copy_specs(["/etc/vmware/locations",
"/etc/vmware/config",
"/proc/vmmemctl"])
sosreport/sos/plugins/openstack_horizon.py 0000644 0001750 0001750 00000005177 12254061770 017664 0 ustar zef zef ## Copyright (C) 2009 Red Hat, Inc., Joey Boggs
## Copyright (C) 2012 Rackspace US, Inc., Justin Shepherd
## Copyright (C) 2013 Red Hat, Inc., Jeremy Agee
### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
import os
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class OpenStackHorizon(Plugin):
"""openstack horizon related information
"""
plugin_name = "openstack-horizon"
option_list = [("log", "gathers openstack horizon logs", "slow", True)]
def setup(self):
self.add_copy_specs(["/etc/openstack-dashboard/"])
if self.option_enabled("log"):
self.add_copy_specs(["/var/log/horizon/"])
class DebianOpenStackHorizon(OpenStackHorizon, DebianPlugin):
"""OpenStack Horizon related information for Debian based distributions
"""
packages = ('python-django-horizon',
'openstack-dashboard',
'openstack-dashboard-apache')
def setup(self):
super(DebianOpenStackHorizon, self).setup()
self.add_copy_specs(["/etc/apache2/sites-available/"])
class UbuntuOpenStackHorizon(OpenStackHorizon, UbuntuPlugin):
"""OpenStack Horizon related information for Ubuntu based distributions
"""
packages = ('python-django-horizon',
'openstack-dashboard',
'openstack-dashboard-ubuntu-theme')
def setup(self):
super(UbuntuOpenStackHorizon, self).setup()
self.add_copy_specs(["/etc/apache2/conf.d/openstack-dashboard.conf"])
class RedHatOpenStackHorizon(OpenStackHorizon, RedHatPlugin):
"""OpenStack Horizon related information for Red Hat distributions
"""
packages = ('python-django-horizon',
'openstack-dashboard')
def setup(self):
super(RedHatOpenStackHorizon, self).setup()
self.add_copy_specs(["/etc/httpd/conf.d/openstack-dashboard.conf"])
if self.option_enabled("log"):
self.add_copy_specs(["/var/log/httpd/"])
sosreport/sos/plugins/named.py 0000644 0001750 0001750 00000005571 12271434006 015202 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
from os.path import exists, join, normpath
import pdb
class Named(Plugin):
"""named related information
"""
plugin_name = "named"
named_conf = "/etc/named.conf"
config_files = named_conf
def setup(self):
for cfg in self.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}
"""
directory_list = self.do_regex_find_all("directory\s+\"(.*)\"", config_file)
if directory_list:
return normpath(directory_list[0])
else:
return ""
def postproc(self):
match = r"(\s*arg \"password )[^\"]*"
subst = r"\1******"
self.do_file_sub(self.named_conf, match, subst)
class RedHatNamed(Named, RedHatPlugin):
"""named related information for RedHat based distribution
"""
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()
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
class DebianNamed(Named, DebianPlugin, UbuntuPlugin):
"""named related information for Debian based distribution
"""
files = ('/etc/bind/named.conf')
packages = ('bind9',)
named_conf = "/etc/bind/named.conf"
config_files = (named_conf,
"/etc/bind/named.conf.options",
"/etc/bind/named.conf.local")
def setup(self):
super(DebianNamed, self).setup()
self.add_copy_spec("/etc/bind/")
return
sosreport/sos/plugins/acpid.py 0000644 0001750 0001750 00000002324 12254061770 015174 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Acpid(Plugin):
plugin_name = "acpid"
class RedHatAcpid(Acpid, RedHatPlugin):
"""acpid related information
"""
def setup(self):
self.add_copy_specs([
"/var/log/acpid*",
"/etc/acpi/events/power.conf"])
class DebianAcpid(Acpid, DebianPlugin, UbuntuPlugin):
"""acpid related information for Debian and Ubuntu
"""
def setup(self):
self.add_copy_specs([
"/etc/acpi/events/powerbtn*"])
sosreport/sos/plugins/vsftpd.py 0000644 0001750 0001750 00000001764 12254061770 015431 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin
class Vsftpd(Plugin, RedHatPlugin):
"""FTP server related information
"""
plugin_name = 'vsftpd'
files = ('/etc/vsftpd',)
packages = ('vsftpd',)
def setup(self):
self.add_copy_spec("/etc/ftp*")
self.add_copy_spec("/etc/vsftpd")
sosreport/sos/plugins/postgresql.py 0000644 0001750 0001750 00000005625 12254061770 016326 0 ustar zef zef import os
import tempfile
from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin
from sos.utilities import find
class PostgreSQL(Plugin):
"""PostgreSQL related information"""
plugin_name = "postgresql"
packages = ('postgresql',)
tmp_dir = None
option_list = [
("pghome", 'PostgreSQL server home directory.', '', '/var/lib/pgsql'),
("username", 'username for pg_dump', '', 'postgres'),
("password", 'password for pg_dump', '', ''),
("dbname", 'database name to dump for pg_dump', '', ''),
]
def pg_dump(self):
dest_file = os.path.join(self.tmp_dir, "sos_pgdump.tar")
old_env_pgpassword = os.environ.get("PGPASSWORD")
os.environ["PGPASSWORD"] = self.get_option("password")
(status, output, rtime) = self.call_ext_prog("pg_dump %s -U %s -w -f %s -F t" %
(self.get_option("dbname"),
self.get_option("username"),
dest_file))
if old_env_pgpassword is not None:
os.environ["PGPASSWORD"] = old_env_pgpassword
if (status == 0):
self.add_copy_spec(dest_file)
else:
self.add_alert("ERROR: Unable to execute pg_dump. Error(%s)" % (output))
def setup(self):
if self.get_option("dbname"):
if self.get_option("password"):
self.tmp_dir = tempfile.mkdtemp()
self.pg_dump()
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)
# Copy PostgreSQL config files.
for file in find("*.conf", self.get_option("pghome")):
self.add_copy_spec(file)
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")
sosreport/sos/plugins/openstack_swift.py 0000644 0001750 0001750 00000003777 12254061770 017334 0 ustar zef zef ## Copyright (C) 2013 Red Hat, Inc., Flavio Percoco
## Copyright (C) 2012 Rackspace US, Inc., Justin Shepherd
## Copyright (C) 2009 Red Hat, Inc., Joey Boggs
### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos import plugins
class OpenStackSwift(plugins.Plugin):
"""OpenstackSwift related information."""
plugin_name = "openstack-swift"
option_list = [("log", "gathers openstack-swift logs", "slow", False)]
def setup(self):
# Swift
self.add_copy_spec("/etc/swift/")
class DebianOpenStackSwift(OpenStackSwift, plugins.DebianPlugin, plugins.UbuntuPlugin):
"""OpenStackSwift related information for Debian based distributions."""
packages = ('swift',
'swift-account',
'swift-container',
'swift-object',
'swift-proxy',
'swauth',
'python-swift',
'python-swauth')
class RedHatOpenStackSwift(OpenStackSwift, plugins.RedHatPlugin):
"""OpenStackSwift related information for Red Hat distributions."""
packages = ('openstack-swift',
'openstack-swift-account',
'openstack-swift-container',
'openstack-swift-object',
'openstack-swift-proxy',
'swift',
'python-swiftclient')
sosreport/sos/plugins/upstart.py 0000644 0001750 0001750 00000003042 12254061770 015614 0 ustar zef zef ## Copyright (C) 2012 Red Hat, Inc., Bryn M. Reeves
### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Upstart(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
""" Information on Upstart, the event-based init system.
"""
plugin_name = 'upstart'
packages = ('upstart',)
def setup(self):
self.add_cmd_output('initctl --system list')
self.add_cmd_output('initctl --system version')
self.add_cmd_output('init --version')
self.add_cmd_output("ls -l /etc/init/")
# Job Configuration Files
self.add_copy_spec('/etc/init.conf')
self.add_copy_spec('/etc/init/')
# State file
self.add_copy_spec('/var/log/upstart/upstart.state')
# Session Jobs (running Upstart as a Session Init)
self.add_copy_spec('/usr/share/upstart/')
sosreport/sos/plugins/ntp.py 0000644 0001750 0001750 00000003040 12254061770 014711 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Ntp(Plugin):
"""NTP related information
"""
plugin_name = "ntp"
packages = ('ntp',)
def setup(self):
self.add_copy_specs([
"/etc/ntp.conf",
"/etc/ntp/step-tickers",
"/etc/ntp/ntpservers"
])
self.add_cmd_output("ntptime")
class RedHatNtp(Ntp, RedHatPlugin):
"""NTP related information for RedHat based distributions
"""
def setup(self):
super(RedHatNtp, self).setup()
self.add_copy_spec("/etc/sysconfig/ntpd")
self.add_cmd_output("ntpstat")
class DebianNtp(Ntp, DebianPlugin, UbuntuPlugin):
"""NTP related information for Debian based distributions
"""
def setup(self):
super(DebianNtp, self).setup()
self.add_copy_spec('/etc/default/ntp')
sosreport/sos/plugins/powerpc.py 0000644 0001750 0001750 00000005650 12254061770 015600 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
## This plugin enables collection of logs for Power systems and more
## specific logs for Pseries, PowerNV platforms.
import os
from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin
class PowerPC(Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin):
"""IBM Power System related information
"""
plugin_name = 'powerpc'
def check_enabled(self):
return (self.policy().get_arch() == "ppc64")
def setup(self):
try:
with open('/proc/cpuinfo', 'r') as fp:
contents = fp.read()
ispSeries = "pSeries" in contents
isPowerNV = "PowerNV" in contents
except:
ispSeries = False
isPowerNV = False
if ispSeries or isPowerNV:
self.add_copy_spec("/proc/device-tree/")
self.add_copy_spec("/proc/loadavg")
self.add_copy_spec("/proc/locks")
self.add_copy_spec("/proc/misc")
self.add_copy_spec("/proc/swaps")
self.add_copy_spec("/proc/version")
self.add_copy_spec("/dev/nvram")
self.add_copy_spec("/var/log/platform")
self.add_cmd_output("ppc64_cpu --smt")
self.add_cmd_output("ppc64_cpu --cores-present")
self.add_cmd_output("ppc64_cpu --cores-on")
self.add_cmd_output("ppc64_cpu --run-mode")
self.add_cmd_output("ppc64_cpu --frequency")
self.add_cmd_output("ppc64_cpu --dscr")
if ispSeries:
self.add_copy_spec("/proc/ppc64/lparcfg")
self.add_copy_spec("/proc/ppc64/eeh")
self.add_copy_spec("/proc/ppc64/systemcfg")
self.add_cmd_output("lscfg -vp")
self.add_cmd_output("lsmcode -A")
self.add_cmd_output("lsvpd --debug")
self.add_cmd_output("lsvio -des")
self.add_cmd_output("servicelog --dump")
self.add_cmd_output("servicelog_notify --list")
self.add_cmd_output("usysattn")
self.add_cmd_output("usysident")
self.add_cmd_output("serv_config -l")
self.add_cmd_output("bootlist -m both -r")
self.add_cmd_output("lparstat -i")
if isPowerNV:
self.add_copy_spec("/proc/ppc64/")
sosreport/sos/plugins/rpm.py 0000644 0001750 0001750 00000004156 12254061770 014717 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin
class Rpm(Plugin, RedHatPlugin):
"""RPM information
"""
plugin_name = 'rpm'
option_list = [("rpmq", "queries for package information via rpm -q", "fast", True),
("rpmva", "runs a verify on all packages", "slow", False)]
verify_list = [
'kernel$', 'glibc', 'initscripts',
'pam_.*',
'java.*', 'perl.*',
'rpm', 'yum',
'spacewalk.*',
]
def setup(self):
self.add_copy_spec("/var/log/rpmpkgs")
if self.get_option("rpmq"):
self.add_cmd_output("rpm -qa --qf="
"\"%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}~~"
"%{INSTALLTIME:date}\t%{INSTALLTIME}\t%{VENDOR}\n\""
" --nosignature --nodigest | awk -F '~~' "
"'{printf \"%-59s %s\\n\",$1,$2}'|sort",
root_symlink = "installed-rpms")
if self.get_option("rpmva"):
self.add_cmd_output("rpm -Va", root_symlink = "rpm-Va", timeout = 3600)
else:
pkgs_by_regex = self.policy().package_manager.all_pkgs_by_name_regex
verify_list = map(pkgs_by_regex, self.verify_list)
for pkg_list in verify_list:
for pkg in pkg_list:
if 'debuginfo' in pkg \
or pkg.endswith('-debuginfo-common'):
continue
self.add_cmd_output("rpm -V %s" % pkg)
sosreport/sos/plugins/sendmail.py 0000644 0001750 0001750 00000003135 12254061770 015711 0 ustar zef zef ## Copyright (C) 2007 Red Hat, Inc., Eugene Teo
### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
from os.path import exists
class Sendmail(Plugin):
"""sendmail information
"""
plugin_name = "sendmail"
packages = ('sendmail',)
class RedHatSendmail(Sendmail, RedHatPlugin):
"""sendmail information for RedHat based distributions
"""
files = ('/etc/rc.d/init.d/sendmail',)
packages = ('sendmail',)
def setup(self):
super(RedHatSendmail, self).setup()
self.add_copy_specs(["/etc/mail/*", "/var/log/maillog"])
class DebianSendmail(Sendmail, DebianPlugin, UbuntuPlugin):
"""sendmail information for Debian based distributions
"""
files = ('/etc/init.d/sendmail',)
packages = ('sendmail',)
def setup(self):
super(DebianSendmail, self).setup()
self.add_copy_specs(["/etc/mail/*", "/var/log/mail.*"])
sosreport/sos/plugins/gdm.py 0000644 0001750 0001750 00000001675 12254061770 014673 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Gdm(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""gdm related information
"""
plugin_name = 'gdm'
def setup(self):
self.add_copy_spec("/etc/gdm/*")
sosreport/sos/plugins/smartcard.py 0000644 0001750 0001750 00000002442 12254061770 016075 0 ustar zef zef ## Copyright (C) 2007 Sadique Puthen
### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin
class Smartcard(Plugin, RedHatPlugin):
"""Smart Card related information
"""
plugin_name = 'smartcard'
files = ('/etc/pam_pkcs11/pam_pkcs11.conf',)
packages = ('pam_pkcs11',)
def setup(self):
self.add_copy_specs([
"/etc/reader.conf",
"/etc/reader.conf.d/",
"/etc/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/")
sosreport/sos/plugins/xinetd.py 0000644 0001750 0001750 00000002161 12254061770 015406 0 ustar zef zef ## Copyright (C) 2007 Red Hat, Inc., Eugene Teo
### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Xinetd(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""xinetd information
"""
plugin_name = 'xinetd'
files = ('/etc/xinetd.conf',)
packages = ('xinetd',)
def setup(self):
self.add_copy_spec("/etc/xinetd.conf")
self.add_copy_spec("/etc/xinetd.d")
sosreport/sos/plugins/x11.py 0000644 0001750 0001750 00000002234 12254061770 014525 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class X11(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""X related information
"""
plugin_name = 'x11'
files = ('/etc/X11',)
def setup(self):
self.add_copy_specs([
"/etc/X11",
"/var/log/Xorg.*.log",
"/var/log/XFree86.*.log",
])
self.add_forbidden_path("/etc/X11/X")
self.add_forbidden_path("/etc/X11/fontpath.d")
sosreport/sos/plugins/auditd.py 0000644 0001750 0001750 00000002335 12254061770 015370 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Auditd(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""Auditd related information
"""
option_list = [("logsize", "maximum size (MiB) of logs to collect",
"", 15)]
plugin_name = 'auditd'
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("logsize"))
sosreport/sos/plugins/kernel.py 0000644 0001750 0001750 00000004460 12254061770 015377 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
import os
class Kernel(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""kernel related information
"""
plugin_name = 'kernel'
sys_module = '/sys/module'
def setup(self):
# compat
self.add_cmd_output("uname -a", root_symlink = "uname")
self.add_cmd_output("lsmod", root_symlink = "lsmod")
try:
modules = os.listdir(self.sys_module)
self.add_cmd_output("modinfo " + " ".join(modules))
except OSError:
self.soslog.warning("could not list %s" % self.sys_module)
self.add_cmd_output("dmesg")
self.add_cmd_output("sysctl -a")
self.add_copy_specs([
"/proc/modules",
"/proc/sys/kernel/random/boot_id",
"/sys/module/*/parameters",
"/sys/module/*/initstate",
"/sys/module/*/refcnt",
"/sys/module/*/taint",
"/proc/kallsyms",
"/proc/buddyinfo",
"/proc/slabinfo",
"/proc/zoneinfo",
"/lib/modules/%s/modules.dep" % self.policy().kernel_version(),
"/etc/conf.modules",
"/etc/modules.conf",
"/etc/modprobe.conf",
"/etc/modprobe.d",
"/etc/sysctl.conf",
"/etc/sysctl.d",
"/lib/sysctl.d",
"/proc/cmdline",
"/proc/driver",
"/proc/sys/kernel/tainted",
"/proc/softirqs",
"/proc/timer*",
"/proc/lock*",
"/var/log/dmesg"
])
self.add_cmd_output("dkms status")
sosreport/sos/plugins/iscsitarget.py 0000644 0001750 0001750 00000003364 12254061770 016442 0 ustar zef zef ## Copyright (C) 2007-2012 Red Hat, Inc., Ben Turner
## Copyright (C) 2012 Adam Stokes
### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class IscsiTarget(Plugin):
"""iscsi-target related information
"""
plugin_name = "iscsitarget"
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):
"""iscsi-target related information for Debian based distributions
"""
packages = ('iscsitarget',)
def setup(self):
super(DebianIscsiTarget, self).setup()
self.add_copy_specs([
"/etc/iet",
"/etc/sysctl.d/30-iscsitarget.conf",
"/etc/default/iscsitarget"
])
sosreport/sos/plugins/systemd.py 0000644 0001750 0001750 00000004020 12254061770 015577 0 ustar zef zef ## Copyright (C) 2012 Red Hat, Inc., Bryn M. Reeves
### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin
class Systemd(Plugin, RedHatPlugin):
""" Information on systemd and related subsystems
"""
plugin_name = "systemd"
packages = ('systemd',)
files = ('/usr/lib/systemd/systemd',)
def setup(self):
self.add_cmd_output("systemctl show --all")
self.add_cmd_output("systemctl list-units --failed")
self.add_cmd_output("systemctl list-unit-files")
self.add_cmd_output("systemctl list-units --all")
self.add_cmd_output("systemctl dump")
self.add_cmd_output("systemd-delta")
self.add_cmd_output("journalctl --verify")
self.add_cmd_output("journalctl --all --this-boot --no-pager")
self.add_cmd_output("journalctl --all --this-boot --no-pager -o verbose")
self.add_cmd_output("ls -l /lib/systemd")
self.add_cmd_output("ls -l /lib/systemd/system-shutdown")
self.add_cmd_output("ls -l /lib/systemd/system-generators")
self.add_cmd_output("ls -l /lib/systemd/user-generators")
self.add_copy_specs(["/etc/systemd",
"/lib/systemd/system",
"/lib/systemd/user",
"/etc/vconsole.conf",
"/etc/yum/protected.d/systemd.conf"])
sosreport/sos/plugins/i18n.py 0000644 0001750 0001750 00000002034 12254061770 014671 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class I18n(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""Internationalization related information
"""
plugin_name = 'i18n'
def setup(self):
self.add_copy_specs(["/etc/X11/xinit/xinput.d/*", "/etc/locale.conf"])
self.add_cmd_output("locale")
sosreport/sos/plugins/sar.py 0000644 0001750 0001750 00000005417 12254061770 014707 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
import os
class Sar(Plugin,):
""" Collect system activity reporter data
"""
plugin_name = 'sar'
packages = ('sysstat',)
sa_path = '/var/log/sa'
option_list = [("all_sar", "gather all system activity records", "", False)]
# size-limit SAR data collected by default (MB)
sa_size = 20
def check_enabled(self):
# check to see if we are force-enabled with no sar installation
if not os.path.exists(self.sa_path) or not os.path.isdir(self.sa_path):
self.soslog.info("sar directory %s does not exist" % self.sa_path
+ " or is not a directory")
return False
return True
def setup(self):
if self.get_option("all_sar"):
self.sa_size = 0
self.add_copy_spec_limit("/var/log/sa/sar[0-9]*",
sizelimit = self.sa_size)
self.add_copy_spec_limit("/var/log/sa/sa[0-9]*",
sizelimit = self.sa_size)
try:
dirList = os.listdir(self.sa_path)
except:
self.soslog.warning("sar: could not list /var/log/sa")
return
# find all the sa file that don't have an existing sar file
for fname in dirList:
if fname[0:2] == 'sa' and fname[2] != 'r':
sar_filename = 'sar' + fname[2:4]
sa_data_path = os.path.join(self.sa_path, fname)
if sar_filename not in dirList:
sar_cmd = 'sh -c "LANG=C sar -A -f %s"' % sa_data_path
self.add_cmd_output(sar_cmd, sar_filename)
sadf_cmd = "sadf -x %s" % sa_data_path
self.add_cmd_output(sadf_cmd, "%s.xml" % fname)
self.add_copy_spec(os.path.join(self.sa_path, "sar*"))
class RedHatSar(Sar, RedHatPlugin):
""" Collect system activity reporter data
"""
sa_path = '/var/log/sa'
class DebianSar(Sar, DebianPlugin, UbuntuPlugin):
""" Collect system activity reporter data
"""
sa_path = '/var/log/sysstat'
sosreport/sos/plugins/anaconda.py 0000644 0001750 0001750 00000002734 12254061770 015665 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin
import os
class Anaconda(Plugin, RedHatPlugin):
"""Anaconda / Installation information
"""
plugin_name = 'anaconda'
files = ('/var/log/anaconda.log',
'/var/log/anaconda')
def setup(self):
paths = [
"/root/anaconda-ks.cfg"]
if os.path.isdir('/var/log/anaconda'):
# new anaconda
paths.append('/var/log/anaconda')
else:
paths = paths + \
[ "/var/log/anaconda.*"
"/root/install.log",
"/root/install.log.syslog"]
self.add_copy_specs(paths)
def postproc(self):
self.do_file_sub("/root/anaconda-ks.cfg",
r"(\s*rootpw\s*).*",
r"\1******")
sosreport/sos/plugins/cups.py 0000644 0001750 0001750 00000002627 12254061770 015074 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Printing(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""printing related information (cups)
"""
plugin_name = 'printing'
packages = ('cups',)
option_list = [("cups", "max size (MiB) to collect per cups log file",
"", 15)]
def setup(self):
self.add_copy_specs([
"/etc/cups/*.conf",
"/etc/cups/lpoptions",
"/etc/cups/ppd/*.ppd"])
self.add_copy_spec_limit("/var/log/cups",
sizelimit=self.option_enabled("cupslogsize"))
self.add_cmd_output("lpstat -t")
self.add_cmd_output("lpstat -s")
self.add_cmd_output("lpstat -d")
sosreport/sos/plugins/ipsec.py 0000644 0001750 0001750 00000002735 12254061770 015225 0 ustar zef zef ## Copyright (C) 2007 Sadique Puthen
### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class IPSec(Plugin):
"""ipsec related information
"""
plugin_name = "ipsec"
packages = ('ipsec-tools',)
class RedHatIpsec(IPSec, RedHatPlugin):
"""ipsec related information for Red Hat distributions
"""
files = ('/etc/racoon/racoon.conf',)
def setup(self):
self.add_copy_spec("/etc/racoon")
class DebianIPSec(IPSec, DebianPlugin, UbuntuPlugin):
"""ipsec related information for Debian distributions
"""
files = ('/etc/ipsec-tools.conf',)
def setup(self):
self.add_copy_specs(["/etc/ipsec-tools.conf",
"/etc/ipsec-tools.d",
"/etc/default/setkey"])
sosreport/sos/plugins/tomcat.py 0000644 0001750 0001750 00000001704 12254061770 015404 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin
class Tomcat(Plugin, RedHatPlugin):
"""Tomcat related information
"""
plugin_name = 'tomcat'
packages = ('tomcat5',)
def setup(self):
self.add_copy_specs(["/etc/tomcat5", "/var/log/tomcat5"])
sosreport/sos/plugins/iscsi.py 0000644 0001750 0001750 00000002742 12254061770 015232 0 ustar zef zef ## Copyright (C) 2007-2012 Red Hat, Inc., Ben Turner
### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin
class Iscsi(Plugin):
"""iscsi-initiator related information
"""
plugin_name = "iscsi"
class RedHatIscsi(Iscsi, RedHatPlugin):
"""iscsi-initiator related information Red Hat based distributions
"""
packages = ('iscsi-initiator-utils',)
def setup(self):
super(RedHatIscsi, self).setup()
self.add_copy_specs([
"/etc/iscsi/iscsid.conf",
"/etc/iscsi/initiatorname.iscsi",
"/var/lib/iscsi"])
self.add_cmd_output("iscsiadm -m session -P 3")
self.add_cmd_output("iscsiadm -m node -P 3")
self.add_cmd_output("iscsiadm -m iface -P 1")
self.add_cmd_output("iscsiadm -m node --op=show")
sosreport/sos/plugins/pxe.py 0000644 0001750 0001750 00000003450 12254061770 014711 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
from os.path import exists
class Pxe(Plugin):
"""PXE related information
"""
option_list = [("tftpboot", 'gathers content from the tftpboot path',
'slow', False)]
plugin_name = "pxe"
class RedHatPxe(Pxe, RedHatPlugin):
"""PXE related information for RedHat based distributions
"""
files = ('/usr/sbin/pxeos',)
packages = ('system-config-netboot-cmd',)
def setup(self):
super(RedHatPxe, self).setup()
self.add_cmd_output("/usr/sbin/pxeos -l")
self.add_copy_spec("/etc/dhcpd.conf")
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',)
def setup(self):
super(DebianPxe, self).setup()
self.add_copy_spec("/etc/dhcp/dhcpd.conf")
self.add_copy_spec("/etc/default/tftpd-hpa")
if self.get_option("tftpboot"):
self.add_copy_spec("/var/lib/tftpboot")
sosreport/sos/plugins/qpid.py 0000644 0001750 0001750 00000003663 12254061770 015060 0 ustar zef zef ## 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin
class Qpid(Plugin, RedHatPlugin):
"""Messaging related information
"""
plugin_name = 'qpid'
packages = ('qpidd', 'qpid-cpp-server', 'qpid-tools')
def setup(self):
""" performs data collection for mrg """
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",
"/var/lib/qpid/syslog",
"/etc/ais/openais.conf",
"/var/log/cumin.log",
"/var/log/mint.log"
"/etc/sasl2/qpidd.conf",
"/etc/qpid/qpidc.conf",
"/etc/sesame/sesame.conf",
"/etc/cumin/cumin.conf",
"/etc/corosync/corosync.conf",
"/var/lib/sesame",
"/var/log/qpidd.log",
"/var/log/sesame",
"/var/log/cumin",
"/var/log/cluster"])
sosreport/sos/plugins/ppp.py 0000644 0001750 0001750 00000002234 12254061770 014713 0 ustar zef zef ## Copyright (C) 2007 Sadique Puthen
### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Ppp(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""ppp, wvdial and rp-pppoe related information
"""
plugin_name = 'ppp'
packages = ('ppp',)
def setup(self):
self.add_copy_specs([
"/etc/wvdial.conf",
"/etc/ppp",
"/var/log/ppp"])
self.add_cmd_output("adsl-status")
sosreport/sos/plugins/cgroups.py 0000644 0001750 0001750 00000002715 12254061770 015602 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Cgroups(Plugin):
"""cgroup subsystem information
"""
plugin_name = "cgroups"
class DebianCgroups(Cgroups, DebianPlugin, UbuntuPlugin):
files = ('/proc/cgroups',)
def setup(self):
self.add_copy_specs(["/proc/cgroups",
"/sys/fs/cgroup"])
return
class RedHatCgroups(Cgroups, RedHatPlugin):
"""Red Hat specific cgroup subsystem information
"""
def setup(self):
self.add_copy_specs(["/etc/sysconfig/cgconfig",
"/etc/sysconfig/cgred.conf",
"/etc/cgsnapshot_blacklist.conf",
"/etc/cgconfig.conf",
"/etc/cgrules.conf"])
sosreport/sos/plugins/libraries.py 0000644 0001750 0001750 00000002367 12254061770 016077 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin
class Libraries(Plugin, RedHatPlugin, UbuntuPlugin):
"""information on shared libraries
"""
plugin_name = 'libraries'
option_list = [('ldconfigv', 'the name of each directory as it is scanned, and any links that are created.',
"slow", False)]
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("ldconfig -v -N -X")
self.add_cmd_output("ldconfig -p -N -X")
sosreport/sos/plugins/mrgmessg.py 0000644 0001750 0001750 00000001753 12254061770 015745 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin
class MrgMessg(Plugin, RedHatPlugin):
"""MRG Messaging related information
"""
plugin_name = 'mrgmessg'
def setup(self):
self.add_copy_specs([
"/etc/qpidd.conf",
"/etc/sasl2/qpidd.conf",
"/var/rhm"])
sosreport/sos/plugins/krb5.py 0000644 0001750 0001750 00000002163 12254061770 014760 0 ustar zef zef ## Copyright (C) 2013 Red Hat, Inc., Bryn M. Reeves
### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Krb5(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""Kerberos related information
"""
packages = ('krb5-libs', 'krb5-user')
plugin_name = 'krb5'
def setup(self):
self.add_copy_spec("/etc/krb5.conf")
self.add_cmd_output("klist -ket /etc/krb5.keytab")
sosreport/sos/plugins/yum.py 0000644 0001750 0001750 00000004736 12271430455 014736 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin
class Yum(Plugin, RedHatPlugin):
"""yum information
"""
plugin_name = 'yum'
files = ('/etc/yum.conf',)
packages = ('yum',)
option_list = [("yumlist", "list repositories and packages", "slow", False),
("yumdebug", "gather yum debugging data", "slow", False)]
def setup(self):
# Pull all yum related information
self.add_copy_specs([
"/etc/yum",
"/etc/yum.repos.d",
"/etc/yum.conf",
"/var/log/yum.log"])
# Get a list of channels the machine is subscribed to.
self.add_cmd_output("yum -C repolist")
# candlepin info
self.add_forbidden_path("/etc/pki/entitlement/key.pem")
self.add_forbidden_path("/etc/pki/entitlement/*-key.pem")
self.add_copy_specs([
"/etc/pki/product/*.pem",
"/etc/pki/consumer/cert.pem",
"/etc/pki/entitlement/*.pem",
"/etc/rhsm/",
"/var/log/rhsm/rhsm.log",
"/var/log/rhsm/rhsmcertd.log"])
self.add_cmd_output("subscription-manager list --installed")
self.add_cmd_output("subscription-manager list --consumed")
if self.get_option("yumlist"):
# List various information about available packages
self.add_cmd_output("yum list")
if self.get_option("yumdebug") and self.is_installed('yum-utils'):
# RHEL6+ alternative for this whole function:
# self.add_cmd_output("yum-debug-dump '%s'" % os.path.join(self.commons['dstroot'],"yum-debug-dump"))
ret, output, rtime = self.call_ext_prog("yum-debug-dump")
try:
self.add_cmd_output("zcat %s" % (output.split()[-1],))
except IndexError:
pass
sosreport/sos/plugins/openswan.py 0000644 0001750 0001750 00000002601 12254061770 015744 0 ustar zef zef ## Copyright (C) 2007 Sadique Puthen
### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Openswan(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""ipsec related information
"""
plugin_name = 'openswan'
option_list = [("ipsec-barf",
"collect the output of the ipsec barf command",
"slow", False)]
files = ('/etc/ipsec.conf',)
packages = ('openswan',)
def setup(self):
self.add_copy_specs([
"/etc/ipsec.conf",
"/etc/ipsec.d"])
self.add_cmd_output("ipsec verify")
if self.get_option("ipsec-barf"):
self.add_cmd_output("ipsec barf")
sosreport/sos/plugins/abrt.py 0000644 0001750 0001750 00000003247 12254061770 015051 0 ustar zef zef ## Copyright (C) 2010 Red Hat, Inc., Tomas Smetana
### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin
from os.path import exists
class Abrt(Plugin, RedHatPlugin):
"""ABRT log dump
"""
plugin_name = "abrt"
packages = ('abrt-cli',)
files = ('/var/spool/abrt',)
option_list = [("backtraces", 'collect backtraces for every report',
'slow', False)]
def do_backtraces(self):
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("abrt-cli -ib %s" % uuid,
suggest_filename=("backtrace_%s" % uuid))
except IndexError:
pass
def setup(self):
self.add_cmd_output("abrt-cli -lf", suggest_filename="abrt-log")
if self.get_option('backtraces'):
self.do_backtraces()
sosreport/sos/plugins/process.py 0000644 0001750 0001750 00000002271 12254061770 015573 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
import os
class Process(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""process information
"""
plugin_name = 'process'
def setup(self):
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")
sosreport/sos/plugins/openstack_keystone.py 0000644 0001750 0001750 00000005415 12254061770 020030 0 ustar zef zef ## Copyright (C) 2013 Red Hat, Inc., Jeremy Agee
### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
import os
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class OpenStackKeystone(Plugin):
"""openstack keystone related information
"""
plugin_name = "openstack-keystone"
option_list = [("log", "gathers openstack keystone logs", "slow", True),
("nopw", "dont gathers keystone passwords", "slow", True)]
def setup(self):
self.add_copy_specs(["/etc/keystone/default_catalog.templates",
"/etc/keystone/keystone.conf",
"/etc/keystone/logging.conf",
"/etc/keystone/policy.json"])
if self.option_enabled("log"):
self.add_copy_specs(["/var/log/keystone/"])
def postproc(self):
self.do_file_sub('/etc/keystone/keystone.conf',
r"(?m)^(admin_password.*=)(.*)",
r"\1 ******")
self.do_file_sub('/etc/keystone/keystone.conf',
r"(?m)^(admin_token.*=)(.*)",
r"\1 ******")
self.do_file_sub('/etc/keystone/keystone.conf',
r"(?m)^(connection.*=.*mysql://)(.*)(:)(.*)(@)(.*)",
r"\1\2:******@\6")
self.do_file_sub('/etc/keystone/keystone.conf',
r"(?m)^(password.*=)(.*)",
r"\1 ******")
self.do_file_sub('/etc/keystone/keystone.conf',
r"(?m)^(ca_password.*=)(.*)",
r"\1 ******")
class DebianOpenStackKeystone(OpenStackKeystone, DebianPlugin, UbuntuPlugin):
"""OpenStack Keystone related information for Debian based distributions
"""
packages = ('keystone',
'python-keystone',
'python-keystoneclient')
class RedHatOpenStackKeystone(OpenStackKeystone, RedHatPlugin):
"""OpenStack Keystone related information for Red Hat distributions
"""
packages = ('openstack-keystone',
'python-keystone',
'python-django-openstack-auth',
'python-keystoneclient')
sosreport/sos/plugins/ds.py 0000644 0001750 0001750 00000003352 12254061770 014524 0 ustar zef zef ## Copyright (C) 2007 Red Hat, Inc., Kent Lamb
## 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin
import os
class DirectoryServer(Plugin, RedHatPlugin):
"""Directory Server information
"""
plugin_name = 'directoryserver'
files = ('/etc/dirsrv', '/opt/redhat-ds')
packages = ('redhat-ds-base', 'redhat-ds-7')
def check_version(self):
if self.is_installed("redhat-ds-base") or \
os.path.exists("/etc/dirsrv"):
return "ds8"
elif self.is_installed("redhat-ds-7") or \
os.path.exists("/opt/redhat-ds"):
return "ds7"
return False
def setup(self):
if not self.check_version():
self.add_alert("Directory Server not found.")
elif "ds8" in self.check_version():
self.add_copy_specs([
"/etc/dirsrv/slapd*",
"/var/log/dirsrv/*"])
elif "ds7" in self.check_version():
self.add_copy_specs([
"/opt/redhat-ds/slapd-*/config",
"/opt/redhat-ds/slapd-*/logs"])
sosreport/sos/plugins/sysvipc.py 0000644 0001750 0001750 00000002235 12254061770 015615 0 ustar zef zef ## Copyright (C) 2007-2012 Red Hat, Inc., Bryn M. Reeves
### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class SysVIPC(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""SysV IPC related information
"""
plugin_name = "sysvipc"
def setup(self):
self.add_copy_specs([
"/proc/sysvipc/msg",
"/proc/sysvipc/sem",
"/proc/sysvipc/shm"])
self.add_cmd_output("ipcs")
sosreport/sos/plugins/procenv.py 0000644 0001750 0001750 00000001775 12254061770 015601 0 ustar zef zef ## Copyright (c) 2012 Adam Stokes
## 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Procenv(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""Process environment.
"""
plugin_name = 'procenv'
def setup(self):
self.add_cmd_output('procenv')
sosreport/sos/plugins/startup.py 0000644 0001750 0001750 00000003415 12254061770 015620 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Startup(Plugin):
"""startup information
"""
plugin_name = "startup"
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")
class RedHatStartup(Startup, RedHatPlugin):
"""startup information for RedHat based distributions
"""
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):
"""startup information
"""
def setup(self):
super(DebianStartup, self).setup()
self.add_copy_spec("/etc/rc*.d")
self.add_cmd_output("/sbin/initctl show-config", root_symlink = "initctl")
if self.get_option('servicestatus'):
self.add_cmd_output("/sbin/initctl list")
sosreport/sos/plugins/neutron.py 0000644 0001750 0001750 00000017035 12254061770 015613 0 ustar zef zef ## Copyright (C) 2013 Red Hat, Inc., Brent Eagles
### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
import os
import re
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
# The Networking plugin includes most of what is needed from a snapshot
# of the networking, so we only need to focus on the parts that are specific
# to OpenStack Networking. The Process plugin should capture the dnsmasq
# command line. The libvirt plugin grabs the instance's XML definition which
# has the interface names for an instance. So what remains is relevant database
# info...
class Neutron(Plugin):
"""OpenStack Networking (quantum/neutron) related information
"""
plugin_name = "neutron"
option_list = [("log", "Gathers all Neutron logs", "slow", False),
("quantum", "Overrides checks for newer Neutron components",
"fast", False)]
component_name = "neutron"
def setup(self):
if os.path.exists("/etc/neutron/") and self.get_option("quantum", False):
self.component_name = self.plugin_name
else:
self.component_name = "quantum"
self.add_copy_specs(["/etc/%s/" % self.component_name,
"/var/log/%s/" % self.component_name])
self.netns_dumps()
self.get_ovs_dumps()
def get_ovs_dumps(self):
# Check to see if we are using the Open vSwitch plugin. If not we
# should be able to skip the rest of the dump.
ovs_conf_check_out = self.call_ext_prog('grep "^core_plugin.*openvswitch" ' +
("/etc/%s/*.conf" + self.component_name))
if not ovs_conf_check_out or len(ovs_conf_check_out[1].splitlines()) == 0:
return
# The '-s' option enables dumping of packet counters on the
# ports.
self.add_cmd_output("ovs-dpctl -s show")
# The '-t 5' adds an upper bound on how long to wait to connect
# to the Open vSwitch server, avoiding hangs when running sosreport.
self.add_cmd_output("ovs-vsctl -t 5 show")
def netns_dumps(self):
# It would've been beautiful if we could get parts of the networking
# plugin to run in different namespaces. There are a couple of options
# in the short term: create a local instance and "borrow" some of the
# functionality, or simply copy some of the functionality.
prefixes = ["qdhcp", "qrouter"]
nslist = self.call_ext_prog("ip netns")
lease_directories = []
if nslist:
for nsname in nslist[1].splitlines():
prefix, netid = nsname.split('-', 1)
if len(netid) > 0 and prefix in prefixes:
self.ns_gather_data(nsname)
lease_directories.append("/var/lib/%s/dhcp/%s/" %
(self.component_name, netid))
self.add_copy_specs(lease_directories)
# TODO: Refactor! Copied from Networking plugin.
def get_interface_name(self,ip_addr_out):
"""Return a dictionary for which key are interface name according to the
output of ifconifg-a stored in ifconfig_file.
"""
out={}
for line in ip_addr_out[1].splitlines():
match=re.match('.*link/ether', line)
if match:
int=match.string.split(':')[1].lstrip()
out[int]=True
return out
def ns_gather_data(self, nsname):
cmd_prefix = "ip netns exec %s " % nsname
self.add_cmd_output(cmd_prefix + "iptables-save")
self.add_cmd_output(cmd_prefix + "ifconfig -a")
self.add_cmd_output(cmd_prefix + "route -n")
# borrowed from networking plugin
ip_addr_out=self.call_ext_prog(cmd_prefix + "ip -o addr")
if ip_addr_out:
for eth in self.get_interface_name(ip_addr_out):
self.add_cmd_output(cmd_prefix + "ethtool "+eth)
self.add_cmd_output(cmd_prefix + "ethtool -i "+eth)
self.add_cmd_output(cmd_prefix + "ethtool -k "+eth)
self.add_cmd_output(cmd_prefix + "ethtool -S "+eth)
# Most, if not all, IFs in the namespaces are going to be
# virtual. The '-a', '-c' and '-g' options are not likely to be
# supported so these ops are not copied from the network
# plugin.
# As all of the bridges are in the "global namespace", we do not need
# to gather info on them.
def gen_pkg_tuple(self, packages):
names = []
for p in packages:
names.append(p % { "comp" : self.component_name })
return tuple(names)
class DebianNeutron(Neutron, DebianPlugin, UbuntuPlugin):
"""OpenStack Neutron related information for Debian based distributions
"""
package_list_template = ['%(comp)s-common',
'%(comp)s-plugin-cisco',
'%(comp)s-plugin-linuxbridge-agent',
'%(comp)s-plugin-nicira',
'%(comp)s-plugin-openvswitch',
'%(comp)s-plugin-openvswitch-agent',
'%(comp)s-plugin-ryu',
'%(comp)s-plugin-ryu-agent',
'%(comp)s-server',
'python-%(comp)s',
'python-%(comp)sclient']
def check_enabled(self):
return self.is_installed("%s-common" % self.component_name)
def setup(self):
super(DebianNeutron, self).setup()
self.packages = self.gen_pkg_tuple(self.package_list_template)
self.add_copy_spec("/etc/sudoers.d/%s_sudoers" % self.component_name)
class RedHatNeutron(Neutron, RedHatPlugin):
"""OpenStack Neutron related information for Red Hat distributions
"""
package_list_template = ['openstack-%(comp)s',
'openstack-%(comp)s-linuxbridge'
'openstack-%(comp)s-metaplugin',
'openstack-%(comp)s-openvswitch',
'openstack-%(comp)s-bigswitch',
'openstack-%(comp)s-brocade',
'openstack-%(comp)s-cisco',
'openstack-%(comp)s-hyperv',
'openstack-%(comp)s-midonet',
'openstack-%(comp)s-nec'
'openstack-%(comp)s-nicira',
'openstack-%(comp)s-plumgrid',
'openstack-%(comp)s-ryu',
'python-%(comp)s',
'python-%(comp)sclient']
def check_enabled(self):
return self.is_installed("openstack-%s" % self.component_name)
def setup(self):
super(RedHatNeutron, self).setup()
self.packages = self.gen_pkg_tuple(self.package_list_template)
self.add_copy_specs(["/etc/sudoers.d/%s-rootwrap" % self.component_name])
sosreport/sos/plugins/ipa.py 0000644 0001750 0001750 00000006145 12254061770 014672 0 ustar zef zef ## Copyright (C) 2007 Red Hat, Inc., Kent Lamb
## 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin
class Ipa(Plugin, RedHatPlugin):
"""IPA diagnostic information
"""
plugin_name = 'ipa'
ipa_server = False
ipa_client = False
files = ('/etc/ipa',)
packages = ('ipa-server', 'ipa-client')
def check_enabled(self):
self.ipa_server = self.is_installed("ipa-server")
self.ipa_client = self.is_installed("ipa-client")
return Plugin.check_enabled(self)
def setup(self):
if self.ipa_server:
self.add_copy_spec("/var/log/ipaserver-install.log")
self.add_copy_spec("/var/log/ipareplica-install.log")
if self.ipa_client:
self.add_copy_spec("/var/log/ipaclient-install.log")
self.add_copy_specs(["/var/log/ipaupgrade.log",
"/var/log/krb5kdc.log",
"/var/log/pki-ca/debug",
"/var/log/pki-ca/catalina.out",
"/var/log/pki-ca/system",
"/var/log/pki-ca/transactions",
"/var/log/dirsrv/slapd-*/logs/access",
"/var/log/dirsrv/slapd-*/logs/errors",
"/etc/dirsrv/slapd-*/dse.ldif",
"/etc/dirsrv/slapd-*/schema/99user.ldif",
"/etc/hosts",
"/etc/named.*"])
self.add_forbidden_path("/etc/pki/nssdb/key*")
self.add_forbidden_path("/etc/pki-ca/flatfile.txt")
self.add_forbidden_path("/etc/pki-ca/password.conf")
self.add_forbidden_path("/var/lib/pki-ca/alias/key*")
self.add_forbidden_path("/etc/dirsrv/slapd-*/key*")
self.add_forbidden_path("/etc/dirsrv/slapd-*/pin.txt")
self.add_forbidden_path("/etc/dirsrv/slapd-*/pwdfile.txt")
self.add_forbidden_path("/etc/named.keytab")
self.add_cmd_output("ls -la /etc/dirsrv/slapd-*/schema/")
self.add_cmd_output("ipa-getcert list")
self.add_cmd_output("certutil -L -d /etc/httpd/alias/")
self.add_cmd_output("certutil -L -d /etc/dirsrv/slapd-*/")
self.add_cmd_output("klist -ket /etc/dirsrv/ds.keytab")
self.add_cmd_output("klist -ket /etc/httpd/conf/ipa.keytab")
return
def postproc(self):
match = r"(\s*arg \"password )[^\"]*"
subst = r"\1********"
self.do_file_sub("/etc/named.conf", match, subst)
sosreport/sos/plugins/selinux.py 0000644 0001750 0001750 00000003546 12254061770 015612 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin
from os.path import join
class SELinux(Plugin, RedHatPlugin):
"""selinux related information
"""
plugin_name = 'selinux'
option_list = [("fixfiles", 'Print incorrect file context labels', 'slow', False),
("list", 'List objects and their context', 'slow', False)]
packages = ('libselinux',)
def setup(self):
# sestatus is always collected in check_enabled()
self.add_copy_spec("/etc/selinux")
self.add_cmd_output("sestatus -b")
self.add_cmd_output("semodule -l")
self.add_cmd_output("selinuxdefcon root")
self.add_cmd_output("selinuxconlist root")
self.add_cmd_output("selinuxexeccon /bin/passwd")
self.add_cmd_output("ausearch -m avc,user_avc -ts today")
self.add_cmd_output("semanage -o -")
if self.get_option('fixfiles'):
self.add_cmd_output("fixfiles -v check")
if self.get_option('list'):
self.add_cmd_output("semanage fcontext -l")
self.add_cmd_output("semanage user -l")
self.add_cmd_output("semanage login -l")
self.add_cmd_output("semanage port -l")
sosreport/sos/plugins/java.py 0000644 0001750 0001750 00000002252 12254061770 015035 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
import os
from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin
class Java(Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin):
"""basic java information"""
plugin_name = "java"
def setup(self):
self.add_copy_spec("/etc/java")
self.add_forbidden_path("/etc/java/security")
self.add_cmd_output("alternatives --display java",
root_symlink="java")
self.add_cmd_output("readlink -f /usr/bin/java")
sosreport/sos/plugins/nfs.py 0000644 0001750 0001750 00000002206 12254061770 014701 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Nfs(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""NFS related information
"""
plugin_name = 'nfs'
packages = ['nfs-utils']
def setup(self):
self.add_copy_specs([
"/etc/nfsmount.conf",
"/etc/idmapd.conf",
"/proc/fs/nfsfs/servers",
"/proc/fs/nfsfs/volumes"
])
return
sosreport/sos/plugins/devicemapper.py 0000644 0001750 0001750 00000002166 12254061770 016564 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
import os
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class DeviceMapper(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""device-mapper related information
"""
plugin_name = 'devicemapper'
def setup(self):
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")
sosreport/sos/plugins/memory.py 0000644 0001750 0001750 00000002465 12254061770 015432 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Memory(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""memory usage information
"""
plugin_name = 'memory'
def setup(self):
self.add_copy_specs([
"/proc/pci",
"/proc/meminfo",
"/proc/vmstat",
"/proc/slabinfo",
"/proc/pagetypeinfo"])
self.add_cmd_output("dmesg | grep -e 'e820.' -e 'aperature.'",
suggest_filename="dmesg.e820-map")
self.add_cmd_output("free", root_symlink = "free")
self.add_cmd_output("free -m")
sosreport/sos/plugins/scsi.py 0000644 0001750 0001750 00000002443 12254061770 015057 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin
from glob import glob
import os
class Scsi(Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin):
"""hardware related information
"""
plugin_name = 'scsi'
def setup(self):
self.add_copy_specs([
"/proc/scsi",
"/etc/stinit.def",
"/sys/bus/scsi",
"/sys/class/scsi_host",
"/sys/class/scsi_disk",
"/sys/class/scsi_device",
"/sys/class/scsi_generic"
])
self.add_cmd_output("lsscsi")
self.add_cmd_output("sg_map")
sosreport/sos/plugins/nfsserver.py 0000644 0001750 0001750 00000003251 12254061770 016131 0 ustar zef zef ## Copyright (C) 2007 Red Hat, Inc., Eugene Teo
### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin
import os
from stat import ST_SIZE
class NfsServer(Plugin, RedHatPlugin):
"""NFS server-related information
"""
plugin_name = 'nfsserver'
def check_enabled(self):
default_runlevel = self.policy().default_runlevel()
nfs_runlevels = self.policy().runlevel_by_service("nfs")
if default_runlevel in nfs_runlevels:
return True
try:
exports = os.stat("/etc/exports")[ST_SIZE]
xtab = os.stat("/var/lib/nfs/xtab")[ST_SIZE]
if exports or xtab:
return True
except:
pass
return False
def setup(self):
self.add_copy_specs([
"/etc/exports",
"/var/lib/nfs/etab",
"/var/lib/nfs/xtab",
"/var/lib/nfs/rmtab"])
self.add_cmd_output("rpcinfo -p localhost")
self.add_cmd_output("nfsstat -o all")
sosreport/sos/plugins/openshift.py 0000644 0001750 0001750 00000005053 12254061770 016115 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin
class Openshift(Plugin, RedHatPlugin):
'''Openshift related information'''
plugin_name = "Openshift"
option_list = [("broker", "Gathers broker specific files", "slow", False),
("node", "Gathers node specific files", "slow", False)]
def setup(self):
self.add_copy_specs(["/etc/openshift-enterprise-version",
"/etc/openshift/",
"/etc/dhcp/dhclient-*"])
if self.option_enabled("broker"):
self.add_copy_specs(["/var/log/activemq",
"/var/log/mongodb",
"/var/log/openshift",
"/var/www/openshift/broker/log",
"/var/www/openshift/broker/httpd/logs/",
"/var/www/openshift/console/log",
"/var/www/openshift/console/httpd/logs",
"/var/log/openshift/user_action.log"])
self.add_cmd_output("oo-accpet-broker -v")
self.add_cmd_output("oo-admin-chk -v")
self.add_cmd_output("mco ping")
self.add_cmd_output("gem list --local")
self.add_cmd_output("cd /var/www/openshift/broker/ && bundle --local")
if self.option_enabled("node"):
self.add_copy_specs(["/var/log/openshift/node",
"/cgroup/all/openshift",
"/var/log/mcollective.log",
"/var/log/openshift-gears-async-start.log",
"/var/log/httpd/error_log"])
self.add_cmd_output("oo-accept-node -v")
self.add_cmd_output("oo-admin-ctl-gears list")
self.add_cmd_output("ls -l /var/lib/openshift")
def postproc(self):
self.do_file_sub('/etc/openshift/broker.conf',
r"(MONGO_PASSWORD=)(.*)",
r"\1*******")
self.do_file_sub('/etc/openshift/broker.conf',
r"(SESSION_SECRET=)(.*)",
r"\1*******")
self.do_file_sub('/etc/openshift/console.conf',
r"(SESSION_SECRET=)(.*)",
r"\1*******")
self.do_file_sub('/etc/openshift/htpasswd',
r"(.*:)(.*)",
r"\1********")
sosreport/sos/plugins/ata.py 0000644 0001750 0001750 00000002654 12254061770 014667 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin
import os
class Ata(Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin):
""" ATA and IDE related information (including PATA and SATA)
"""
plugin_name = "ata"
packages = ('hdparm', 'smartmontools')
def setup(self):
dev_path = '/dev'
sys_block = '/sys/block'
self.add_copy_spec('/proc/ide')
if os.path.isdir(sys_block):
for disk in os.listdir(sys_block):
if disk.startswith("sd") or disk.startswith("hd"):
disk_path = os.path.join(dev_path, disk)
self.add_cmd_output("hdparm %s" % disk_path)
self.add_cmd_output("smartctl -a %s" % disk_path)
sosreport/sos/plugins/dmraid.py 0000644 0001750 0001750 00000002070 12254061770 015352 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
import os
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Dmraid(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""dmraid related information
"""
plugin_name = 'dmraid'
dmraid_options = ['V','b','r','s','tay','rD']
def setup(self):
for opt in self.dmraid_options:
self.add_cmd_output("dmraid -%s" % (opt,))
sosreport/sos/plugins/apache.py 0000644 0001750 0001750 00000003451 12254061770 015337 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Apache(Plugin):
"""Apache related information
"""
plugin_name = "apache"
option_list = [("log", "gathers all apache logs", "slow", False)]
class RedHatApache(Apache, RedHatPlugin):
"""Apache related information for Red Hat distributions
"""
files = ('/etc/httpd/conf/httpd.conf',)
def setup(self):
super(RedHatApache, self).setup()
self.add_copy_specs([
"/etc/httpd/conf/httpd.conf",
"/etc/httpd/conf.d/*.conf"])
self.add_forbidden_path("/etc/httpd/conf/password.conf")
if self.get_option("log"):
self.add_copy_spec("/var/log/httpd/*")
class DebianApache(Apache, DebianPlugin, UbuntuPlugin):
"""Apache related information for Debian distributions
"""
files = ('/etc/apache2/apache2.conf',)
def setup(self):
super(DebianApache, self).setup()
self.add_copy_specs([
"/etc/apache2/*",
"/etc/default/apache2"])
if self.get_option("log"):
self.add_copy_spec("/var/log/apache2/*")
sosreport/sos/plugins/Makefile 0000644 0001750 0001750 00000001102 12254061770 015173 0 ustar zef zef PYTHON=python
PACKAGE = $(shell basename `pwd`)
PYFILES = $(wildcard *.py)
PYVER := $(shell $(PYTHON) -c 'import sys; print "%.3s" %(sys.version)')
PYSYSDIR := $(shell $(PYTHON) -c 'import sys; print sys.prefix')
PYLIBDIR = $(PYSYSDIR)/lib/python$(PYVER)
PKGDIR = $(PYLIBDIR)/site-packages/sos/$(PACKAGE)
all:
echo "nada"
clean:
rm -f *.pyc *.pyo *~
install:
mkdir -p $(DESTDIR)/$(PKGDIR)
for p in $(PYFILES) ; do \
install -m 644 $$p $(DESTDIR)/$(PKGDIR)/$$p; \
done
$(PYTHON) -c "import compileall; compileall.compile_dir('$(DESTDIR)/$(PKGDIR)', 1, '$(PYDIR)', 1)"
sosreport/sos/plugins/systemtap.py 0000644 0001750 0001750 00000002173 12254061770 016147 0 ustar zef zef ## Copyright (C) 2007 Red Hat, Inc., Eugene Teo
### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class SystemTap(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""SystemTap information
"""
plugin_name = 'systemtap'
files = ('stap',)
packages = ('systemtap', 'systemtap-runtime')
def setup(self):
self.add_cmd_output("stap -V 2")
self.add_cmd_output("uname -r")
sosreport/sos/plugins/foreman.py 0000644 0001750 0001750 00000002231 12271435675 015550 0 ustar zef zef ## Copyright (C) 2013 Red Hat, Inc., Lukas Zapletal
## 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., 675 Mass Ave, Cambridge, MA 02139, USA.
import os
from sos.plugins import Plugin, RedHatPlugin
class Foreman(Plugin, RedHatPlugin):
"""Foreman project related information
"""
plugin_name = 'foreman'
packages = ('foreman')
def setup(self):
foreman_debug_path = os.path.join(
self.get_cmd_path(),"foreman-debug")
self.add_cmd_output("%s -q -a -d %s"
% ("foreman-debug", foreman_debug_path))
sosreport/sos/plugins/boot.py 0000644 0001750 0001750 00000003201 12254061770 015052 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
from glob import glob
class Boot(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""Bootloader information
"""
plugin_name = 'boot'
option_list = [("all-images",
"collect a file listing for all initramfs images", "slow",
False)]
def setup(self):
self.add_copy_specs([
# legacy / special purpose bootloader configs
"/etc/milo.conf",
"/etc/silo.conf",
"/boot/efi/efi/redhat/elilo.conf",
"/etc/yaboot.conf",
"/boot/yaboot.conf"
])
self.add_cmd_output("ls -lanR /boot")
self.add_cmd_output("lsinitrd")
if self.get_option("all-images"):
for image in glob('/boot/initr*.img'):
if image[-9:] == "kdump.img":
continue
self.add_cmd_output("lsinitrd %s" % image)
sosreport/sos/plugins/cobbler.py 0000644 0001750 0001750 00000002672 12254061770 015532 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Cobbler(Plugin):
plugin_name = "cobbler"
class RedHatCobbler(Cobbler, RedHatPlugin):
"""cobbler related information
"""
packages = ('cobbler',)
def setup(self):
self.add_copy_spec("/etc/cobbler")
self.add_copy_spec("/var/log/cobbler")
self.add_copy_spec("/var/lib/rhn/kickstarts")
self.add_copy_spec("/var/lib/cobbler")
class DebianCobbler(Cobbler, DebianPlugin, UbuntuPlugin):
"""cobbler related information for Debian and Ubuntu
"""
packages = ('cobbler',)
def setup(self):
self.add_copy_spec("/etc/cobbler")
self.add_copy_spec("/var/log/cobbler")
self.add_copy_spec("/var/lib/cobbler")
sosreport/sos/plugins/apparmor.py 0000644 0001750 0001750 00000001755 12254061770 015744 0 ustar zef zef ## Copyright (c) 2012 Adam Stokes
## 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, UbuntuPlugin
class Apparmor(Plugin, UbuntuPlugin):
"""Apparmor related information
"""
plugin_name = 'apparmor'
def setup(self):
self.add_copy_specs([
"/etc/apparmor"
])
sosreport/sos/plugins/filesys.py 0000644 0001750 0001750 00000003642 12254061770 015576 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
import os
import re
from six.moves import zip
class Filesys(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""information on filesystems
"""
plugin_name = 'filesys'
option_list = [("lsof", 'gathers information on all open files', 'slow', False),
("dumpe2fs", 'dump filesystem information', 'slow', False)]
def setup(self):
self.add_copy_specs([
"/proc/filesystems",
"/etc/fstab",
"/proc/self/mounts",
"/proc/self/mountinfo",
"/proc/self/mountstats",
"/proc/mounts"
])
self.add_cmd_output("mount -l", root_symlink = "mount")
self.add_cmd_output("df -al", root_symlink = "df")
self.add_cmd_output("df -ali")
self.add_cmd_output("findmnt")
if self.get_option('lsof'):
self.add_cmd_output("lsof -b +M -n -l -P", root_symlink = "lsof")
if self.get_option('dumpe2fs'):
mounts = '/proc/mounts'
ext_fs_regex = r"^(/dev/.+).+ext[234]\s+"
for dev in zip(self.do_regex_find_all(ext_fs_regex, mounts)):
self.add_cmd_output("dumpe2fs -h %s" % (dev))
sosreport/sos/plugins/pci.py 0000644 0001750 0001750 00000002313 12254061770 014665 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin
from glob import glob
import os
class Pci(Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin):
"""PCI device related information
"""
plugin_name = "pci"
def setup(self):
self.add_copy_specs([
"/proc/ioports",
"/proc/iomem",
"/proc/bus/pci"
])
self.add_cmd_output("lspci", root_symlink = "lspci")
self.add_cmd_output("lspci -nvv")
self.add_cmd_output("lspci -tv")
sosreport/sos/plugins/landscape.py 0000644 0001750 0001750 00000004550 12254061770 016051 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, UbuntuPlugin
class Landscape(Plugin, UbuntuPlugin):
"""
landscape client related information
"""
plugin_name = 'landscape'
files = ('/etc/landscape/client.conf',
'broker.log',
'broker.log.gz',
'broker.log.1',
'broker.log.1.gz',
'broker.log.2',
'broker.log.2.gz',
'manager.log',
'manager.log.gz',
'manager.log.1',
'manager.log.1.gz',
'manager.log.2',
'manager.log.2.gz',
'monitor.log',
'monitor.log.gz',
'monitor.log.1',
'monitor.log.1.gz',
'monitor.log.2',
'monitor.log.2.gz',
'package-reporter.log',
'package-reporter.log.gz',
'package-reporter.log.1',
'package-reporter.log.1.gz',
'package-reporter.log.2',
'package-reporter.log.2.gz',
'sysinfo.log',
'sysinfo.log.gz',
'sysinfo.log.1',
'sysinfo.log.1.gz',
'sysinfo.log.2',
'sysinfo.log.2.gz',
'watchdog.log',
'watchdog.log.gz',
'watchdog.log.1',
'watchdog.log.1.gz',
'watchdog.log.2',
'watchdog.log.2.gz'
,)
packages = ('landscape-client',)
def setup(self):
self.add_copy_spec("/etc/landscape/client.conf")
def postproc(self):
self.do_file_sub("/etc/landscape/client.conf",
r"registration_password(.*)",
r"registration_password[***]"
)
sosreport/sos/plugins/logs.py 0000644 0001750 0001750 00000005552 12254061770 015066 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
import os
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Logs(Plugin):
"""log data """
plugin_name = "logs"
option_list = [
("logsize",
"max size (MiB) to collect per syslog file", "", 15),
("all_logs",
"collect all log files defined in syslog.conf",
"", False)
]
def setup(self):
self.add_copy_specs([
"/etc/syslog.conf",
"/etc/rsyslog.conf"
])
self.limit = self.get_option("logsize")
self.add_copy_spec_limit("/var/log/boot*", sizelimit = self.limit)
if self.get_option('all_logs'):
logs = self.do_regex_find_all("^\S+\s+(-?\/.*$)\s+",
"/etc/syslog.conf")
if self.policy().pkg_by_name("rsyslog") \
or os.path.exists("/etc/rsyslog.conf"):
logs += self.do_regex_find_all("^\S+\s+(-?\/.*$)\s+", "/etc/rsyslog.conf")
for i in logs:
if i.startswith("-"):
i = i[1:]
if os.path.isfile(i):
self.add_copy_spec_limit(i, sizelimit = self.limit)
class RedHatLogs(Logs, RedHatPlugin):
"""Basic system information for RedHat based distributions"""
def setup(self):
super(RedHatLogs, self).setup()
self.add_copy_spec_limit("/var/log/secure*", sizelimit = self.limit)
self.add_copy_spec_limit("/var/log/messages*", sizelimit = self.limit)
class DebianLogs(Logs, DebianPlugin):
"""Basic system information for Debian based distributions"""
def setup(self):
super(DebianLogs, self).setup()
self.add_copy_specs([
"/var/log/syslog",
"/var/log/udev",
"/var/log/kern*",
"/var/log/mail*",
"/var/log/dist-upgrade",
"/var/log/installer",
"/var/log/unattended-upgrades"
])
class UbuntuLogs(Logs, UbuntuPlugin):
"""Basic system information for Ubuntu based distributions"""
def setup(self):
super(UbuntuLogs, self).setup()
self.add_copy_specs([
"/var/log/apport.log",
"/var/log/landscape",
])
sosreport/sos/plugins/infiniband.py 0000644 0001750 0001750 00000002713 12254061770 016217 0 ustar zef zef ## Copyright (C) 2011, 2012 Red Hat, Inc., Bryn M. Reeves
### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Infiniband(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""Infiniband related information
"""
plugin_name = 'infiniband'
def check_enabled(self):
if self.commons["policy"].pkg_by_name("libibverbs-utils"):
return True
return False
def setup(self):
self.add_copy_specs([
"/etc/ofed/openib.conf",
"/etc/ofed/opensm.conf"])
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
sosreport/sos/plugins/azure.py 0000644 0001750 0001750 00000002371 12254061770 015244 0 ustar zef zef # Copyright (C) 2013 Adam Stokes
#
# 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, UbuntuPlugin
class Azure(Plugin, UbuntuPlugin):
""" Microsoft Azure Client Plugin
"""
plugin_name = 'azure'
packages = ('walinuxagent',)
def setup(self):
self.add_copy_specs(["/var/log/waagent*",
"/var/lib/cloud",
"/etc/default/kv-kvp-daemon-init",
"/sys/module/hv_netvsc/parameters/ring_size",
"/sys/module/hv_storvsc/parameters/storvsc_ringbuffer_size"])
sosreport/sos/plugins/satellite.py 0000644 0001750 0001750 00000006164 12254061770 016110 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin
import os
class Satellite(Plugin, RedHatPlugin):
"""RHN Satellite and Spacewalk related information
"""
plugin_name = 'satellite'
satellite = False
proxy = False
option_list = [("log", 'gathers all apache logs', 'slow', False)]
def default_enabled(self):
return False
def rhn_package_check(self):
self.satellite = self.is_installed("rhns-satellite-tools") \
or self.is_installed("spacewalk-java") \
or self.is_installed("rhn-base")
self.proxy = self.is_installed("rhns-proxy-tools") \
or self.is_installed("spacewalk-proxy-management") \
or self.is_installed("rhn-proxy-management")
return self.satellite or self.proxy
def check_enabled(self):
# enable if any related package is installed
return self.rhn_package_check()
def setup(self):
self.rhn_package_check()
self.add_copy_specs([
"/etc/httpd/conf*",
"/etc/rhn",
"/var/log/rhn*"])
if self.get_option("log"):
self.add_copy_spec("/var/log/httpd")
# all these used to go in $DIR/mon-logs/
self.add_copy_specs([
"/opt/notification/var/*.log*",
"/var/tmp/ack_handler.log*",
"/var/tmp/enqueue.log*"])
# monitoring scout logs
self.add_copy_specs([
"/home/nocpulse/var/*.log*",
"/home/nocpulse/var/commands/*.log*",
"/var/tmp/ack_handler.log*",
"/var/tmp/enqueue.log*",
"/var/log/nocpulse/*.log*",
"/var/log/notification/*.log*",
"/var/log/nocpulse/TSDBLocalQueue/TSDBLocalQueue.log"])
self.add_copy_spec("/root/ssl-build")
self.add_cmd_output("rhn-schema-version",
root_symlink = "database-schema-version")
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("spacewalk-debug"):
self.add_cmd_output("spacewalk-debug --dir %s"
% os.path.join(self.get_cmd_path()))
if self.proxy:
self.add_copy_specs(["/etc/squid", "/var/log/squid"])
sosreport/sos/plugins/maas.py 0000644 0001750 0001750 00000002427 12271430455 015040 0 ustar zef zef # Copyright (C) 2013 Adam Stokes
#
# 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, UbuntuPlugin
class Maas(Plugin, UbuntuPlugin):
"""MAAS Plugin
"""
plugin_name = 'maas'
def setup(self):
self.add_copy_specs([
"/etc/squid-deb-proxy",
"/etc/maas",
"/var/lib/maas/dhcp*",
"/var/log/apache2*",
"/var/log/maas*",
"/var/log/upstart/maas-*",
])
self.add_cmd_output("apt-cache policy maas-*")
self.add_cmd_output("apt-cache policy python-django-*")
self.add_cmd_output("maas dumpdata")
sosreport/sos/plugins/emc.py 0000644 0001750 0001750 00000025202 12254061770 014660 0 ustar zef zef ## emc.py
## Captures EMC specific information during a sos run.
## Copyright (C) 2008 EMC Corporation. Keith Kearnan
### 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
## 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, os
class Emc(Plugin, RedHatPlugin):
"""EMC related information (PowerPath, Solutions Enabler CLI and Navisphere CLI)
"""
plugin_name = 'emc'
def about_emc(self):
""" EMC Corporation specific information
"""
self.add_custom_text('
EMC²®')
self.add_custom_text(' where information lives®
')
self.add_custom_text("EMC Corporation is the world's leading developer and provider of information ")
self.add_custom_text("infrastructure technology and solutions that enable organizations of all sizes to transform ")
self.add_custom_text("the way they compete and create value from their information. ")
self.add_custom_text("Information about EMC's products and services can be found at ")
self.add_custom_text('www.EMC.com.
')
def get_pp_files(self):
""" EMC PowerPath specific information - files
"""
self.add_cmd_output("powermt version")
self.add_copy_specs([
"/etc/init.d/PowerPath",
"/etc/powermt.custom",
"/etc/emcp_registration",
"/etc/emc/mpaa.excluded",
"/etc/emc/mpaa.lams",
"/etc/emcp_devicesDB.dat",
"/etc/emcp_devicesDB.idx",
"/etc/emc/powerkmd.custom",
"/etc/modprobe.conf.pp"])
def get_pp_config(self):
""" EMC PowerPath specific information - commands
"""
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
"""
self.add_copy_specs([
"/var/symapi/db/symapi_db.bin",
"/var/symapi/config/[a-z]*",
"/var/symapi/log/[a-z]*"])
def get_symcli_config(self):
""" EMC Solutions Enabler SYMCLI specific information - Symmetrix/DMX - commands
"""
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
"""
self.add_copy_specs([
"/etc/Navisphere/agent.config",
"/etc/Navisphere/Navimon.cfg",
"/etc/Navisphere/Quietmode.cfg",
"/etc/Navisphere/messages/[a-z]*",
"/etc/Navisphere/log/[a-z]*"])
def get_navicli_SP_info(self,SP_address):
""" EMC Navisphere Host Agent NAVICLI specific information - CLARiiON - commands
"""
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" ]
self.files = [ "/opt/Navisphere/bin", "/proc/emcp" ]
return Plugin.check_enabled(self)
def setup(self):
from subprocess import Popen, PIPE
## About EMC Corporation default no if no EMC products are installed
add_about_emc="no"
## If PowerPath is installed collect PowerPath specific information
if self.is_installed("EMCpower"):
print("EMC PowerPath is installed.")
print(" Gathering EMC PowerPath information...")
self.add_custom_text("EMC PowerPath is installed. ")
self.get_pp_files()
add_about_emc = "yes"
## If PowerPath is running collect additional PowerPath specific information
if os.path.isdir("/proc/emcp"):
print("EMC PowerPath is running.")
print(" Gathering additional EMC PowerPath information...")
self.get_pp_config()
## If Solutions Enabler is installed collect Symmetrix/DMX specific information
if len(self.policy().package_manager.all_pkgs_by_name_regex('[Ss][Yy][Mm][Cc][Ll][Ii]-[Ss][Yy][Mm][Cc][Ll][Ii]')) > 0:
print("EMC Solutions Enabler SYMCLI is installed.")
print(" Gathering EMC Solutions Enabler SYMCLI information...")
self.add_custom_text("EMC Solutions Enabler is installed. ")
self.get_symcli_files()
self.get_symcli_config()
add_about_emc = "yes"
## If Navisphere Host Agent is installed collect CLARiiON specific information
if os.path.isdir("/opt/Navisphere/bin"):
print("")
print("The EMC CLARiiON Navisphere Host Agent is installed.")
self.add_custom_text("EMC CLARiiON Navisphere Host Agent is installed. ")
self.get_navicli_config()
print(" Gathering Navisphere NAVICLI Host Agent information...")
print(" Please enter a CLARiiON SP IP address. In order to collect")
print( " information for both SPA and SPB as well as multiple")
print(" CLARiiON arrays (if desired) you will be prompted multiple times.")
print(" To exit simply press [Enter]")
print("")
add_about_emc = "yes"
CLARiiON_IP_address_list = []
CLARiiON_IP_loop = "stay_in"
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("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)
else:
if ans != "":
print("The IP address you entered, %s, is not to an active CLARiiON SP." % ans)
if ans == "":
CLARiiON_IP_loop = "get_out"
## Sort and dedup the list of CLARiiON IP Addresses
CLARiiON_IP_address_list.sort()
for SP_address in CLARiiON_IP_address_list:
if CLARiiON_IP_address_list.count(SP_address) > 1:
CLARiiON_IP_address_list.remove(SP_address)
for SP_address in CLARiiON_IP_address_list:
if SP_address != "":
print(" Gathering NAVICLI information for %s..." % SP_address)
self.get_navicli_SP_info(SP_address)
## Only provide About EMC if EMC products are installed
if add_about_emc != "no":
self.about_emc()
sosreport/sos/plugins/postfix.py 0000644 0001750 0001750 00000003215 12254061770 015610 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
from os.path import exists
class Postfix(Plugin):
"""mail server related information
"""
plugin_name = "postfix"
packages = ('postfix',)
def setup(self):
self.add_copy_specs([
"/etc/postfix/main.cf",
"/etc/postfix/master.cf"])
self.add_cmd_output("postconf")
class RedHatPostfix(Postfix, RedHatPlugin):
"""mail server related information for RedHat based distributions
"""
files = ('/etc/rc.d/init.d/postfix',)
packages = ('postfix',)
def setup(self):
super(RedHatPostfix, self).setup()
self.add_copy_spec("/etc/mail")
class DebianPostfix(Postfix, DebianPlugin, UbuntuPlugin):
"""mail server related information for Debian based Distribution
"""
packages = ('postfix',)
def setup(self):
super(DebianPostfix, self).setup()
self.add_copy_spec("/etc/postfix/dynamicmaps.cf")
sosreport/sos/plugins/md.py 0000644 0001750 0001750 00000002137 12254061770 014516 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
import os
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Md(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""MD subsystem information
"""
plugin_name = 'md'
def setup(self):
self.add_cmd_output("mdadm -D /dev/md*")
self.add_copy_specs([
"/proc/mdstat",
"/etc/mdadm.conf",
"/dev/md/md-device-map"
])
sosreport/sos/plugins/nis.py 0000644 0001750 0001750 00000002157 12254061770 014711 0 ustar zef zef ## nis.py
## A plugin to gather all the NIS information
### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
import os
class Nis(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""NIS related information
"""
plugin_name = 'nis'
files = ('/var/yp',)
def setup(self):
self.add_copy_spec("/etc/yp*.conf")
self.add_copy_spec("/var/yp/*")
self.add_cmd_output("domainname")
sosreport/sos/plugins/oddjob.py 0000644 0001750 0001750 00000002201 12254061770 015347 0 ustar zef zef ## Copyright (C) 2007 Sadique Puthen
### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin
class Oddjob(Plugin, RedHatPlugin):
"""oddjob related information
"""
plugin_name = 'oddjob'
files = ('/etc/oddjobd.conf',)
packages = ('oddjob',)
def setup(self):
self.add_copy_spec("/etc/oddjobd.conf")
self.add_copy_spec("/etc/oddjobd.conf.d")
self.add_copy_spec("/etc/dbus-1/system.d/oddjob.conf")
sosreport/sos/plugins/apt.py 0000644 0001750 0001750 00000002232 12254061770 014676 0 ustar zef zef # Copyright (C) 2013 Louis Bouchard
#
# 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, UbuntuPlugin, DebianPlugin
class Apt(Plugin, DebianPlugin, UbuntuPlugin):
""" Apt Plugin
"""
plugin_name = 'apt'
def setup(self):
self.add_copy_specs(["/etc/apt", "/var/log/apt"])
self.add_cmd_output("apt-get check")
self.add_cmd_output("apt-config dump")
self.add_cmd_output("apt-cache stats")
self.add_cmd_output("apt-cache policy")
sosreport/sos/plugins/hts.py 0000644 0001750 0001750 00000001760 12254061770 014715 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin
class HardwareTestSuite(Plugin, RedHatPlugin):
"""Red Hat Hardware Test Suite related information
"""
plugin_name = 'hardwaretestsuite'
def setup(self):
self.add_copy_spec("/etc/httpd/conf.d/hts.conf")
self.add_copy_spec("/var/hts")
sosreport/sos/plugins/openstack_cinder.py 0000644 0001750 0001750 00000005351 12254061770 017432 0 ustar zef zef ## Copyright (C) 2009 Red Hat, Inc., Joey Boggs
## Copyright (C) 2012 Rackspace US, Inc., Justin Shepherd
## Copyright (C) 2013 Red Hat, Inc., Flavio Percoco
## Copyright (C) 2013 Red Hat, Inc., Jeremy Agee
### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
import os
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class OpenStackCinder(Plugin):
"""openstack cinder related information
"""
plugin_name = "openstack-cinder"
option_list = [("log", "gathers openstack cinder logs", "slow", True),
("db", "gathers openstack cinder db version", "slow", False)]
def setup(self):
if self.option_enabled("db"):
self.add_cmd_output(
"cinder-manage db version",
suggest_filename="cinder_db_version")
self.add_copy_specs(["/etc/cinder/"])
if self.option_enabled("log"):
self.add_copy_specs(["/var/log/cinder/"])
class DebianOpenStackCinder(OpenStackCinder, DebianPlugin, UbuntuPlugin):
"""OpenStack Cinder related information for Debian based distributions
"""
cinder = False
packages = ('cinder-api',
'cinder-backup',
'cinder-common',
'cinder-scheduler',
'cinder-volume',
'python-cinder',
'python-cinderclient')
def check_enabled(self):
self.cinder = self.is_installed("cinder-common")
return self.cinder
def setup(self):
super(DebianOpenStackCinder, self).setup()
class RedHatOpenStackCinder(OpenStackCinder, RedHatPlugin):
"""OpenStack related information for Red Hat distributions
"""
cinder = False
packages = ('openstack-cinder',
'python-cinder',
'python-cinderclient')
def check_enabled(self):
self.cinder = self.is_installed("openstack-cinder")
return self.cinder
def setup(self):
super(RedHatOpenStackCinder, self).setup()
self.add_copy_specs(["/etc/sudoers.d/cinder"])
sosreport/sos/plugins/openstack_glance.py 0000644 0001750 0001750 00000003764 12254061770 017425 0 ustar zef zef ## Copyright (C) 2013 Red Hat, Inc., Flavio Percoco
## Copyright (C) 2012 Rackspace US, Inc., Justin Shepherd
## Copyright (C) 2009 Red Hat, Inc., Joey Boggs
### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos import plugins
class OpenStackGlance(plugins.Plugin):
"""OpenstackGlance related information."""
plugin_name = "openstack-glance"
option_list = [("log", "gathers openstack-glance logs", "slow", False)]
def setup(self):
# Glance
self.add_cmd_output(
"glance-manage db_version",
suggest_filename="glance_db_version")
self.add_copy_specs(["/etc/glance/",
"/var/log/glance/"])
class DebianOpenStackGlance(OpenStackGlance,
plugins.DebianPlugin,
plugins.UbuntuPlugin):
"""OpenStackGlance related information for Debian based distributions."""
packages = ('glance',
'glance-api',
'glance-client',
'glance-common',
'glance-registry',
'python-glance')
class RedHatOpenStackGlance(OpenStackGlance, plugins.RedHatPlugin):
"""OpenStackGlance related information for Red Hat distributions."""
packages = ('openstack-glance',
'python-glanceclient')
sosreport/sos/plugins/dhcp.py 0000644 0001750 0001750 00000002734 12254061770 015037 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin
class Dhcp(Plugin):
"""DHCP related information
"""
plugin_name = "dhcp"
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(RedHatDhcp, self).setup()
self.add_copy_specs([
"/etc/dhcpd.conf",
"/etc/dhcp"])
class UbuntuDhcp(Dhcp, UbuntuPlugin):
"""DHCP related information for Debian based distributions"""
files = ('/etc/init.d/udhcpd',)
packages = ('udhcpd',)
def setup(self):
super(DebianDhcp, self).setup()
self.add_copy_specs([
"/etc/default/udhcpd",
"/etc/udhcpd.conf"
])
sosreport/sos/plugins/squid.py 0000644 0001750 0001750 00000003115 12254062025 015232 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Squid(Plugin):
"""squid related information
"""
plugin_name = 'squid'
option_list = [("logsize", "maximum size (MiB) of logs to collect",
"", 15)]
class RedHatSquid(Squid, RedHatPlugin):
"""squid Red Hat related information
"""
files = ('/etc/squid/squid.conf',)
packages = ('squid',)
def setup(self):
self.add_copy_spec_limit("/etc/squid/squid.conf",
sizelimit=self.get_option('logsize'))
class DebianSquid(Squid, DebianPlugin, UbuntuPlugin):
"""squid related information for Debian and Ubuntu
"""
plugin_name = 'squid'
files = ('/etc/squid3/squid.conf',)
packages = ('squid3',)
def setup(self):
self.add_copy_spec_limit("/etc/squid3/squid.conf",
sizelimit=self.get_option('logsize'))
sosreport/sos/plugins/dpkg.py 0000644 0001750 0001750 00000002050 12254061770 015035 0 ustar zef zef ## Copyright (c) 2012 Adam Stokes
## 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, DebianPlugin, UbuntuPlugin
class Dpkg(Plugin, DebianPlugin, UbuntuPlugin):
"""dpkg information
"""
plugin_name = 'dpkg'
def setup(self):
self.add_copy_spec("/var/log/dpkg.log")
self.add_cmd_output("dpkg -l", root_symlink = "installed-debs")
sosreport/sos/plugins/s390.py 0000644 0001750 0001750 00000004642 12254061770 014617 0 ustar zef zef ## Copyright (C) 2007 Red Hat, Inc., Justin Payne
### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin
class S390(Plugin, RedHatPlugin):
"""s390 related information
"""
plugin_name = 's390'
### Check for s390 arch goes here
def check_enabled(self):
return (self.policy().get_arch() == "s390")
### Gather s390 specific information
def setup(self):
self.add_copy_specs([
"/proc/cio_ignore"
"/proc/crypto",
"/proc/dasd/devices",
"/proc/dasd/statistics",
"/proc/misc",
"/proc/qeth",
"/proc/qeth_perf",
"/proc/qeth_ipa_takeover",
"/proc/sys/appldata/*",
"/proc/sys/kernel/hz_timer",
"/proc/sysinfo",
"/sys/bus/ccwgroup/drivers/qeth/0.*/*",
"/sys/bus/ccw/drivers/zfcp/0.*/*",
"/sys/bus/ccw/drivers/zfcp/0.*/0x*/*",
"/sys/bus/ccw/drivers/zfcp/0.*/0x*/0x*/*",
"/etc/zipl.conf",
"/etc/zfcp.conf",
"/etc/sysconfig/dumpconf",
"/etc/src_vipa.conf",
"/etc/ccwgroup.conf",
"/etc/chandev.conf"])
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("qethconf list_all")
self.add_cmd_output("lsqeth")
self.add_cmd_output("lszfcp")
ret, dasd_dev, rtime = self.call_ext_prog("ls /dev/dasd?")
for x in dasd_dev.split('\n'):
self.add_cmd_output("dasdview -x -i -j -l -f %s" % (x,))
self.add_cmd_output("fdasd -p %s" % (x,))
sosreport/sos/plugins/xfs.py 0000644 0001750 0001750 00000003063 12254061770 014715 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
import os
import re
from six.moves import zip
class Xfs(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
"""information on the XFS filesystem
"""
plugin_name = 'xfs'
option_list = [("logprint", 'gathers the log information', 'slow', False)]
def setup(self):
mounts = '/proc/mounts'
ext_fs_regex = r"^(/dev/.+).+xfs\s+"
for dev in zip(self.do_regex_find_all(ext_fs_regex, mounts)):
for e in dev:
parts = e.split(' ')
self.add_cmd_output("xfs_info %s" % (parts[1]))
if self.get_option('logprint'):
for dev in zip(self.do_regex_find_all(ext_fs_regex, mounts)):
for e in dev:
parts = e.split(' ')
self.add_cmd_output("xfs_logprint -c %s" % (parts[0]))
sosreport/sos/plugins/cluster.py 0000644 0001750 0001750 00000010702 12254061770 015574 0 ustar zef zef ### 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., 675 Mass Ave, Cambridge, MA 02139, USA.
from sos.plugins import Plugin, RedHatPlugin
import re
from glob import glob
class Cluster(Plugin, RedHatPlugin):
"""cluster suite and GFS related information
"""
plugin_name = 'cluster'
option_list = [("gfslockdump",
'gather output of gfs lockdumps', 'slow', False),
('lockdump', 'gather dlm lockdumps', 'slow', False)]
packages = [
"ricci",
"corosync",
"openais",
"cman",
"clusterlib",
"fence-agents",
"pacemaker"
]
files = [ "/etc/cluster/cluster.conf" ]
def setup(self):
self.add_copy_spec("/etc/cluster.conf")
self.add_copy_spec("/etc/cluster.xml")
self.add_copy_spec("/etc/cluster")
self.add_copy_spec("/etc/sysconfig/cluster")
self.add_copy_spec("/etc/sysconfig/cman")
self.add_copy_spec("/etc/fence_virt.conf")
self.add_copy_spec("/var/lib/ricci")
self.add_copy_spec("/var/lib/luci/data/luci.db")
self.add_copy_spec("/var/lib/luci/etc")
self.add_copy_spec("/var/log/cluster")
self.add_copy_spec("/var/log/luci")
self.add_copy_spec("/etc/fence_virt.conf")
if self.get_option('gfslockdump'):
self.do_gfslockdump()
if self.get_option('lockdump'):
self.do_lockdump()
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.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("ipvsadm -L")
self.add_cmd_output("corosync-quorumtool -l")
self.add_cmd_output("corosync-quorumtool -s")
self.add_cmd_output("corosync-cpgtool")
self.add_cmd_output("corosync-objctl")
self.add_cmd_output("group_tool ls -g1")
self.add_cmd_output("gfs_control ls -n")
self.add_cmd_output("gfs_control dump")
self.add_cmd_output("fence_tool dump")
self.add_cmd_output("dlm_tool dump")
self.add_cmd_output("dlm_tool ls -n")
self.add_cmd_output("mkqdisk -L")
crm_dest = os.path.join(self.cInfo['cmddir'],
self.name(), 'crm_report')
self.collectExtOutput("crm_report -S --dest %s" % crm_dest)
def do_lockdump(self):
status, output, time = self.call_ext_prog("dlm_tool ls")
for lockspace in re.compile(r'^name\s+([^\s]+)$',
re.MULTILINE).findall(output):
self.add_cmd_output("dlm_tool lockdebug -svw '%s'" % lockspace,
suggest_filename = "dlm_locks_%s" % lockspace)
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("gfs_tool lockdump %s" % mntpoint,
suggest_filename = "gfs_lockdump_"
+ self.mangle_command(mntpoint))
def postproc(self):
for cluster_conf in glob("/etc/cluster/cluster.conf*"):
self.do_file_sub(cluster_conf,
r"(\s*\