aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/sos/__init__.py0
-rwxr-xr-xsrc/lib/sos/helpers.py176
-rw-r--r--src/lib/sos/plugins/__init__.py0
-rw-r--r--src/lib/sos/plugins/acpid.py24
-rw-r--r--src/lib/sos/plugins/amd.py36
-rw-r--r--src/lib/sos/plugins/anaconda.py34
-rw-r--r--src/lib/sos/plugins/apache.py28
-rw-r--r--src/lib/sos/plugins/auditd.py27
-rw-r--r--src/lib/sos/plugins/autofs.py61
-rw-r--r--src/lib/sos/plugins/bootloader.py32
-rw-r--r--src/lib/sos/plugins/cluster.py299
-rw-r--r--src/lib/sos/plugins/cobbler.py31
-rw-r--r--src/lib/sos/plugins/crontab.py27
-rw-r--r--src/lib/sos/plugins/cs.py50
-rw-r--r--src/lib/sos/plugins/devicemapper.py66
-rw-r--r--src/lib/sos/plugins/dhcp.py29
-rw-r--r--src/lib/sos/plugins/dovecot.py26
-rw-r--r--src/lib/sos/plugins/ds.py50
-rw-r--r--src/lib/sos/plugins/emc.py218
-rw-r--r--src/lib/sos/plugins/filesys.py60
-rw-r--r--src/lib/sos/plugins/ftp.py30
-rw-r--r--src/lib/sos/plugins/gdm.py22
-rw-r--r--src/lib/sos/plugins/general.py59
-rw-r--r--src/lib/sos/plugins/hardware.py52
-rw-r--r--src/lib/sos/plugins/hts.py23
-rw-r--r--src/lib/sos/plugins/i18n.py26
-rw-r--r--src/lib/sos/plugins/initrd.py28
-rw-r--r--src/lib/sos/plugins/ipa.py37
-rw-r--r--src/lib/sos/plugins/ipsec.py30
-rw-r--r--src/lib/sos/plugins/iscsi.py24
-rw-r--r--src/lib/sos/plugins/kdump.py31
-rw-r--r--src/lib/sos/plugins/kernel.py116
-rw-r--r--src/lib/sos/plugins/kvm.py48
-rw-r--r--src/lib/sos/plugins/ldap.py50
-rw-r--r--src/lib/sos/plugins/libraries.py26
-rw-r--r--src/lib/sos/plugins/logrotate.py27
-rw-r--r--src/lib/sos/plugins/lsbrelease.py30
-rw-r--r--src/lib/sos/plugins/memory.py30
-rw-r--r--src/lib/sos/plugins/mrggrid.py23
-rw-r--r--src/lib/sos/plugins/mrgmessg.py24
-rw-r--r--src/lib/sos/plugins/mysql.py32
-rw-r--r--src/lib/sos/plugins/named.py44
-rw-r--r--src/lib/sos/plugins/netdump.py28
-rw-r--r--src/lib/sos/plugins/networking.py78
-rw-r--r--src/lib/sos/plugins/nfsserver.py44
-rw-r--r--src/lib/sos/plugins/nscd.py43
-rw-r--r--src/lib/sos/plugins/ntp.py23
-rw-r--r--src/lib/sos/plugins/oddjob.py31
-rw-r--r--src/lib/sos/plugins/openais.py39
-rw-r--r--src/lib/sos/plugins/openssl.py29
-rw-r--r--src/lib/sos/plugins/openswan.py32
-rw-r--r--src/lib/sos/plugins/pam.py25
-rw-r--r--src/lib/sos/plugins/postfix.py32
-rw-r--r--src/lib/sos/plugins/ppp.py32
-rw-r--r--src/lib/sos/plugins/printing.py30
-rw-r--r--src/lib/sos/plugins/process.py63
-rw-r--r--src/lib/sos/plugins/psacct.py22
-rw-r--r--src/lib/sos/plugins/pxe.py34
-rw-r--r--src/lib/sos/plugins/quagga.py30
-rw-r--r--src/lib/sos/plugins/radius.py36
-rw-r--r--src/lib/sos/plugins/rhn.py89
-rw-r--r--src/lib/sos/plugins/rpm.py33
-rw-r--r--src/lib/sos/plugins/s390.py74
-rw-r--r--src/lib/sos/plugins/samba.py29
-rw-r--r--src/lib/sos/plugins/sanitize.py41
-rw-r--r--src/lib/sos/plugins/sar.py37
-rw-r--r--src/lib/sos/plugins/selinux.py51
-rw-r--r--src/lib/sos/plugins/sendmail.py32
-rw-r--r--src/lib/sos/plugins/smartcard.py36
-rw-r--r--src/lib/sos/plugins/snmp.py31
-rw-r--r--src/lib/sos/plugins/soundcard.py30
-rw-r--r--src/lib/sos/plugins/squid.py29
-rw-r--r--src/lib/sos/plugins/ssh.py26
-rw-r--r--src/lib/sos/plugins/startup.py27
-rw-r--r--src/lib/sos/plugins/system.py33
-rw-r--r--src/lib/sos/plugins/systemtap.py35
-rw-r--r--src/lib/sos/plugins/tftpserver.py31
-rw-r--r--src/lib/sos/plugins/tomcat.py28
-rw-r--r--src/lib/sos/plugins/udev.py23
-rw-r--r--src/lib/sos/plugins/veritas.py221
-rw-r--r--src/lib/sos/plugins/vmware.py30
-rw-r--r--src/lib/sos/plugins/x11.py41
-rw-r--r--src/lib/sos/plugins/xen.py99
-rw-r--r--src/lib/sos/plugins/xinetd.py32
-rw-r--r--src/lib/sos/plugins/yum.py60
-rw-r--r--src/lib/sos/plugintools.py587
-rwxr-xr-xsrc/lib/sos/policyredhat.py377
-rw-r--r--src/lib/sos/progressbar.py368
88 files changed, 0 insertions, 5267 deletions
diff --git a/src/lib/sos/__init__.py b/src/lib/sos/__init__.py
deleted file mode 100644
index e69de29b..00000000
--- a/src/lib/sos/__init__.py
+++ /dev/null
diff --git a/src/lib/sos/helpers.py b/src/lib/sos/helpers.py
deleted file mode 100755
index 52e5e52d..00000000
--- a/src/lib/sos/helpers.py
+++ /dev/null
@@ -1,176 +0,0 @@
-## helpers.py
-## Implement policies required for the sos system support tool
-
-## Copyright (C) 2006 Steve Conklin <sconklin@redhat.com>
-
-### 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.
-
-## Some code adapted from "Python Cookbook, 2nd ed", by Alex
-## Martelli, Anna Martelli Ravenscroft, and David Ascher
-## (O'Reilly Media, 2005) 0-596-00797-3
-##
-
-"""
-helper functions used by sosreport and plugins
-"""
-import os, fcntl, select, sys, commands, signal
-from time import time, sleep
-import logging
-from tempfile import mkdtemp
-
-def importPlugin(pluginname, name):
- """ Import a plugin to extend capabilities of sosreport
- """
- try:
- plugin = __import__(pluginname, globals(), locals(), [name])
- except ImportError:
- return None
- return getattr(plugin, name)
-
-
-def sosFindTmpDir():
- """Find a temp directory to form the root for our gathered information
- and reports.
- """
- workingBase = mkdtemp("","sos_")
- return workingBase
-
-
-def makeNonBlocking(afd):
- """ Make the file descriptor non-blocking. This prevents deadlocks.
- """
- fl = fcntl.fcntl(afd, fcntl.F_GETFL)
- try:
- fcntl.fcntl(afd, fcntl.F_SETFL, fl | os.O_NDELAY)
- except AttributeError:
- fcntl.fcntl(afd, fcntl.F_SETFL, fl | os.FNDELAY)
-
-
-def sosGetCommandOutput(command, timeout = 300):
- """ Execute a command and gather stdin, stdout, and return status.
- """
- soslog = logging.getLogger('sos')
-
- # Log if binary is not runnable or does not exist
- for path in os.environ["PATH"].split(":"):
- cmdfile = command.strip("(").split()[0]
- # handle both absolute or relative paths
- if ( ( not os.path.isabs(cmdfile) and os.access(os.path.join(path,cmdfile), os.X_OK) ) or \
- ( os.path.isabs(cmdfile) and os.access(cmdfile, os.X_OK) ) ):
- break
- else:
- soslog.log(logging.VERBOSE, "binary '%s' does not exist or is not runnable" % cmdfile)
- return (127, "", 0)
-
- # these are file descriptors, not file objects
- r, w = os.pipe()
-
- pid = os.fork()
-
- if pid:
- # we are the parent
- os.close(w) # use os.close() to close a file descriptor
- r_fd = os.fdopen(r) # turn r into a file object
- stime=time()
- txt = ""
- sts = -1
- soslog.log(logging.VERBOSE2, 'forked command "%s" with pid %d, timeout is %d' % (command, pid, timeout) )
- while True:
- # read output from pipe
- ready = select.select([r], [], [], 1)
- if r in ready[0]:
- txt = txt + r_fd.read()
- # is child still running ?
- try: os.waitpid(pid, os.WNOHANG)
- except:
- # not running, make sure the child process gets cleaned up
- try: sts = os.waitpid(pid, 0)[1]
- except: pass
- break
- # has timeout passed ?
- if time() - stime > timeout:
- soslog.log(logging.VERBOSE, 'killing hung child with pid %s after %d seconds (command was "%s")' % (pid,timeout,command) )
- try: os.kill(pid, signal.SIGKILL)
- except: pass
- break
- if txt[-1:] == '\n': txt = txt[:-1]
- return (sts, txt, time()-stime)
- else:
- # we are the child
- os.dup2(r, 0)
- os.dup2(w, 1)
- os.dup2(w, 2)
-
- import resource
- maxfd = resource.getrlimit(resource.RLIMIT_NOFILE)[1]
- if not hasattr(resource, "RLIM_INFINITY"):
- resource.RLIM_INFINITY = -1L
- if (maxfd == resource.RLIM_INFINITY):
- maxfd = MAXFD
- for fd in range(3, maxfd):
- try: os.close(fd)
- except OSError: pass
- os.execl("/bin/sh", "/bin/sh", "-c", command)
- os._exit(127)
-
-# FIXME: this needs to be made clean and moved to the plugin tools, so
-# that it prints nice color output like sysreport if the progress bar
-# is not enabled.
-def sosStatus(stat):
- """ Complete a status line that has been output to the console,
- providing pass/fail indication.
- """
- if not stat:
- print " [ OK ]"
- else:
- print " [ FAILED ]"
- sys.stdout.flush()
- return
-
-
-def allEqual(elements):
- ''' return True if all the elements are equal, otherwise False. '''
- first_element = elements[0]
- for other_element in elements[1:]:
- if other_element != first_element:
- return False
- return True
-
-def commonPrefix(l1, l2, common = []):
- ''' return a list of common elements at the start of all sequences,
- then a list of lists that are the unique tails of each sequence. '''
- if len(l1) < 1 or len(l2) < 1 or l1[0] != l2[0]: return common, [l1, l2]
- return commonPrefix(l1[1:], l2[1:], common+[l1[0]])
-
-def sosRelPath(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) = commonPrefix(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 sosReadFile(fname):
- ''' reads a file and returns its contents'''
- fp = open(fname,"r")
- content = fp.read()
- fp.close()
- return content
diff --git a/src/lib/sos/plugins/__init__.py b/src/lib/sos/plugins/__init__.py
deleted file mode 100644
index e69de29b..00000000
--- a/src/lib/sos/plugins/__init__.py
+++ /dev/null
diff --git a/src/lib/sos/plugins/acpid.py b/src/lib/sos/plugins/acpid.py
deleted file mode 100644
index 7e94e650..00000000
--- a/src/lib/sos/plugins/acpid.py
+++ /dev/null
@@ -1,24 +0,0 @@
-### 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 sos.plugintools
-
-class acpid(sos.plugintools.PluginBase):
- """acpid related information
- """
- def setup(self):
- self.addCopySpec("/var/log/acpid*")
- self.addCopySpec("/etc/acpi/events/power.conf")
- return
-
diff --git a/src/lib/sos/plugins/amd.py b/src/lib/sos/plugins/amd.py
deleted file mode 100644
index d2e85f09..00000000
--- a/src/lib/sos/plugins/amd.py
+++ /dev/null
@@ -1,36 +0,0 @@
-## Copyright (C) 2007 Red Hat, Inc., Eugene Teo <eteo@redhat.com>
-
-### 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 sos.plugintools
-import os
-
-class amd(sos.plugintools.PluginBase):
- """Amd automounter information
- """
- def checkenabled(self):
- if self.isInstalled("am-utils") or os.path.exists("/etc/rc.d/init.d/amd"):
- return True
- return False
-
- def setup(self):
- self.addCopySpec("/etc/amd.*")
- self.addCopySpec("/etc/rc.d/init.d/amd")
- self.addCopySpec("/etc/sysconfig/amd")
- self.collectExtOutput("/bin/rpm -qV am-utils")
- self.collectExtOutput("/bin/egrep -e 'automount|pid.*nfs' /proc/mounts")
- self.collectExtOutput("/bin/mount | egrep -e 'automount|pid.*nfs'")
- return
-
diff --git a/src/lib/sos/plugins/anaconda.py b/src/lib/sos/plugins/anaconda.py
deleted file mode 100644
index 27132fb2..00000000
--- a/src/lib/sos/plugins/anaconda.py
+++ /dev/null
@@ -1,34 +0,0 @@
-### 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 sos.plugintools
-import os
-
-class anaconda(sos.plugintools.PluginBase):
- """Anaconda / Installation information
- """
- def checkenabled(self):
- if os.path.exists("/var/log/anaconda.log"):
- return True
- return False
-
- def setup(self):
- self.addCopySpec("/root/anaconda-ks.cfg")
- self.addCopySpec("/root/install.log")
- self.addCopySpec("/root/install.log.syslog")
- self.addCopySpec("/var/log/anaconda.log")
- self.addCopySpec("/var/log/anaconda.syslog")
- self.addCopySpec("/var/log/anaconda.xlog")
- return
-
diff --git a/src/lib/sos/plugins/apache.py b/src/lib/sos/plugins/apache.py
deleted file mode 100644
index bae93562..00000000
--- a/src/lib/sos/plugins/apache.py
+++ /dev/null
@@ -1,28 +0,0 @@
-### 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 sos.plugintools
-
-class apache(sos.plugintools.PluginBase):
- """Apache related information
- """
- optionList = [("log", "gathers all apache logs", "slow", False)]
-
- def setup(self):
- self.addCopySpec("/etc/httpd/conf/httpd.conf")
- self.addCopySpec("/etc/httpd/conf.d/*.conf")
- if self.getOption("log"):
- self.addCopySpec("/var/log/httpd/*")
- return
-
diff --git a/src/lib/sos/plugins/auditd.py b/src/lib/sos/plugins/auditd.py
deleted file mode 100644
index 7dd4cad8..00000000
--- a/src/lib/sos/plugins/auditd.py
+++ /dev/null
@@ -1,27 +0,0 @@
-### 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 sos.plugintools
-
-class auditd(sos.plugintools.PluginBase):
- """Auditd related information
- """
-
- optionList = [("syslogsize", "max size (MiB) to collect per syslog file", "", 15)]
-
- def setup(self):
- self.addCopySpec("/etc/audit/auditd.conf")
- self.addCopySpec("/etc/audit/audit.rules")
- self.addCopySpecLimit("/var/log/audit*", sizelimit = self.getOption("syslogsize"))
- return
diff --git a/src/lib/sos/plugins/autofs.py b/src/lib/sos/plugins/autofs.py
deleted file mode 100644
index bb7c6182..00000000
--- a/src/lib/sos/plugins/autofs.py
+++ /dev/null
@@ -1,61 +0,0 @@
-## Copyright (C) 2007 Red Hat, Inc., Adam Stokes <astokes@redhat.com>
-
-### 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 sos.plugintools
-import os, re
-
-class autofs(sos.plugintools.PluginBase):
- """autofs server-related information
- """
- def checkenabled(self):
- if self.policy().runlevelDefault() in self.policy().runlevelByService("autofs"):
- return True
- return False
-
- def checkdebug(self):
- """ testing if autofs debug has been enabled anywhere
- """
- # Global debugging
- optlist=[]
- opt = self.fileGrep(r"^(DEFAULT_LOGGING|DAEMONOPTIONS)=(.*)", "/etc/sysconfig/autofs")
- for opt1 in opt:
- for opt2 in opt1.split(" "):
- optlist.append(opt2)
- for dtest in optlist:
- if dtest == "--debug" or dtest == "debug":
- return True
-
- def getdaemondebug(self):
- """ capture daemon debug output
- """
- debugout = self.fileGrep(r"^(daemon.*)\s+(\/var\/log\/.*)", "/etc/sysconfig/autofs")
- for i in debugout:
- return i[1]
-
- def setup(self):
- self.addCopySpec("/etc/auto*")
- self.addCopySpec("/etc/sysconfig/autofs")
- self.addCopySpec("/etc/init.d/autofs")
- self.collectExtOutput("/bin/rpm -qV autofs")
- self.collectExtOutput("/etc/init.d/autofs status")
- self.collectExtOutput("ps auxwww | grep automount")
- self.collectExtOutput("/bin/egrep -e 'automount|pid.*nfs' /proc/mounts")
- self.collectExtOutput("/bin/mount | egrep -e 'automount|pid.*nfs'")
- self.collectExtOutput("/sbin/chkconfig --list autofs")
- if self.checkdebug():
- self.addCopySpec(self.getdaemondebug())
- return
-
diff --git a/src/lib/sos/plugins/bootloader.py b/src/lib/sos/plugins/bootloader.py
deleted file mode 100644
index 5eb811cd..00000000
--- a/src/lib/sos/plugins/bootloader.py
+++ /dev/null
@@ -1,32 +0,0 @@
-### 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 sos.plugintools
-
-class bootloader(sos.plugintools.PluginBase):
- """Bootloader information
- """
- def setup(self):
- self.addCopySpec("/etc/lilo.conf")
- self.addCopySpec("/etc/milo.conf")
- self.addCopySpec("/etc/silo.conf")
- self.addCopySpec("/boot/efi/efi/redhat/elilo.conf")
- self.addCopySpec("/boot/grub/grub.conf")
- self.addCopySpec("/boot/grub/device.map")
- self.addCopySpec("/boot/yaboot.conf")
-
- self.collectExtOutput("/sbin/lilo -q")
- self.collectExtOutput("/bin/ls -laR /boot")
- return
-
diff --git a/src/lib/sos/plugins/cluster.py b/src/lib/sos/plugins/cluster.py
deleted file mode 100644
index 2e531532..00000000
--- a/src/lib/sos/plugins/cluster.py
+++ /dev/null
@@ -1,299 +0,0 @@
-### 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 sos.plugintools
-import commands, os, re
-import time, libxml2
-import glob
-
-class cluster(sos.plugintools.PluginBase):
- """cluster suite and GFS related information
- """
-
- optionList = [("gfslockdump", 'gather output of gfs lockdumps', 'slow', False),
- ('lockdump', 'gather dlm lockdumps', 'slow', False)]
-
- def checkenabled(self):
- rhelver = self.policy().rhelVersion()
- if rhelver == 4:
- self.packages = [ "ccs", "cman", "cman-kernel", "magma", "magma-plugins",
- "rgmanager", "fence", "dlm", "dlm-kernel", "gulm",
- "GFS", "GFS-kernel", "lvm2-cluster" ]
- elif rhelver == 5:
- self.packages = [ "rgmanager", "luci", "ricci", "system-config-cluster",
- "gfs-utils", "gnbd", "kmod-gfs", "kmod-gnbd", "lvm2-cluster" ]
-
- self.files = [ "/etc/cluster/cluster.conf", "/proc/cluster" ]
- return sos.plugintools.PluginBase.checkenabled(self)
-
- def has_gfs(self):
- return (len(self.doRegexFindAll(r'^\S+\s+\S+\s+gfs\s+.*$', "/etc/mtab")) > 0)
-
- def diagnose(self):
- rhelver = self.policy().rhelVersion()
-
- # check if the minimum set of packages is installed
- # for RHEL4 RHCS(ccs, cman, cman-kernel, magma, magma-plugins, (dlm, dlm-kernel) || gulm, perl-Net-Telnet, rgmanager, fence)
- # RHEL4 GFS (GFS, GFS-kernel, ccs, lvm2-cluster, fence)
-
- pkgs_check = []
- mods_check = []
- serv_check = []
-
- if rhelver == 4:
- pkgs_check.extend( [ "ccs", "cman", "magma", "magma-plugins", "perl-Net-Telnet", "rgmanager", "fence" ] )
- mods_check.extend( [ "cman", "dlm" ] )
- if self.has_gfs():
- mods_check.append("gfs")
- serv_check.extend( [ "cman", "ccsd", "rgmanager", "fenced" ] )
- if self.has_gfs():
- serv_check.extend( ["gfs", "clvmd"] )
- elif rhelver == 5:
- pkgs_check.extend ( [ "cman", "perl-Net-Telnet", "rgmanager" ] )
- mods_check.extend( [ "dlm" ] )
- if self.has_gfs():
- mods_check.extend( ["gfs", "gfs2"] )
- serv_check.extend( [ "cman", "rgmanager" ] )
- if self.has_gfs():
- serv_check.extend( ["gfs", "clvmd"] )
-
- # check that kernel module packages are installed for
- # running kernel version
-
- for modname in mods_check:
- found = 0
-
- if self.policy().allPkgsByNameRegex( "^" + modname ):
- found = 1
-
- status, output = commands.getstatusoutput('/sbin/modinfo -F vermagic ' + modname)
-
- if status == 0:
- found = 2
-
- if len(self.fileGrep("^%s\s+" % modname, "/proc/modules")) > 0:
- found = 3
-
- if found == 0:
- self.addDiagnose("required kernel module is missing: %s" % modname)
- elif found == 1:
- self.addDiagnose("required module is not available for current kernel: %s" % modname)
- elif found == 2:
- self.addDiagnose("required module is available but not loaded: %s" % modname)
-
- for pkg in pkgs_check:
- if not self.isInstalled(pkg):
- self.addDiagnose("required package is missing: %s" % pkg)
-
- if rhelver == "4":
- # (dlm, dlm-kernel) || gulm
- if not ((self.isInstalled("dlm") and self.isInstalled("dlm-kernel")) or self.isInstalled("gulm")):
- self.addDiagnose("required packages are missing: (dlm, dlm-kernel) || gulm")
-
- # check if all the needed daemons are active at sosreport time
- # check if they are started at boot time in RHEL4 RHCS (cman, ccsd, rgmanager, fenced)
- # and GFS (gfs, ccsd, clvmd, fenced)
-
- for service in serv_check:
- status, output = commands.getstatusoutput("/sbin/service %s status &> /dev/null" % service)
- if status != 0:
- self.addDiagnose("service %s is not running" % service)
-
- if not self.policy().runlevelDefault() in self.policy().runlevelByService(service):
- self.addDiagnose("service %s is not started in default runlevel" % service)
-
- # FIXME: missing important cman services
- # FIXME: any cman service whose state != run ?
- # Fence Domain: "default" 2 2 run -
-
- # is cluster quorate
- if not self.is_cluster_quorate():
- self.addDiagnose("cluster node is not quorate")
-
- # if there is no cluster.conf, diagnose() finishes here.
- try:
- os.stat("/etc/cluster/cluster.conf")
- except:
- self.addDiagnose("/etc/cluster/cluster.conf is missing")
- return
-
- # setup XML xpath context
- xml = libxml2.parseFile("/etc/cluster/cluster.conf")
- xpathContext = xml.xpathNewContext()
-
- # make sure that the node names are valid according to RFC 2181
- for hostname in xpathContext.xpathEval('/cluster/clusternodes/clusternode/@name'):
- if not re.match('^[a-zA-Z]([a-zA-Z0-9-]*[a-zA-Z0-9])?(\.[a-zA-Z]([a-zA-Z0-9-]*[a-zA-Z0-9])?)*$', hostname.content):
- self.addDiagnose("node name (%s) contains invalid characters" % hostname.content)
-
- # do not rely on DNS to resolve node names, must have them in /etc/hosts
- for hostname in xpathContext.xpathEval('/cluster/clusternodes/clusternode/@name'):
- if len(self.fileGrep(r'^.*\W+%s' % hostname.content , "/etc/hosts")) == 0:
- self.addDiagnose("node %s is not defined in /etc/hosts" % hostname.content)
-
- # check fencing (warn on no fencing)
- if len(xpathContext.xpathEval("/cluster/clusternodes/clusternode[not(fence/method/device)]")):
- if self.has_gfs():
- self.addDiagnose("one or more nodes have no fencing agent configured: fencing is required for GFS to work")
- else:
- self.addDiagnose("one or more nodes have no fencing agent configured: the cluster infrastructure might not work as intended")
-
- # check fencing (warn on manual)
- if len(xpathContext.xpathEval("/cluster/clusternodes/clusternode[/cluster/fencedevices/fencedevice[@agent='fence_manual']/@name=fence/method/device/@name]")):
- self.addDiagnose("one or more nodes have manual fencing agent configured (data integrity is not guaranteed)")
-
- # if fence_ilo or fence_drac, make sure acpid is not running
- hostname = commands.getoutput("/bin/uname -n").split(".")[0]
- if len(xpathContext.xpathEval('/cluster/clusternodes/clusternode[@name = "%s" and /cluster/fencedevices/fencedevice[@agent="fence_rsa" or @agent="fence_drac"]/@name=fence/method/device/@name]' % hostname )):
- status, output = commands.getstatusoutput("/sbin/service acpid status")
- if status == 0 or self.policy().runlevelDefault() in self.policy().runlevelByService("acpid"):
- self.addDiagnose("acpid is enabled, this may cause problems with your fencing method.")
-
- # check for fs exported via nfs without nfsid attribute
- if len(xpathContext.xpathEval("/cluster/rm/service//fs[not(@fsid)]/nfsexport")):
- for xmlNode in xpathContext.xpathEval("/cluster/rm/service//fs[not(@fsid)]"):
- fsRefAttribute = xmlNode.xpathEval("@ref")
- if (len(fsRefAttribute) > 0) :
- fsRefName = fsRefAttribute[0].content
- if len(xpathContext.xpathEval("cluster/rm/resources/fs[@name='%s'][not(@fsid)]" % fsRefName)):
- self.addDiagnose("one or more nfs export do not have a fsid attribute set.")
- break
-
- # cluster.conf file version and the in-memory cluster configuration version matches
- status, cluster_version = commands.getstatusoutput("cman_tool status | grep 'Config version'")
- if not status: cluster_version = cluster_version[16:]
- else: cluster_version = None
- conf_version = xpathContext.xpathEval("/cluster/@config_version")[0].content
-
- if status == 0 and conf_version != cluster_version:
- self.addDiagnose("cluster.conf and in-memory configuration version differ (%s != %s)" % (conf_version, cluster_version) )
-
- status, output = commands.getstatusoutput("/usr/sbin/rg_test test /etc/cluster/cluster.conf")
- if output.find("Error: ") > 0:
- self.addDiagnose("configuration errors are present according to rg_test")
-
- # make sure the first part of the lock table matches the cluster name
- # and that the locking protocol is sane
- cluster_name = xpathContext.xpathEval("/cluster/@name")[0].content
-
- for fs in self.fileGrep(r'^[^#][/\w]*\W*[/\w]*\W*gfs', "/etc/fstab"):
- # for each gfs entry
- fs = fs.split()
- lockproto = self.get_gfs_sb_field(fs[0], "sb_lockproto")
- if lockproto and lockproto != self.get_locking_proto():
- self.addDiagnose("gfs mountpoint (%s) is using the wrong locking protocol (%s)" % (fs[0], lockproto) )
-
- locktable = self.get_gfs_sb_field(fs[0], "sb_locktable")
- try: locktable = locktable.split(":")[0]
- except: continue
- if locktable != cluster_name:
- self.addDiagnose("gfs mountpoint (%s) is using the wrong locking table" % fs[0])
-
- # Test fence groups for valid id and state
- self.test_fence_id()
-
- # Check for existence of weak-updates in gfs2 prior to 2.6.18-128
- if rhelver == 5:
- vermagic = commands.getoutput("modinfo -F vermagic gfs2")
- # just kernel release from vermagic line
- vermagic = vermagic.split()[0].lstrip('2.6.18-')
- vermagic = vermagic[:vermagic.find('.')]
- if int(vermagic) < 128:
- self.addDiagnose('GFS2 is being used via weak-updates, kmod-gfs2 should be uninstalled and system reboot' \
- 'to allow for kernel provided gfs2 module to be used.')
-
- def setup(self):
- self.collectExtOutput("/sbin/fdisk -l")
- self.addCopySpec("/etc/cluster.conf")
- self.addCopySpec("/etc/cluster.xml")
- self.addCopySpec("/etc/cluster")
- self.collectExtOutput("/usr/sbin/rg_test test /etc/cluster/cluster.conf")
- self.addCopySpec("/proc/cluster")
- self.collectExtOutput("cman_tool status")
- self.collectExtOutput("cman_tool services")
- self.collectExtOutput("cman_tool -af nodes")
- self.collectExtOutput("ccs_tool lsnode")
- self.collectExtOutput("openais-cfgtool -s")
- self.collectExtOutput("clustat")
-
- self.collectExtOutput("/sbin/ipvsadm -L")
-
- if self.getOption('gfslockdump'): self.do_gfslockdump()
- if self.getOption('lockdump'): self.do_lockdump()
-
- return
-
- def do_lockdump(self):
- status, output = commands.getstatusoutput("cman_tool services")
- if status:
- # command somehow failed
- return False
-
- rhelver = self.get_redhat_release()
-
- if rhelver == "4":
- regex = r'^DLM Lock Space:\s*"([^"]*)".*$'
- elif rhelver == "5Server" or rhelver == "5Client":
- regex = r'^dlm\s+[^\s]+\s+([^\s]+)\s.*$'
-
- reg=re.compile(regex,re.MULTILINE)
- for lockspace in reg.findall(output):
- commands.getstatusoutput("echo %s > /proc/cluster/dlm_locks" % lockspace)
- self.collectOutputNow("cat /proc/cluster/dlm_locks", root_symlink = "dlm_locks_%s" % lockspace)
-
- def get_locking_proto(self):
- # FIXME: what's the best way to find out ?
- return "lock_dlm"
- return "lock_gulm"
-
- def do_gfslockdump(self):
- for mntpoint in self.doRegexFindAll(r'^\S+\s+([^\s]+)\s+gfs\s+.*$', "/proc/mounts"):
- self.collectExtOutput("/sbin/gfs_tool lockdump %s" % mntpoint, root_symlink = "gfs_lockdump_" + self.mangleCommand(mntpoint) )
-
- def do_rgmanager_bt(self):
- # FIXME: threads backtrace via SIGALRM
- return
-
- def postproc(self):
- for cluster_conf in glob.glob("/etc/cluster/cluster.conf*"):
- self.doRegexSub(cluster_conf, r"(\s*\<fencedevice\s*.*\s*passwd\s*=\s*)\S+(\")", r"\1%s" %('"***"'))
- return
-
- def is_cluster_quorate(self):
- output = commands.getoutput("cman_tool status | grep '^Membership state: '")
- try:
- if output[18:] == "Cluster-Member":
- return True
- except:
- pass
- return False
-
- def get_gfs_sb_field(self, device, field):
- for line in commands.getoutput("/sbin/gfs_tool sb %s all" % device).split("\n"):
- if re.match('^\W*%s = ' % field, line):
- return line.split("=")[1].strip()
- return False
-
- # Diagnostic testing functions
- def test_fence_id(self):
- # resolves rhbz 499468 and 499472
- for line in commands.getoutput("/sbin/group_tool ls | grep -v '^\['").split("\n")[1:]:
- for a in line.split():
- # we can do this since fence id is a fix field
- if re.match('00000000', a):
- self.addDiagnose('Invalid fence id: %s' % (line,))
- if line.split()[-1] != 'none':
- self.addDiagnose("Possible incorrect state: %s, for group: %s" % (line.split()[-1], line))
- return
-
diff --git a/src/lib/sos/plugins/cobbler.py b/src/lib/sos/plugins/cobbler.py
deleted file mode 100644
index d35a0b8d..00000000
--- a/src/lib/sos/plugins/cobbler.py
+++ /dev/null
@@ -1,31 +0,0 @@
-### 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 sos.plugintools
-import os
-
-class cobbler(sos.plugintools.PluginBase):
- """cobbler related information
- """
- def checkenabled(self):
- if self.isInstalled("cobbler"):
- return True
- return False
-
- def setup(self):
- self.addCopySpec("/etc/cobbler")
- self.addCopySpec("/var/log/cobbler")
- self.addCopySpec("/var/lib/rhn/kickstarts")
- self.addCopySpec("/var/lib/cobbler")
- return
diff --git a/src/lib/sos/plugins/crontab.py b/src/lib/sos/plugins/crontab.py
deleted file mode 100644
index 8ad4c232..00000000
--- a/src/lib/sos/plugins/crontab.py
+++ /dev/null
@@ -1,27 +0,0 @@
-### 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 sos.plugintools
-import os
-
-class crontab(sos.plugintools.PluginBase):
- """Crontab information
- """
- def setup(self):
- self.addCopySpec("/etc/cron*")
- self.collectExtOutput("/usr/bin/crontab -l -u root", suggest_filename = "root_crontab")
- self.collectExtOutput("""for i in `ls /home/`;\
- do echo "User :" $i;/usr/bin/crontab -l -u $i;\
- echo "---------------";done""", suggest_filename = "users_crontabs")
- return
diff --git a/src/lib/sos/plugins/cs.py b/src/lib/sos/plugins/cs.py
deleted file mode 100644
index 7f642df9..00000000
--- a/src/lib/sos/plugins/cs.py
+++ /dev/null
@@ -1,50 +0,0 @@
-## Copyright (C) 2007 Red Hat, Inc., Kent Lamb <klamb@redhat.com>
-
-### 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 assumes default location of Certificate System 7.x on RHEL4
-# Certificate System 7.x is not supported on RHEL5.
-# Any improvemts for this plugin are appreciated. Please send them to
-# klamb@redhat.com
-# thanks,
-# kent lamb
-#############################################################
-
-
-import sos.plugintools
-import os
-
-class cs(sos.plugintools.PluginBase):
- """Certificate System 7.x Diagnostic Information
- """
- # check for default location of pki services (/var/lib.rhpki-*).
- # If default path exists, assume rhpki- glob and grap all installed
- # subsystems. If customer has a custom install path, then ln -s the
- # custom path to /var/lib/rhkpi-installed_subsystem (/var/lib/rhpki-ca,
- # /var/lib/rhpki-kra ect).
-
- def checkenabled(self):
- if self.isInstalled("rhpki-common") or os.path.exists("/var/lib/rhpki-*"):
- return True
- return False
-
- def setup(self):
- self.addCopySpec("/var/lib/rhpki-*/conf/*cfg*")
- self.addCopySpec("/var/lib/rhpki-*/conf/*.ldif")
- self.addCopySpec("/var/lib/rhpki-*/logs/*")
- return
-
-
diff --git a/src/lib/sos/plugins/devicemapper.py b/src/lib/sos/plugins/devicemapper.py
deleted file mode 100644
index d1795352..00000000
--- a/src/lib/sos/plugins/devicemapper.py
+++ /dev/null
@@ -1,66 +0,0 @@
-### 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 sos.plugintools
-import os
-from sos.helpers import sosGetCommandOutput
-
-class devicemapper(sos.plugintools.PluginBase):
- """device-mapper related information (dm, lvm, multipath)
- """
-
- optionList = [("lvmdump", 'collect raw metadata from PVs', 'slow', False)]
- dmraidOptions = ['V','b','r','s','tay','rD']
-
- def do_lvmdump(self):
- """Collects raw metadata directly from the PVs using dd
- """
- sosGetCommandOutput("lvmdump -d %s" % os.path.join(self.cInfo['dstroot'],"lvmdump"))
-
- def setup(self):
- self.collectExtOutput("/sbin/dmsetup info -c")
- self.collectExtOutput("/sbin/dmsetup table")
- self.collectExtOutput("/sbin/dmsetup status")
-
- self.collectExtOutput("/usr/sbin/vgdisplay -vv", root_symlink = "vgdisplay")
- self.collectExtOutput("/usr/sbin/vgscan -vvv")
- self.collectExtOutput("/usr/sbin/pvscan -v")
- self.collectExtOutput("/usr/sbin/lvs -a -o +devices")
- self.collectExtOutput("/usr/sbin/pvs -a -v")
- self.collectExtOutput("/usr/sbin/vgs -v")
- self.collectExtOutput("/sbin/mdadm -D /dev/md*")
-
- self.addCopySpec("/etc/lvm")
-
- self.addCopySpec("/etc/multipath.conf")
- self.addCopySpec("/var/lib/multipath/bindings")
- self.collectExtOutput("/sbin/multipath -v4 -ll")
-
- self.collectExtOutput("/usr/bin/systool -v -c -b scsi")
-
- self.collectExtOutput("/bin/ls -laR /dev")
- self.collectExtOutput("/bin/ls -laR /sys/block")
-
- if self.getOption('lvmdump'):
- self.do_lvmdump()
-
- if os.path.isdir("/sys/block"):
- for disk in os.listdir("/sys/block"):
- if disk in [ ".", ".." ] or disk.startswith("ram"):
- continue
- self.collectExtOutput("/usr/bin/udevinfo -ap /sys/block/%s" % (disk))
- for opt in self.dmraidOptions:
- self.collectExtOutput("/sbin/dmraid -%s" % (opt,))
-
- return
diff --git a/src/lib/sos/plugins/dhcp.py b/src/lib/sos/plugins/dhcp.py
deleted file mode 100644
index 872377cf..00000000
--- a/src/lib/sos/plugins/dhcp.py
+++ /dev/null
@@ -1,29 +0,0 @@
-### 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 sos.plugintools
-
-class dhcp(sos.plugintools.PluginBase):
- """DHCP related information
- """
- def checkenabled(self):
- self.files = ['/etc/rc.d/init.d/dhcpd']
- self.packages = ['dhcp']
- return sos.plugintools.PluginBase.checkenabled(self)
-
- def setup(self):
- self.addCopySpec("/etc/sysconfig/dhcrelay")
- self.addCopySpec("/etc/sysconfig/dhcpd")
- self.addCopySpec("/etc/dhcpd.conf")
- return
diff --git a/src/lib/sos/plugins/dovecot.py b/src/lib/sos/plugins/dovecot.py
deleted file mode 100644
index 553ff3e1..00000000
--- a/src/lib/sos/plugins/dovecot.py
+++ /dev/null
@@ -1,26 +0,0 @@
-### 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 sos.plugintools
-import os
-
-class dovecot(sos.plugintools.PluginBase):
- """dovecot server related information
- """
- def setup(self):
- if os.path.exists("/etc/dovecot.conf"):
- self.addCopySpec("/etc/dovecot*")
- self.collectExtOutput("/usr/sbin/dovecot -n")
- return
-
diff --git a/src/lib/sos/plugins/ds.py b/src/lib/sos/plugins/ds.py
deleted file mode 100644
index 6f24cb8c..00000000
--- a/src/lib/sos/plugins/ds.py
+++ /dev/null
@@ -1,50 +0,0 @@
-## Copyright (C) 2007 Red Hat, Inc., Kent Lamb <klamb@redhat.com>
-
-## 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 sos.plugintools
-import os
-
-class ds(sos.plugintools.PluginBase):
- """Directory Server information
- """
-
- def check_version(self):
- if self.isInstalled("redhat-ds-base") or \
- os.path.exists("/etc/dirsrv"):
- return "ds8"
- elif self.isInstalled("redhat-ds-7") or \
- os.path.exists("/opt/redhat-ds"):
- return "ds7"
- return False
-
- def checkenabled(self):
- if self.isInstalled("redhat-ds-base") or \
- os.path.exists("/etc/dirsrv"):
- return True
- elif self.isInstalled("redhat-ds-7") or \
- os.path.exists("/opt/redhat-ds"):
- return True
- return False
-
- def setup(self):
- if "ds8" in self.check_version():
- self.addCopySpec("/etc/dirsrv/slapd*")
- self.addCopySpec("/var/log/dirsrv/*")
- if "ds7" in self.check_version():
- self.addCopySpec("/opt/redhat-ds/slapd-*/config")
- self.addCopySpec("/opt/redhat-ds/slapd-*/logs")
- return
-
diff --git a/src/lib/sos/plugins/emc.py b/src/lib/sos/plugins/emc.py
deleted file mode 100644
index 16f039a8..00000000
--- a/src/lib/sos/plugins/emc.py
+++ /dev/null
@@ -1,218 +0,0 @@
-## emc.py
-## Captures EMC specific information during a sos run.
-
-## Copyright (C) 2008 EMC Corporation. Keith Kearnan <kearnan_keith@emc.com>
-
-### 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.
-
-import commands, sos.plugintools, os, sys
-
-class emc(sos.plugintools.PluginBase):
- """EMC related information (PowerPath, Solutions Enabler CLI and Navisphere CLI)
- """
-
- def about_emc(self):
- """ EMC Corporation specific information
- """
- self.addCustomText('<center><h1><font size="+4"color="blue">EMC&sup2;</font><font size="-2" color="blue">&reg;</font>')
- self.addCustomText('<br><font size="+1">where information lives</font><font size="-2">&reg;</font></h1>')
- self.addCustomText("EMC Corporation is the world's leading developer and provider of information ")
- self.addCustomText("infrastructure technology and solutions that enable organizations of all sizes to transform ")
- self.addCustomText("the way they compete and create value from their information. &nbsp;")
- self.addCustomText("Information about EMC's products and services can be found at ")
- self.addCustomText('<a href="http://www.EMC.com/">www.EMC.com</a>.</center>')
- return
-
- def get_pp_files(self):
- """ EMC PowerPath specific information - files
- """
- self.collectExtOutput("/sbin/powermt version")
- self.addCopySpec("/etc/init.d/PowerPath")
- self.addCopySpec("/etc/powermt.custom")
- self.addCopySpec("/etc/emcp_registration")
- self.addCopySpec("/etc/emc/mpaa.excluded")
- self.addCopySpec("/etc/emc/mpaa.lams")
- self.addCopySpec("/etc/emcp_devicesDB.dat")
- self.addCopySpec("/etc/emcp_devicesDB.idx")
- self.addCopySpec("/etc/emc/powerkmd.custom")
- self.addCopySpec("/etc/modprobe.conf.pp")
- return
-
- def get_pp_config(self):
- """ EMC PowerPath specific information - commands
- """
- self.collectExtOutput("/sbin/powermt display")
- self.collectExtOutput("/sbin/powermt display dev=all")
- self.collectExtOutput("/sbin/powermt check_registration")
- self.collectExtOutput("/sbin/powermt display options")
- self.collectExtOutput("/sbin/powermt display ports")
- self.collectExtOutput("/sbin/powermt display paths")
- self.collectExtOutput("/sbin/powermt dump")
- return
-
- def get_symcli_files(self):
- """ EMC Solutions Enabler SYMCLI specific information - files
- """
- self.addCopySpec("/var/symapi/db/symapi_db.bin")
- self.addCopySpec("/var/symapi/config/[a-z]*")
- self.addCopySpec("/var/symapi/log/[a-z]*")
- return
-
- def get_symcli_config(self):
- """ EMC Solutions Enabler SYMCLI specific information - Symmetrix/DMX - commands
- """
- self.collectExtOutput("/usr/symcli/bin/symcli -def")
- self.collectExtOutput("/usr/symcli/bin/symdg list")
- self.collectExtOutput("/usr/symcli/bin/symdg -v list")
- self.collectExtOutput("/usr/symcli/bin/symcg list")
- self.collectExtOutput("/usr/symcli/bin/symcg -v list")
- self.collectExtOutput("/usr/symcli/bin/symcfg list")
- self.collectExtOutput("/usr/symcli/bin/symcfg -v list")
- self.collectExtOutput("/usr/symcli/bin/symcfg -db")
- self.collectExtOutput("/usr/symcli/bin/symcfg -semaphores list")
- self.collectExtOutput("/usr/symcli/bin/symcfg -dir all -v list")
- self.collectExtOutput("/usr/symcli/bin/symcfg -connections list")
- self.collectExtOutput("/usr/symcli/bin/symcfg -app -v list")
- self.collectExtOutput("/usr/symcli/bin/symcfg -fa all -port list")
- self.collectExtOutput("/usr/symcli/bin/symcfg -ra all -port list")
- self.collectExtOutput("/usr/symcli/bin/symcfg -sa all -port list")
- self.collectExtOutput("/usr/symcli/bin/symcfg list -lock")
- self.collectExtOutput("/usr/symcli/bin/symcfg list -lockn all")
- self.collectExtOutput("/usr/symcli/bin/syminq")
- self.collectExtOutput("/usr/symcli/bin/syminq -v")
- self.collectExtOutput("/usr/symcli/bin/syminq -symmids")
- self.collectExtOutput("/usr/symcli/bin/syminq hba -fibre")
- self.collectExtOutput("/usr/symcli/bin/syminq hba -scsi")
- self.collectExtOutput("/usr/symcli/bin/symhost show -config")
- self.collectExtOutput("/usr/symcli/bin/stordaemon list")
- self.collectExtOutput("/usr/symcli/bin/stordaemon -v list")
- self.collectExtOutput("/usr/symcli/bin/sympd list")
- self.collectExtOutput("/usr/symcli/bin/sympd list -vcm")
- self.collectExtOutput("/usr/symcli/bin/symdev list")
- self.collectExtOutput("/usr/symcli/bin/symdev -v list")
- self.collectExtOutput("/usr/symcli/bin/symdev -rdfa list")
- self.collectExtOutput("/usr/symcli/bin/symdev -rdfa -v list")
- self.collectExtOutput("/usr/symcli/bin/symbcv list")
- self.collectExtOutput("/usr/symcli/bin/symbcv -v list")
- self.collectExtOutput("/usr/symcli/bin/symrdf list")
- self.collectExtOutput("/usr/symcli/bin/symrdf -v list")
- self.collectExtOutput("/usr/symcli/bin/symrdf -rdfa list")
- self.collectExtOutput("/usr/symcli/bin/symrdf -rdfa -v list")
- self.collectExtOutput("/usr/symcli/bin/symsnap list")
- self.collectExtOutput("/usr/symcli/bin/symsnap list -savedevs")
- self.collectExtOutput("/usr/symcli/bin/symclone list")
- self.collectExtOutput("/usr/symcli/bin/symevent list")
- self.collectExtOutput("/usr/symcli/bin/symmask list hba")
- self.collectExtOutput("/usr/symcli/bin/symmask list logins")
- self.collectExtOutput("/usr/symcli/bin/symmaskdb list database")
- self.collectExtOutput("/usr/symcli/bin/symmaskdb -v list database")
- return
-
- def get_navicli_config(self):
- """ EMC Navisphere Host Agent NAVICLI specific information - files
- """
- self.addCopySpec("/etc/Navisphere/agent.config")
- self.addCopySpec("/etc/Navisphere/Navimon.cfg")
- self.addCopySpec("/etc/Navisphere/Quietmode.cfg")
- self.addCopySpec("/etc/Navisphere/messages/[a-z]*")
- self.addCopySpec("/etc/Navisphere/log/[a-z]*")
- return
-
- def get_navicli_SP_info(self,SP_address):
- """ EMC Navisphere Host Agent NAVICLI specific information - CLARiiON - commands
- """
- self.collectExtOutput("/opt/Navisphere/bin/navicli -h %s getall" % SP_address)
- self.collectExtOutput("/opt/Navisphere/bin/navicli -h %s getsptime -spa" % SP_address)
- self.collectExtOutput("/opt/Navisphere/bin/navicli -h %s getsptime -spb" % SP_address)
- self.collectExtOutput("/opt/Navisphere/bin/navicli -h %s getlog" % SP_address)
- self.collectExtOutput("/opt/Navisphere/bin/navicli -h %s getdisk" % SP_address)
- self.collectExtOutput("/opt/Navisphere/bin/navicli -h %s getcache" % SP_address)
- self.collectExtOutput("/opt/Navisphere/bin/navicli -h %s getlun" % SP_address)
- self.collectExtOutput("/opt/Navisphere/bin/navicli -h %s getlun -rg -type -default -owner -crus -capacity" % SP_address)
- self.collectExtOutput("/opt/Navisphere/bin/navicli -h %s lunmapinfo" % SP_address)
- self.collectExtOutput("/opt/Navisphere/bin/navicli -h %s getcrus" % SP_address)
- self.collectExtOutput("/opt/Navisphere/bin/navicli -h %s port -list -all" % SP_address)
- self.collectExtOutput("/opt/Navisphere/bin/navicli -h %s storagegroup -list" % SP_address)
- self.collectExtOutput("/opt/Navisphere/bin/navicli -h %s spportspeed -get" % SP_address)
- return
-
- def setup(self):
- ## About EMC Corporation default no if no EMC products are installed
- add_about_emc="no"
-
- ## If PowerPath is installed collect PowerPath specific information
- emc_pp_installed = commands.getoutput("/bin/rpm -qa | /bin/grep -i EMCpower")
- if emc_pp_installed != "":
- print "EMC PowerPath is installed."
- print " Gathering EMC PowerPath information..."
- self.addCustomText("EMC PowerPath is installed.<br>")
- 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
- emc_symcli_installed = commands.getoutput("/bin/rpm -qa | /bin/grep -i symcli-symcli")
- if emc_symcli_installed != "":
- print "EMC Solutions Enabler SYMCLI is installed."
- print " Gathering EMC Solutions Enabler SYMCLI information..."
- self.addCustomText("EMC Solutions Enabler is installed.<br>")
- 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.addCustomText("EMC CLARiiON Navisphere Host Agent is installed.<br>")
- 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
- status, output = commands.getstatusoutput("/opt/Navisphere/bin/navicli -h %s getsptime" % ans)
- if status == 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()
- return
diff --git a/src/lib/sos/plugins/filesys.py b/src/lib/sos/plugins/filesys.py
deleted file mode 100644
index 79a34c59..00000000
--- a/src/lib/sos/plugins/filesys.py
+++ /dev/null
@@ -1,60 +0,0 @@
-### 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 sos.plugintools
-import os
-import re
-import commands
-
-class filesys(sos.plugintools.PluginBase):
- """information on filesystems
- """
- def setup(self):
- self.addCopySpec("/proc/filesystems")
- self.addCopySpec("/etc/fstab")
- self.addCopySpec("/proc/self/mounts")
- self.addCopySpec("/proc/mounts")
- self.addCopySpec("/proc/mdstat")
- self.addCopySpec("/etc/raidtab")
- mounts = self.collectOutputNow("/bin/mount -l", root_symlink = "mount")
- self.addCopySpec("/etc/mdadm.conf")
-
- self.collectExtOutput("/bin/df -al", root_symlink = "df")
- self.collectExtOutput("/usr/sbin/lsof -b +M -n -l", root_symlink = "lsof")
- self.collectExtOutput("/sbin/blkid")
-
- part_titlep = re.compile("^major")
- blankp = re.compile("^$")
- partlist = []
- devlist = []
- try:
- for line in open('/proc/partitions'):
- if((bool(part_titlep.match(line))) | (bool(blankp.match(line)))):
- continue
- partlist.append('/dev/' + line.split()[-1])
- except IOError:
- exit(1)
- for dev in partlist:
- hdparm = commands.getstatusoutput('/sbin/hdparm -g %s' %(dev))
- if(hdparm[0] == 0):
- start_geo = hdparm[1].strip().split("\n")[-1].strip().split()[-1]
- if(start_geo == "0"):
- devlist.append(dev)
- for i in devlist:
- self.collectExtOutput("/sbin/parted -s %s print" % (i))
-
- for extfs in self.doRegexFindAll(r"^(/dev/.+) on .+ type ext.\s+", mounts):
- self.collectExtOutput("/sbin/dumpe2fs %s" % (extfs))
- return
-
diff --git a/src/lib/sos/plugins/ftp.py b/src/lib/sos/plugins/ftp.py
deleted file mode 100644
index 5bed5667..00000000
--- a/src/lib/sos/plugins/ftp.py
+++ /dev/null
@@ -1,30 +0,0 @@
-### 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 sos.plugintools
-import os
-
-class ftp(sos.plugintools.PluginBase):
- """FTP server related information
- """
- def checkenabled(self):
- if self.isInstalled("vsftpd") or os.path.exists("/etc/vsftpd"):
- return True
- return False
-
- def setup(self):
- self.addCopySpec("/etc/ftp*")
- self.addCopySpec("/etc/vsftpd")
- return
-
diff --git a/src/lib/sos/plugins/gdm.py b/src/lib/sos/plugins/gdm.py
deleted file mode 100644
index bf75ea33..00000000
--- a/src/lib/sos/plugins/gdm.py
+++ /dev/null
@@ -1,22 +0,0 @@
-### 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 sos.plugintools
-
-class gdm(sos.plugintools.PluginBase):
- """gdm related information
- """
- def setup(self):
- self.addCopySpec("/etc/gdm/*")
- return
diff --git a/src/lib/sos/plugins/general.py b/src/lib/sos/plugins/general.py
deleted file mode 100644
index 2f6a8e7b..00000000
--- a/src/lib/sos/plugins/general.py
+++ /dev/null
@@ -1,59 +0,0 @@
-### 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 sos.plugintools
-import glob
-import commands
-
-class general(sos.plugintools.PluginBase):
- """basic system information
- """
-
- optionList = [("syslogsize", "max size (MiB) to collect per syslog file", "", 15),
- ("all_logs", "collect all log files defined in syslog.conf", "", False)]
-
- def setup(self):
- self.addCopySpec("/etc/redhat-release")
- self.addCopySpec("/etc/fedora-release")
- self.addCopySpec("/etc/inittab")
- self.addCopySpec("/etc/sos.conf")
- self.addCopySpec("/etc/sysconfig")
- self.addCopySpec("/proc/stat")
- # Capture dmesg from system start
- self.addCopySpec("/var/log/dmesg")
- # Capture second dmesg from time of sos run
- self.collectExtOutput("/bin/dmesg", suggest_filename="dmesg_now")
- self.addCopySpecLimit("/var/log/messages*", sizelimit = self.getOption("syslogsize"))
- self.addCopySpecLimit("/var/log/secure*", sizelimit = self.getOption("syslogsize"))
- self.addCopySpec("/var/log/sa")
- self.addCopySpec("/var/log/pm/suspend.log")
- self.addCopySpec("/var/log/up2date")
- self.addCopySpec("/etc/exports")
- self.collectExtOutput("/bin/hostname", root_symlink = "hostname")
- self.collectExtOutput("/bin/date", root_symlink = "date")
- self.collectExtOutput("/usr/bin/uptime", root_symlink = "uptime")
-
- if self.getOption('all_logs'):
- rhelver = self.policy().rhelVersion()
- if rhelver == 5 or rhelver == 4:
- logs=self.doRegexFindAll(r"^\S+\s+(\/.*log.*)\s+$", "/etc/syslog.conf")
- for i in logs:
- if not os.path.isfile(i): continue
- self.addCopySpec(i)
- return
-
- def postproc(self):
- self.doRegexSub("/etc/sysconfig/rhn/up2date", r"(\s*proxyPassword\s*=\s*)\S+", r"\1***")
- return
diff --git a/src/lib/sos/plugins/hardware.py b/src/lib/sos/plugins/hardware.py
deleted file mode 100644
index 7b99e063..00000000
--- a/src/lib/sos/plugins/hardware.py
+++ /dev/null
@@ -1,52 +0,0 @@
-### 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 sos.plugintools
-
-class hardware(sos.plugintools.PluginBase):
- """hardware related information
- """
- def setup(self):
- self.addCopySpec("/proc/partitions")
- self.addCopySpec("/proc/cpuinfo")
- self.addCopySpec("/proc/meminfo")
- self.addCopySpec("/proc/ioports")
- self.addCopySpec("/proc/interrupts")
- self.addCopySpec("/proc/scsi")
- self.addCopySpec("/proc/dma")
- self.addCopySpec("/proc/devices")
- self.addCopySpec("/proc/rtc")
- self.addCopySpec("/proc/ide")
- self.addCopySpec("/proc/bus")
- self.addCopySpec("/etc/stinit.def")
- self.addCopySpec("/etc/sysconfig/hwconf")
- self.addCopySpec("/proc/chandev")
- self.addCopySpec("/proc/dasd")
- self.addCopySpec("/proc/s390dbf/tape")
- self.addCopySpec("/sys/bus/scsi")
- self.addCopySpec("/sys/state")
- self.collectExtOutput("/usr/share/rhn/up2date_client/hardware.py")
- self.collectExtOutput("""/bin/echo -e "lspci:\n" ; /sbin/lspci ; /bin/echo -e "\nlspci -nvv:\n" ; /sbin/lspci -nvv ; /bin/echo -e "\nlspci -tv:\n" ; /sbin/lspci -tv""", suggest_filename = "lspci", root_symlink = "lspci")
-
- self.collectExtOutput("/usr/sbin/dmidecode", root_symlink = "dmidecode")
-
- if self.policy().getArch().endswith("386"):
- self.collectExtOutput("/usr/sbin/x86info -a")
-
- self.collectExtOutput("/sbin/lsusb")
- self.collectExtOutput("/usr/bin/lshal")
- self.collectExtOutput("/usr/bin/systool -c fc_host -v")
- self.collectExtOutput("/usr/bin/systool -c scsi_host -v")
- return
-
diff --git a/src/lib/sos/plugins/hts.py b/src/lib/sos/plugins/hts.py
deleted file mode 100644
index 4d5cf652..00000000
--- a/src/lib/sos/plugins/hts.py
+++ /dev/null
@@ -1,23 +0,0 @@
-### 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 sos.plugintools
-
-class hts(sos.plugintools.PluginBase):
- """Red Hat Hardware Test Suite related information
- """
- def setup(self):
- self.addCopySpec("/etc/httpd/conf.d/hts.conf")
- self.addCopySpec("/var/hts")
- return
diff --git a/src/lib/sos/plugins/i18n.py b/src/lib/sos/plugins/i18n.py
deleted file mode 100644
index 0a793d0f..00000000
--- a/src/lib/sos/plugins/i18n.py
+++ /dev/null
@@ -1,26 +0,0 @@
-### 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 sos.plugintools
-import os
-
-class i18n(sos.plugintools.PluginBase):
- """i18n related information
- """
- def setup(self):
- self.addCopySpec("/etc/sysconfig/i18n")
- self.addCopySpec("/etc/X11/xinit/xinput.d/*")
- self.collectExtOutput("/usr/bin/locale")
- return
-
diff --git a/src/lib/sos/plugins/initrd.py b/src/lib/sos/plugins/initrd.py
deleted file mode 100644
index 7bd7e1f3..00000000
--- a/src/lib/sos/plugins/initrd.py
+++ /dev/null
@@ -1,28 +0,0 @@
-### 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 sos.plugintools
-import glob
-
-class initrd(sos.plugintools.PluginBase):
- """initrd related information
- """
- def setup(self):
- for initrd in glob.glob('/boot/initrd-*.img'):
- self.collectExtOutput("/bin/zcat "+initrd+" | /bin/cpio "+
- "--extract --to-stdout init" )
- return
-
- def defaultenabled(self):
- return False
diff --git a/src/lib/sos/plugins/ipa.py b/src/lib/sos/plugins/ipa.py
deleted file mode 100644
index 2c6ca9b6..00000000
--- a/src/lib/sos/plugins/ipa.py
+++ /dev/null
@@ -1,37 +0,0 @@
-## Copyright (C) 2007 Red Hat, Inc., Kent Lamb <klamb@redhat.com>
-
-## 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 sos.plugintools
-import os
-
-class ipa(sos.plugintools.PluginBase):
- """IPA diagnostic information
- """
- # ntp and dirserver stuff are covered in existing sos plugins, so we really only
- # need to get kerberos and ipa specific addons.
-
- def checkenabled(self):
- if self.isInstalled("ipa-server") or os.path.exists("/etc/ipa"):
- return True
- return False
-
- def setup(self):
- self.addCopySpec("/etc/dirsrv/ds.keytab")
- self.addCopySpec("/etc/ipa/ipa.conf")
- self.addCopySpec("/etc/krb5.conf")
- self.addCopySpec("/etc/krb5.keytab")
- return
-
diff --git a/src/lib/sos/plugins/ipsec.py b/src/lib/sos/plugins/ipsec.py
deleted file mode 100644
index 87671b87..00000000
--- a/src/lib/sos/plugins/ipsec.py
+++ /dev/null
@@ -1,30 +0,0 @@
-## Copyright (C) 2007 Sadique Puthen <sputhenp@redhat.com>
-
-### 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 sos.plugintools
-from os.path import exists
-
-class ipsec(sos.plugintools.PluginBase):
- """ipsec related information
- """
- def checkenabled(self):
- if self.isInstalled("ipsec-tools") or exists("/etc/racoon/racoon.conf"):
- return True
- return False
-
- def setup(self):
- self.addCopySpec("/etc/racoon")
- return
diff --git a/src/lib/sos/plugins/iscsi.py b/src/lib/sos/plugins/iscsi.py
deleted file mode 100644
index 1b4ce67d..00000000
--- a/src/lib/sos/plugins/iscsi.py
+++ /dev/null
@@ -1,24 +0,0 @@
-### 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 sos.plugintools
-
-class iscsi(sos.plugintools.PluginBase):
- """iscsi-initiator related information
- """
- def setup(self):
- self.addCopySpec("/etc/iscsi/iscsid.conf")
- self.addCopySpec("/etc/iscsi/initiatorname.iscsi")
- self.addCopySpec("/var/lib/iscsi")
- return
diff --git a/src/lib/sos/plugins/kdump.py b/src/lib/sos/plugins/kdump.py
deleted file mode 100644
index d9f248a4..00000000
--- a/src/lib/sos/plugins/kdump.py
+++ /dev/null
@@ -1,31 +0,0 @@
-### 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 sos.plugintools
-from os.path import exists
-
-class kdump(sos.plugintools.PluginBase):
- """Kdump related information
- """
- def checkenabled(self):
- if self.isInstalled("kexec-tools") or exists("/etc/kdump.conf"):
- return True
- return False
-
- def setup(self):
- self.addCopySpec("/etc/kdump.conf")
- self.addCopySpec("/etc/sysconfig/kdump")
- self.addCopySpec("/proc/cmdline")
- self.addCopySpec("/etc/udev/rules.d/*kexec.rules")
- return
diff --git a/src/lib/sos/plugins/kernel.py b/src/lib/sos/plugins/kernel.py
deleted file mode 100644
index 3e928244..00000000
--- a/src/lib/sos/plugins/kernel.py
+++ /dev/null
@@ -1,116 +0,0 @@
-### 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 sos.plugintools
-import commands, os, re
-
-class kernel(sos.plugintools.PluginBase):
- """kernel related information
- """
- optionList = [("modinfo", 'gathers information on all kernel modules', 'fast', True)]
- moduleFile = ""
- taintList = [
- {'regex':'mvfs*', 'description':'Clearcase module'},
- {'regex':'vnode*', 'description':'Clearcase module'},
- {'regex':'vxfs*', 'description':'Veritas file system module'},
- {'regex':'vxportal*', 'description':'Veritas module'},
- {'regex':'vxdmp*', 'description':'Veritas dynamic multipathing module'},
- {'regex':'vxio*', 'description':'Veritas module'},
- {'regex':'vxspec*', 'description':'Veritas module'},
- {'regex':'dcd*', 'description':'Dell OpenManage Server Administrator module'},
- {'regex':'ocfs', 'description':'Oracle cluster filesystem module'},
- {'regex':'oracle*', 'description':'Oracle module'},
- {'regex':'vmnet*', 'description':'VMware module'},
- {'regex':'vmmon*', 'description':'VMware module'},
- {'regex':'egenera*', 'description':'Egenera module'},
- {'regex':'emcp*', 'description':'EMC module'},
- {'regex':'ocfs*', 'description':'OCFS module'},
- {'regex':'nvidia', 'description':'NVidia module'},
- {'regex':'ati-', 'description':'ATI module'}
- ]
-
- def setup(self):
- self.collectExtOutput("/bin/uname -a", root_symlink = "uname")
- self.moduleFile = self.collectOutputNow("/sbin/lsmod", root_symlink = "lsmod")
-
- if self.getOption('modinfo'):
- runcmd = ""
- for kmod in commands.getoutput('/sbin/lsmod | /bin/cut -f1 -d" " 2>/dev/null | /bin/grep -v Module 2>/dev/null').split('\n'):
- if '' != kmod.strip():
- runcmd = runcmd + " " + kmod
- if len(runcmd):
- self.collectExtOutput("/sbin/modinfo " + runcmd)
-
- self.collectExtOutput("/sbin/sysctl -a")
- self.collectExtOutput("/sbin/ksyms")
- self.addCopySpec("/sys/module/*/parameters")
- self.addCopySpec("/proc/filesystems")
- self.addCopySpec("/proc/ksyms")
- self.addCopySpec("/proc/slabinfo")
- self.addCopySpec("/lib/modules/%s/modules.dep" % self.policy().kernelVersion())
- self.addCopySpec("/etc/conf.modules")
- self.addCopySpec("/etc/modules.conf")
- self.addCopySpec("/etc/modprobe.conf")
- self.collectExtOutput("/usr/sbin/dkms status")
- self.addCopySpec("/proc/cmdline")
- self.addCopySpec("/proc/driver")
- self.addCopySpec("/proc/zoneinfo")
- self.addCopySpec("/proc/sys/kernel/tainted")
- self.addCopySpec("/proc/buddyinfo")
-
- return
-
- def diagnose(self):
-
- infd = open("/proc/modules", "r")
- for modname in infd.readlines():
- modname=modname.split(" ")[0]
- modinfo_srcver = commands.getoutput("/sbin/modinfo -F srcversion %s" % modname)
- if not os.access("/sys/module/%s/srcversion" % modname, os.R_OK):
- continue
- infd = open("/sys/module/%s/srcversion" % modname, "r")
- sys_srcver = infd.read().strip("\n")
- infd.close()
- if modinfo_srcver != sys_srcver:
- self.addDiagnose("loaded module %s differs from the one present on the file-system" % modname)
-
- # this would be a good moment to check the module's signature
- # but at the moment there's no easy way to do that outside of
- # the kernel. i will probably need to write a C lib (derived from
- # the kernel sources to do this verification.
-
- infd.close()
-
- def analyze(self):
-
- savedtaint = os.path.join(self.cInfo['dstroot'], "/proc/sys/kernel/tainted")
- infd = open(savedtaint, "r")
- line = infd.read()
- infd.close()
- line = line.strip()
- if (line != "0"):
- self.addAlert("Kernel taint flag is <%s>\n" % line)
-
- infd = open(self.moduleFile, "r")
- modules = infd.readlines()
- infd.close()
-
- for tainter in self.taintList:
- p = re.compile(tainter['regex'])
- for line in modules:
- if p.match(line) != None:
- # found a taint match, create an alert
- moduleName = line.split()[0]
- self.addAlert("Check for tainted kernel by module %s, which is %s" % (moduleName, tainter['description']))
- return
diff --git a/src/lib/sos/plugins/kvm.py b/src/lib/sos/plugins/kvm.py
deleted file mode 100644
index 6e737166..00000000
--- a/src/lib/sos/plugins/kvm.py
+++ /dev/null
@@ -1,48 +0,0 @@
-## Copyright (C) 2009 Red Hat, Inc., Joey Boggs <jboggs@redhat.com>
-
-### 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 sos.plugintools
-import os
-
-class kvm(sos.plugintools.PluginBase):
- """KVM related information
- """
-
- def checkenabled(self):
- if os.access("/sys/module/kvm", os.R_OK):
- return True
- return False
-
- def setup(self):
- if not os.path.ismount("/sys/kernel/debug"):
- self._debugfs_cleanup = True
- os.popen("mount -t debugfs debugfs /sys/kernel/debug")
- else:
- self._debugfs_cleanup = False
- self.addCopySpec("/sys/module/kvm/srcversion")
- self.addCopySpec("/sys/module/kvm_intel/srcversion")
- self.addCopySpec("/sys/module/kvm_amd/srcversion")
- self.addCopySpec("/sys/module/ksm/srcversion")
- self.collectExtOutput("/usr/bin/top -b -d 1 -n 5")
- self.collectExtOutput("/usr/bin/kvm_stat --once")
- return
-
- def postproc(self):
- if self._debugfs_cleanup and os.path.ismount("/sys/kernel/debug"):
- os.popen("umount /sys/kernel/debug")
- return
-
diff --git a/src/lib/sos/plugins/ldap.py b/src/lib/sos/plugins/ldap.py
deleted file mode 100644
index b1a48420..00000000
--- a/src/lib/sos/plugins/ldap.py
+++ /dev/null
@@ -1,50 +0,0 @@
-### 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 sos.plugintools
-import os
-
-class ldap(sos.plugintools.PluginBase):
- """LDAP related information
- """
- def checkenabled(self):
- self.packages = [ "openldap" ]
- self.files = [ "/etc/openldap/ldap.conf" ]
- return sos.plugintools.PluginBase.checkenabled(self)
-
- def get_ldap_opts(self):
- # capture /etc/openldap/ldap.conf options in dict
- # FIXME: possibly not hardcode these options in?
- ldapopts=["URI","BASE","TLS_CACERTDIR"]
- results={}
- tmplist=[]
- for i in ldapopts:
- t=self.doRegexFindAll(r"^(%s)\s+(.*)" % i,"/etc/openldap/ldap.conf")
- for x in t:
- results[x[0]]=x[1].rstrip("\n")
- return results
-
- def diagnose(self):
- # Validate ldap client options
- ldapopts=self.get_ldap_opts()
- if ldapopts.has_key("TLS_CACERTDIR") and not os.path.exists(ldapopts["TLS_CACERTDIR"]):
- self.addDiagnose("%s does not exist and can cause connection issues involving TLS" % ldapopts["TLS_CACERTDIR"])
-
- def setup(self):
- self.addCopySpec("/etc/ldap.conf")
- self.addCopySpec("/etc/openldap")
-
- def postproc(self):
- self.doRegexSub("/etc/ldap.conf", r"(\s*bindpw\s*)\S+", r"\1***")
- return
diff --git a/src/lib/sos/plugins/libraries.py b/src/lib/sos/plugins/libraries.py
deleted file mode 100644
index 80108869..00000000
--- a/src/lib/sos/plugins/libraries.py
+++ /dev/null
@@ -1,26 +0,0 @@
-### 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 sos.plugintools
-
-class libraries(sos.plugintools.PluginBase):
- """information on shared libraries
- """
- def setup(self):
- self.addCopySpec("/etc/ld.so.conf")
- self.addCopySpec("/etc/ld.so.conf.d")
- self.collectExtOutput("/sbin/ldconfig -v")
- self.collectExtOutput("/sbin/ldconfig -p")
- return
-
diff --git a/src/lib/sos/plugins/logrotate.py b/src/lib/sos/plugins/logrotate.py
deleted file mode 100644
index f3195d0e..00000000
--- a/src/lib/sos/plugins/logrotate.py
+++ /dev/null
@@ -1,27 +0,0 @@
-### 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 sos.plugintools
-
-class logrotate(sos.plugintools.PluginBase):
- """logrotate configuration files and debug info
- """
-
- def setup(self):
- self.collectExtOutput("/usr/sbin/logrotate --debug /etc/logrotate.conf",
- suggest_filename = "logrotate_debug")
- self.collectExtOutput("/bin/cat /var/lib/logrotate.status",
- suggest_filename = "logrotate_status")
- self.addCopySpec("/etc/logrotate*")
- return
diff --git a/src/lib/sos/plugins/lsbrelease.py b/src/lib/sos/plugins/lsbrelease.py
deleted file mode 100644
index 78a83577..00000000
--- a/src/lib/sos/plugins/lsbrelease.py
+++ /dev/null
@@ -1,30 +0,0 @@
-### 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 sos.plugintools
-import os
-
-class lsbrelease(sos.plugintools.PluginBase):
- """Linux Standard Base information
- """
- def diagnose(self):
- if not os.path.exists("/etc/redhat-release"):
- self.addDiagnose("/etc/redhat-release missing")
- return
- def setup(self):
- self.collectExtOutput("/usr/bin/lsb_release -a")
- self.collectExtOutput("/usr/bin/lsb_release -d", suggest_filename = "lsb_release", root_symlink = "lsb-release")
- self.addCopySpec("/etc/lsb-release*")
- return
diff --git a/src/lib/sos/plugins/memory.py b/src/lib/sos/plugins/memory.py
deleted file mode 100644
index 7fbe39c3..00000000
--- a/src/lib/sos/plugins/memory.py
+++ /dev/null
@@ -1,30 +0,0 @@
-### 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 sos.plugintools
-
-class memory(sos.plugintools.PluginBase):
- """memory usage information
- """
- def setup(self):
- self.addCopySpec("/proc/pci")
- self.addCopySpec("/proc/meminfo")
- self.addCopySpec("/proc/vmstat")
- self.addCopySpec("/proc/slabinfo")
-
- self.collectExtOutput("/bin/dmesg | grep -e 'e820.' -e 'aperature.'")
- self.collectExtOutput("/usr/bin/free", root_symlink = "free")
- self.collectExtOutput("/usr/bin/free -m")
- return
-
diff --git a/src/lib/sos/plugins/mrggrid.py b/src/lib/sos/plugins/mrggrid.py
deleted file mode 100644
index 2b39ab17..00000000
--- a/src/lib/sos/plugins/mrggrid.py
+++ /dev/null
@@ -1,23 +0,0 @@
-### 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 sos.plugintools
-
-class mrggrid(sos.plugintools.PluginBase):
- """MRG GRID related information
- """
- def setup(self):
- self.addCopySpec("/etc/condor/condor_config")
- self.addCopySpec("/usr/bin/condor_status")
- return
diff --git a/src/lib/sos/plugins/mrgmessg.py b/src/lib/sos/plugins/mrgmessg.py
deleted file mode 100644
index 481083ad..00000000
--- a/src/lib/sos/plugins/mrgmessg.py
+++ /dev/null
@@ -1,24 +0,0 @@
-### 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 sos.plugintools
-
-class mrgmessg(sos.plugintools.PluginBase):
- """MRG Messaging related information
- """
- def setup(self):
- self.addCopySpec("/etc/qpidd.conf")
- self.addCopySpec("/etc/sasl2/qpidd.conf")
- self.addCopySpec("/var/rhm")
- return
diff --git a/src/lib/sos/plugins/mysql.py b/src/lib/sos/plugins/mysql.py
deleted file mode 100644
index 3f8dc2bd..00000000
--- a/src/lib/sos/plugins/mysql.py
+++ /dev/null
@@ -1,32 +0,0 @@
-### 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 sos.plugintools
-import os
-
-class mysql(sos.plugintools.PluginBase):
- """MySQL related information
- """
- def checkenabled(self):
- if self.cInfo["policy"].pkgByName("mysql-server") or os.path.exists("/etc/my.cnf") or \
- self.cInfo["policy"].pkgByName("mysql"):
- return True
- return False
-
- def setup(self):
- self.addCopySpec("/etc/my.cnf")
- self.addCopySpec("/etc/sysconfig/network")
- self.addCopySpec("/etc/ld.so.conf.d/mysql*")
- self.addCopySpec("/var/log/mysql*")
- return
diff --git a/src/lib/sos/plugins/named.py b/src/lib/sos/plugins/named.py
deleted file mode 100644
index 1dddb8b7..00000000
--- a/src/lib/sos/plugins/named.py
+++ /dev/null
@@ -1,44 +0,0 @@
-### 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 sos.plugintools
-import commands
-from os.path import normpath, join, exists
-
-class named(sos.plugintools.PluginBase):
- """named related information
- """
- def checkenabled(self):
- self.files = [ "/etc/named.conf",
- "/etc/sysconfig/named" ]
- self.packages = [ "bind" ]
- return sos.plugintools.PluginBase.checkenabled(self)
-
- def getDnsDir(self, configFile):
- """ grab directory path from named{conf,boot}
- """
- directoryList = self.doRegexFindAll("directory\s\"(.*)\"", configFile)
- return normpath(directoryList[0])
-
- def setup(self):
- cfgFiles = ("/etc/named.conf",
- "/etc/named.boot")
- for cfg in cfgFiles:
- if exists(cfg):
- self.addCopySpec(cfg)
- self.addCopySpec(self.getDnsDir(cfg))
- self.addForbiddenPath(join(self.getDnsDir(cfg),"chroot/dev"))
- self.addForbiddenPath(join(self.getDnsDir(cfg),"chroot/proc"))
- self.addCopySpec("/etc/sysconfig/named")
- return
diff --git a/src/lib/sos/plugins/netdump.py b/src/lib/sos/plugins/netdump.py
deleted file mode 100644
index d57431b8..00000000
--- a/src/lib/sos/plugins/netdump.py
+++ /dev/null
@@ -1,28 +0,0 @@
-### 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 sos.plugintools
-from os.path import exists
-
-class netdump(sos.plugintools.PluginBase):
- """Netdump Configuration Information
- """
- def checkenabled(self):
- if self.isInstalled("netdump") or exists("/etc/sysconfig/netdump*"):
- return True
- return False
-
- def setup(self):
- self.addCopySpec("/etc/sysconfig/netdump")
- return
diff --git a/src/lib/sos/plugins/networking.py b/src/lib/sos/plugins/networking.py
deleted file mode 100644
index e3d6f98a..00000000
--- a/src/lib/sos/plugins/networking.py
+++ /dev/null
@@ -1,78 +0,0 @@
-### 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 sos.plugintools
-import os,re,commands
-
-class networking(sos.plugintools.PluginBase):
- """network related information
- """
- optionList = [("traceroute", "collects a traceroute to rhn.redhat.com", "slow", False)]
-
- def get_interface_name(self,ifconfigFile):
- """Return a dictionary for which key are interface name according to the
- output of ifconifg-a stored in ifconfigFile.
- """
- out=self.doRegexFindAll(r"^(eth\d+)\D", ifconfigFile)
- return out
-
- def collectIPTable(self,tablename):
- """ When running the iptables command, it unfortunately auto-loads
- the modules before trying to get output. Some people explicitly
- don't want this, so check if the modules are loaded before running
- the command. If they aren't loaded, there can't possibly be any
- relevant rules in that table """
-
- cmd = "/sbin/iptables -t "+tablename+" -nvL"
-
- (status, output) = commands.getstatusoutput("/sbin/lsmod | grep -q "+tablename)
- if status == 0:
- self.collectExtOutput(cmd)
- else:
- self.writeTextToCommand(cmd,"IPTables module "+tablename+" not loaded\n")
-
- def setup(self):
- self.addCopySpec("/proc/net")
- self.addCopySpec("/etc/nsswitch.conf")
- self.addCopySpec("/etc/yp.conf")
- self.addCopySpec("/etc/inetd.conf")
- self.addCopySpec("/etc/xinetd.conf")
- self.addCopySpec("/etc/xinetd.d")
- self.addCopySpec("/etc/host*")
- self.addCopySpec("/etc/resolv.conf")
- ifconfigFile=self.collectOutputNow("/sbin/ifconfig -a", root_symlink = "ifconfig")
- self.collectExtOutput("/sbin/route -n", root_symlink = "route")
- self.collectIPTable("filter")
- self.collectIPTable("nat")
- self.collectIPTable("mangle")
- self.collectExtOutput("/bin/netstat -s")
- self.collectExtOutput("/bin/netstat -agn")
- self.collectExtOutput("/bin/netstat -neopa", root_symlink = "netstat")
- self.collectExtOutput("/sbin/ip route show table all")
- self.collectExtOutput("/sbin/ip link")
- self.collectExtOutput("/sbin/ip address")
- self.collectExtOutput("/sbin/ifenslave -a")
- self.collectExtOutput("/sbin/ip mroute show")
- self.collectExtOutput("/sbin/ip maddr show")
- if ifconfigFile:
- for eth in self.get_interface_name(ifconfigFile):
- self.collectExtOutput("/sbin/ethtool "+eth)
- self.collectExtOutput("/sbin/ethtool -i "+eth)
- self.collectExtOutput("/sbin/ethtool -k "+eth)
- self.collectExtOutput("/sbin/ethtool -S "+eth)
- if self.getOption("traceroute"):
- self.collectExtOutput("/bin/traceroute -n rhn.redhat.com")
-
- return
-
diff --git a/src/lib/sos/plugins/nfsserver.py b/src/lib/sos/plugins/nfsserver.py
deleted file mode 100644
index 53391463..00000000
--- a/src/lib/sos/plugins/nfsserver.py
+++ /dev/null
@@ -1,44 +0,0 @@
-## Copyright (C) 2007 Red Hat, Inc., Eugene Teo <eteo@redhat.com>
-
-### 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 sos.plugintools
-import os
-from stat import ST_SIZE
-
-class nfsserver(sos.plugintools.PluginBase):
- """NFS server-related information
- """
- def checkenabled(self):
- if self.policy().runlevelDefault() in self.policy().runlevelByService("nfs"):
- return True
-
- try:
- if os.stat("/etc/exports")[ST_SIZE] > 0 or os.stat("/var/lib/nfs/xtab")[ST_SIZE] > 0:
- return True
- except:
- pass
-
- return False
-
- def setup(self):
- self.addCopySpec("/etc/exports")
- self.addCopySpec("/var/lib/nfs/etab")
- self.addCopySpec("/var/lib/nfs/xtab")
- self.addCopySpec("/var/lib/nfs/rmtab")
- self.collectExtOutput("/usr/sbin/rpcinfo -p localhost")
- self.collectExtOutput("/usr/sbin/nfsstat -a")
- return
-
diff --git a/src/lib/sos/plugins/nscd.py b/src/lib/sos/plugins/nscd.py
deleted file mode 100644
index c79afe73..00000000
--- a/src/lib/sos/plugins/nscd.py
+++ /dev/null
@@ -1,43 +0,0 @@
-## Copyright (C) 2007 Shijoe George <spanjikk@redhat.com>
-
-### 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 sos.plugintools
-from os.path import exists
-
-class nscd(sos.plugintools.PluginBase):
- """NSCD related information
- """
-
- optionList = [("nscdlogsize", "max size (MiB) to collect per nscd log file",
- "", 50)]
-
- def checkenabled(self):
- if self.cInfo["policy"].pkgByName("nscd") or exists("/etc/nscd.conf"):
- return True
- return False
-
- def setup(self):
- self.addCopySpec("/etc/nscd.conf")
-
- opt = self.fileGrep(r"^\s*logfile", "/etc/nscd.conf")
- if (len(opt) > 0):
- for o in opt:
- f = o.split()
- self.addCopySpecLimit(f[1],
- sizelimit = self.isOptionEnabled("nscdlogsize"))
-
- return
-
diff --git a/src/lib/sos/plugins/ntp.py b/src/lib/sos/plugins/ntp.py
deleted file mode 100644
index 76be368b..00000000
--- a/src/lib/sos/plugins/ntp.py
+++ /dev/null
@@ -1,23 +0,0 @@
-### 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 sos.plugintools
-
-class ntp(sos.plugintools.PluginBase):
- """NTP related information
- """
- def setup(self):
- self.collectExtOutput("/usr/bin/ntpstat")
- self.collectExtOutput("/usr/sbin/ntptrace")
- return
diff --git a/src/lib/sos/plugins/oddjob.py b/src/lib/sos/plugins/oddjob.py
deleted file mode 100644
index 13e3049a..00000000
--- a/src/lib/sos/plugins/oddjob.py
+++ /dev/null
@@ -1,31 +0,0 @@
-## Copyright (C) 2007 Sadique Puthen <sputhenp@redhat.com>
-
-### 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 sos.plugintools
-import os
-
-class oddjob(sos.plugintools.PluginBase):
- """oddjob related information
- """
- def checkenabled(self):
- if self.cInfo["policy"].pkgByName("oddjob") or os.path.exists("/etc/oddjobd.conf"):
- return True
- return False
-
- def setup(self):
- self.addCopySpec("/etc/oddjobd.conf")
- self.addCopySpec("/etc/oddjobd.conf.d")
- self.addCopySpec("/etc/dbus-1/system.d/oddjob.conf")
diff --git a/src/lib/sos/plugins/openais.py b/src/lib/sos/plugins/openais.py
deleted file mode 100644
index 140572a2..00000000
--- a/src/lib/sos/plugins/openais.py
+++ /dev/null
@@ -1,39 +0,0 @@
-### 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 sos.plugintools
-import os
-
-class openais(sos.plugintools.PluginBase):
- """openais related information
- """
- def checkenabled(self):
- if self.isInstalled("openais") or os.path.exists("/usr/sbin/openais-confdb-display"):
- openais_ver = commands.getoutput("rpm -q --queryformat='%{VERSION}' openais")
- v, r, m = openais_ver.split('.')
- if int(r) >= 80 and int(m) >= 6:
- return True
- return False
-
- openais_config_opts = [('totem','token'), ('totem','consensus'),
- ('totem','token_retransmits_before_loss_const'),
- ('cman','quorum_dev_poll'), ('cman','expected_votes'),
- ('cman','two_node')]
-
- def setup(self):
- self.collectExtOutput("openais-confdb-display")
- for item in self.openais_config_opts:
- obj, opt = item
- self.collectExtOutput("openais-confdb-display %s %s" % (obj, opt))
- return
diff --git a/src/lib/sos/plugins/openssl.py b/src/lib/sos/plugins/openssl.py
deleted file mode 100644
index 6d799904..00000000
--- a/src/lib/sos/plugins/openssl.py
+++ /dev/null
@@ -1,29 +0,0 @@
-## Copyright (C) 2007 Sadique Puthen <sputhenp@redhat.com>
-
-### 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 sos.plugintools
-import os
-
-class openssl(sos.plugintools.PluginBase):
- """openssl related information
- """
- def checkenabled(self):
- if self.cInfo["policy"].pkgByName("openssl") or os.path.exists("/etc/pki/tls/openssl.cnf"):
- return True
- return False
-
- def setup(self):
- self.addCopySpec("/etc/pki/tls/openssl.cnf")
diff --git a/src/lib/sos/plugins/openswan.py b/src/lib/sos/plugins/openswan.py
deleted file mode 100644
index 4c119807..00000000
--- a/src/lib/sos/plugins/openswan.py
+++ /dev/null
@@ -1,32 +0,0 @@
-## Copyright (C) 2007 Sadique Puthen <sputhenp@redhat.com>
-
-### 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 sos.plugintools
-import os
-
-class openswan(sos.plugintools.PluginBase):
- """ipsec related information
- """
- def checkenabled(self):
- if self.isInstalled("openswan") or os.path.exists("/etc/ipsec.conf"):
- return True
- return False
-
- def setup(self):
- self.addCopySpec("/etc/ipsec.conf")
- self.addCopySpec("/etc/ipsec.d")
- self.collectExtOutput("/usr/sbin/ipsec verify")
- self.collectExtOutput("/usr/sbin/ipsec barf")
diff --git a/src/lib/sos/plugins/pam.py b/src/lib/sos/plugins/pam.py
deleted file mode 100644
index 1a50811b..00000000
--- a/src/lib/sos/plugins/pam.py
+++ /dev/null
@@ -1,25 +0,0 @@
-### 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 sos.plugintools
-
-class pam(sos.plugintools.PluginBase):
- """PAM related information
- """
- def setup(self):
- self.addCopySpec("/etc/pam.d")
- self.addCopySpec("/etc/security")
- self.collectExtOutput("/bin/ls -laF /lib/security")
- return
-
diff --git a/src/lib/sos/plugins/postfix.py b/src/lib/sos/plugins/postfix.py
deleted file mode 100644
index 9ab78b2a..00000000
--- a/src/lib/sos/plugins/postfix.py
+++ /dev/null
@@ -1,32 +0,0 @@
-### 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 sos.plugintools
-from os.path import exists
-
-class postfix(sos.plugintools.PluginBase):
- """mail server related information
- """
- def checkenabled(self):
- if self.isInstalled("postfix") or exists("/etc/rc.d/init.d/postfix"):
- return True
- return False
-
- def setup(self):
- self.addCopySpec("/etc/mail")
- self.addCopySpec("/etc/postfix/main.cf")
- self.addCopySpec("/etc/postfix/master.cf")
- self.collectExtOutput("/usr/sbin/postconf")
- return
-
diff --git a/src/lib/sos/plugins/ppp.py b/src/lib/sos/plugins/ppp.py
deleted file mode 100644
index a60517e2..00000000
--- a/src/lib/sos/plugins/ppp.py
+++ /dev/null
@@ -1,32 +0,0 @@
-## Copyright (C) 2007 Sadique Puthen <sputhenp@redhat.com>
-
-### 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 sos.plugintools
-import os
-
-class ppp(sos.plugintools.PluginBase):
- """ppp, wvdial and rp-pppoe related information
- """
- def checkenabled(self):
- if self.cInfo["policy"].pkgByName("ppp") or os.path.exists("/etc/wvdial.conf"):
- return True
- return False
-
- def setup(self):
- self.addCopySpec("/etc/wvdial.conf")
- self.addCopySpec("/etc/ppp")
- self.addCopySpec("/var/log/ppp")
- self.collectExtOutput("/usr/sbin/adsl-status")
diff --git a/src/lib/sos/plugins/printing.py b/src/lib/sos/plugins/printing.py
deleted file mode 100644
index 47ba6494..00000000
--- a/src/lib/sos/plugins/printing.py
+++ /dev/null
@@ -1,30 +0,0 @@
-### 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 sos.plugintools
-
-class printing(sos.plugintools.PluginBase):
- """printing related information (cups)
- """
- def setup(self):
- self.addCopySpec("/etc/cups/*.conf")
- self.addCopySpec("/var/log/cups")
- self.addCopySpec("/etc/cups/lpoptions")
- self.addCopySpec("/etc/cups/ppd/*.ppd")
- self.collectExtOutput("/usr/bin/lpstat -t")
- self.collectExtOutput("/usr/bin/lpstat -s")
- self.collectExtOutput("/usr/bin/lpstat -d")
-
- return
-
diff --git a/src/lib/sos/plugins/process.py b/src/lib/sos/plugins/process.py
deleted file mode 100644
index 0d89e06b..00000000
--- a/src/lib/sos/plugins/process.py
+++ /dev/null
@@ -1,63 +0,0 @@
-### 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 sos.plugintools
-import commands
-import time
-import os
-
-class process(sos.plugintools.PluginBase):
- """process information
- """
- def setup(self):
- self.collectExtOutput("/bin/ps auxwww", root_symlink = "ps")
- self.collectExtOutput("/bin/ps auxwwwm")
- self.collectExtOutput("/bin/ps alxwww")
- self.collectExtOutput("/usr/bin/pstree", root_symlink = "pstree")
- self.collectExtOutput("/usr/sbin/lsof -b +M -n -l", root_symlink = "lsof")
- return
-
- def find_mountpoint(s):
- if (os.path.ismount(s) or len(s)==0): return s
- else: return mountpoint(os.path.split(s)[0])
-
- def diagnose(self):
- # check that no process is in state D
- dpids = []
- status, output = commands.getstatusoutput("/bin/ps -A -o state,pid --no-heading")
- if not status:
- for line in output.split("\n"):
- line = line.split()
- if line[0] == "D":
- # keep an eye on the process to see if the stat changes
- for inc in range(1,10):
- try:
- if len(self.fileGrep("^State: D", " /proc/%d/status" % int(line[1]))) == 0:
- # status is not D, good. let's get out of the loop.
- time.sleep(0.1 * inc)
- continue
- except IOError:
- # this should never happen...
- pass
- else:
- # still D after 0.1 * range(1,5) seconds
- dpids.append(int(line[1]))
-
- if len(dpids):
- self.addDiagnose("one or more processes are in state D (sosreport might hang)")
-
- return
-
-
-
diff --git a/src/lib/sos/plugins/psacct.py b/src/lib/sos/plugins/psacct.py
deleted file mode 100644
index 68e2585e..00000000
--- a/src/lib/sos/plugins/psacct.py
+++ /dev/null
@@ -1,22 +0,0 @@
-### 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 sos.plugintools
-
-class psacct(sos.plugintools.PluginBase):
- """Process accounting related information
- """
- def setup(self):
- self.addCopySpec("/var/account")
- return
diff --git a/src/lib/sos/plugins/pxe.py b/src/lib/sos/plugins/pxe.py
deleted file mode 100644
index 81e581c6..00000000
--- a/src/lib/sos/plugins/pxe.py
+++ /dev/null
@@ -1,34 +0,0 @@
-### 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 sos.plugintools
-import os
-
-class pxe(sos.plugintools.PluginBase):
- """PXE related information
- """
-
- optionList = [("tftpboot", 'gathers content in /tftpboot', 'slow', False)]
-
- def checkenabled(self):
- if self.cInfo["policy"].pkgByName("system-config-netboot-cmd") or os.path.exists("/usr/sbin/pxeos"):
- return True
- return False
-
- def setup(self):
- self.collectExtOutput("/usr/sbin/pxeos -l")
- self.addCopySpec("/etc/dhcpd.conf")
- if self.getOption("tftpboot"):
- self.addCopySpec("/tftpboot")
- return
diff --git a/src/lib/sos/plugins/quagga.py b/src/lib/sos/plugins/quagga.py
deleted file mode 100644
index 8e51497a..00000000
--- a/src/lib/sos/plugins/quagga.py
+++ /dev/null
@@ -1,30 +0,0 @@
-## Copyright (C) 2007 Ranjith Rajaram <rrajaram@redhat.com>
-
-### 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 sos.plugintools
-from os.path import exists
-
-class quagga(sos.plugintools.PluginBase):
- """quagga related information
- """
- def checkenabled(self):
- if self.cInfo["policy"].pkgByName("quagga") or exists("/etc/quagga/zebra.conf"):
- return True
- return False
-
- def setup(self):
- self.addCopySpec("/etc/quagga/")
- return
diff --git a/src/lib/sos/plugins/radius.py b/src/lib/sos/plugins/radius.py
deleted file mode 100644
index b5015c71..00000000
--- a/src/lib/sos/plugins/radius.py
+++ /dev/null
@@ -1,36 +0,0 @@
-## Copyright (C) 2007 Navid Sheikhol-Eslami <navid@redhat.com>
-
-### 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 sos.plugintools
-import os
-
-class radius(sos.plugintools.PluginBase):
- """radius related information
- """
- def checkenabled(self):
- if self.isInstalled("freeradius") or os.path.exists("/etc/raddb"):
- return True
- return False
-
- def setup(self):
- self.addCopySpec("/etc/raddb")
- self.addCopySpec("/etc/pam.d/radiusd")
- self.addCopySpec("/var/log/radius")
- return
-
- def postproc(self):
- self.doRegexSub("/etc/raddb/sql.conf", r"(\s*password\s*=\s*)\S+", r"\1***")
- return
diff --git a/src/lib/sos/plugins/rhn.py b/src/lib/sos/plugins/rhn.py
deleted file mode 100644
index efad65bd..00000000
--- a/src/lib/sos/plugins/rhn.py
+++ /dev/null
@@ -1,89 +0,0 @@
-### 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 sos.plugintools
-
-class rhn(sos.plugintools.PluginBase):
- """RHN Satellite related information
- """
- satellite = False
- proxy = False
-
- optionList = [("log", 'gathers all apache logs', 'slow', False)]
-
- def defaultenabled(self):
- return False
-
- def checkenabled(self):
- # enable if any related package is installed
-
- self.satellite = self.isInstalled("rhns-satellite-tools")
- self.proxy = self.isInstalled("rhns-proxy-tools")
-
- if self.satellite or self.proxy:
- return True
-
- return False
-
- def setup(self):
- self.addCopySpec("/etc/httpd/conf*")
- self.addCopySpec("/etc/rhn")
- self.addCopySpec("/etc/sysconfig/rhn")
- if self.getOption("log"):
- self.addCopySpec("/var/log/httpd") # httpd-logs
- self.addCopySpec("/var/log/rhn*") # rhn-logs
-
- # all these used to go in $DIR/mon-logs/
- self.addCopySpec("/opt/notification/var/*.log*")
- self.addCopySpec("/var/tmp/ack_handler.log*")
- self.addCopySpec("/var/tmp/enqueue.log*")
-
- # monitoring scout logs
- self.addCopySpec("/home/nocpulse/var/*.log*")
- self.addCopySpec("/home/nocpulse/var/commands/*.log*")
- self.addCopySpec("/var/tmp/ack_handler.log*")
- self.addCopySpec("/var/tmp/enqueue.log*")
- self.addCopySpec("/var/log/nocpulse/*.log*")
- self.addCopySpec("/var/log/notification/*.log*")
- self.addCopySpec("/var/log/nocpulse/TSDBLocalQueue/TSDBLocalQueue.log")
-
- self.addCopySpec("/root/ssl-build")
- self.collectExtOutput("rpm -qa --last", root_symlink = "rpm-manifest")
- self.collectExtOutput("/usr/bin/rhn-schema-version", root_symlink = "database-schema-version")
- self.collectExtOutput("/usr/bin/rhn-charsets", root_symlink = "database-character-sets")
-
- if self.satellite:
- self.addCopySpec("/etc/tnsnames.ora")
- self.addCopySpec("/etc/jabberd")
-
- # tomcat (4.x and newer satellites only)
- if not self.policy().pkgNVRA(satellite)[1].startswith("3."):
- self.addCopySpec("/etc/tomcat5")
- self.addCopySpec("/var/log/tomcat5")
-
- self.addCopySpec("/etc/tomcat5")
- self.addCopySpec("/var/log/tomcat5")
-
- if self.proxy:
- # copying configuration information
- self.addCopySpec("/etc/squid")
-
- # copying logs
- self.addCopySpec("/var/log/squid")
-
- return
-
-# def diagnose(self):
- # RHN Proxy:
- # * /etc/sysconfig/rhn/systemid is owned by root.apache with the permissions 0640
diff --git a/src/lib/sos/plugins/rpm.py b/src/lib/sos/plugins/rpm.py
deleted file mode 100644
index 361a7db7..00000000
--- a/src/lib/sos/plugins/rpm.py
+++ /dev/null
@@ -1,33 +0,0 @@
-### 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 sos.plugintools
-
-class rpm(sos.plugintools.PluginBase):
- """RPM information
- """
- optionList = [("rpmq", "queries for package information via rpm -q", "fast", True),
- ("rpmva", "runs a verify on all packages", "slow", False)]
-
- def setup(self):
- self.addCopySpec("/var/log/rpmpkgs")
-
- if self.getOption("rpmq"):
- self.collectExtOutput("/bin/rpm -qa --qf=\"%{NAME}-%{VERSION}-%{RELEASE}-%{ARCH}~~%{INSTALLTIME:date}\n\"|/bin/awk -F ~~ '{printf \"%-60s%s\\n\",$1,$2}'", root_symlink = "installed-rpms")
-
- if self.getOption("rpmva"):
- self.eta_weight += 1500 # this plugins takes 200x longer (for ETA)
- self.collectExtOutput("/bin/rpm -Va", root_symlink = "rpm-Va", timeout = 3600)
- return
-
diff --git a/src/lib/sos/plugins/s390.py b/src/lib/sos/plugins/s390.py
deleted file mode 100644
index 96a6ba8d..00000000
--- a/src/lib/sos/plugins/s390.py
+++ /dev/null
@@ -1,74 +0,0 @@
-## Copyright (C) 2007 Red Hat, Inc., Justin Payne <jpayne@redhat.com>
-
-### 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 commands
-import glob
-import os
-import sos.plugintools
-
-class s390(sos.plugintools.PluginBase):
- """s390 related information
- """
-
- ### Check for s390 arch goes here
-
- def checkenabled(self):
- sysArch = self.policy().getArch()
- if "s390" in sysArch:
- return True
- return False
-
- ### Gather s390 specific information
-
- def setup(self):
- self.addCopySpec("/proc/cio_ignore")
- self.addCopySpec("/proc/crypto")
- self.addCopySpec("/proc/dasd/devices")
- self.addCopySpec("/proc/dasd/statistics")
- self.addCopySpec("/proc/misc")
- self.addCopySpec("/proc/qeth")
- self.addCopySpec("/proc/qeth_perf")
- self.addCopySpec("/proc/qeth_ipa_takeover")
- self.addCopySpec("/proc/sys/appldata/*")
- self.addCopySpec("/proc/sys/kernel/hz_timer")
- self.addCopySpec("/proc/sysinfo")
- self.addCopySpec("/sys/bus/ccwgroup/drivers/qeth/0.*/*")
- self.addCopySpec("/sys/bus/ccw/drivers/zfcp/0.*/*")
- self.addCopySpec("/sys/bus/ccw/drivers/zfcp/0.*/0x*/*")
- self.addCopySpec("/sys/bus/ccw/drivers/zfcp/0.*/0x*/0x*/*")
- self.addCopySpec("/etc/zipl.conf")
- self.addCopySpec("/etc/zfcp.conf")
- self.addCopySpec("/etc/sysconfig/dumpconf")
- self.addCopySpec("/etc/src_vipa.conf")
- self.addCopySpec("/etc/ccwgroup.conf")
- self.addCopySpec("/etc/chandev.conf")
- self.collectExtOutput("/sbin/lscss")
- self.collectExtOutput("/sbin/lsdasd")
- self.collectExtOutput("/sbin/lstape")
- self.collectExtOutput("find /sys -type f")
- self.collectExtOutput("find /proc/s390dbf -type f")
- self.collectExtOutput("/sbin/qethconf list_all")
- dasdDev = commands.getoutput("ls /dev/dasd?")
- for x in dasdDev.split('\n'):
- self.collectExtOutput("/sbin/dasdview -x -i -j -l -f %s" % (x,))
- self.collectExtOutput("/sbin/fdasd -p %s" % (x,))
- try:
- rhelver = self.policy().pkgByName("redhat-release")[1]
- except:
- rhelver = None
- if rhelver.startswith("5"):
- self.collectExtOutput("/sbin/lsqeth")
- self.collectExtOutput("/sbin/lszfcp")
diff --git a/src/lib/sos/plugins/samba.py b/src/lib/sos/plugins/samba.py
deleted file mode 100644
index 1e33758b..00000000
--- a/src/lib/sos/plugins/samba.py
+++ /dev/null
@@ -1,29 +0,0 @@
-### 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 sos.plugintools
-
-class samba(sos.plugintools.PluginBase):
- """Samba related information
- """
- def setup(self):
- self.addCopySpec("/etc/samba")
- self.addCopySpec("/var/log/samba/*")
- self.addCopySpec("/etc/krb5.conf")
- self.addCopySpec("/etc/krb5.keytab")
- self.collectExtOutput("/usr/bin/wbinfo -g")
- self.collectExtOutput("/usr/bin/wbinfo -u")
- self.collectExtOutput("/usr/bin/testparm -s -v")
- return
-
diff --git a/src/lib/sos/plugins/sanitize.py b/src/lib/sos/plugins/sanitize.py
deleted file mode 100644
index 00c883ee..00000000
--- a/src/lib/sos/plugins/sanitize.py
+++ /dev/null
@@ -1,41 +0,0 @@
-### 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 sos.plugintools
-import glob
-import socket
-
-class sanitize(sos.plugintools.PluginBase):
- """ sanitize specified log files, etc
- """
- def defaultenabled(self):
- # disabled by default b/c still a work in progress
- return False
-
- def setup(self):
- # sanitize ip's, hostnames in logs
- hostname = socket.gethostname()
- rhelver = self.policy().rhelVersion()
- if rhelver == 5 or rhelver == 4:
- logs=self.doRegexFindAll(r"^\S+\s+(\/.*log.*)\s+$", "/etc/syslog.conf")
- else:
- logs=self.doRegexFindAll(r"^\S+\s+(\/.*log.*)\s+$", "/etc/rsyslog.conf")
- for log in logs:
- self.addCopySpec(log)
-
- def postproc(self):
- self.doRegexSub('/var/log/messages', r"^\s+(%s)" % (hostname,), r"\1sanitized-hostname")
- self.doRegexSub('/var/log/messages', r"([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})", r"\1sanitized-ip")
-
diff --git a/src/lib/sos/plugins/sar.py b/src/lib/sos/plugins/sar.py
deleted file mode 100644
index 9a3b3c92..00000000
--- a/src/lib/sos/plugins/sar.py
+++ /dev/null
@@ -1,37 +0,0 @@
-### 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 sos.plugintools
-import os
-
-class sar(sos.plugintools.PluginBase):
- """Generate the sar file from /var/log/sa/saXX files
- """
- def setup(self):
- path="/var/log/sa"
- dirList=os.listdir(path)
- # 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:3] != 'r':
- sar_filename = 'sar' + fname[2:4]
- if sar_filename not in dirList:
- sar_command = "/bin/sh -c \"LANG=C /usr/bin/sar -A -f /var/log/sa/" + fname + "\""
- self.collectOutputNow(sar_command, sar_filename, root_symlink=sar_filename)
- return
-
- def checkenabled(self):
- if os.path.exists("/var/log/sa") and os.path.exists("/usr/bin/sar"):
- return True
- return False
-
diff --git a/src/lib/sos/plugins/selinux.py b/src/lib/sos/plugins/selinux.py
deleted file mode 100644
index 7aaa6755..00000000
--- a/src/lib/sos/plugins/selinux.py
+++ /dev/null
@@ -1,51 +0,0 @@
-### 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 sos.plugintools
-import commands
-
-class selinux(sos.plugintools.PluginBase):
- """selinux related information
- """
- optionList = [("fixfiles", 'Print incorrect file context labels', 'slow', False)]
- def setup(self):
- # sestatus is always collected in checkenabled()
- self.addCopySpec("/etc/selinux")
- self.collectExtOutput("/usr/bin/selinuxconfig")
- self.eta_weight += 240 # this plugins takes 240x longer (for ETA)
- if self.getOption('fixfiles'):
- self.collectExtOutput("/sbin/fixfiles check")
- self.addForbiddenPath("/etc/selinux/targeted")
-
- return
-
- def checkenabled(self):
- # is selinux enabled ?
- try:
- if self.collectOutputNow("/usr/sbin/sestatus", root_symlink = "sestatus").split(":")[1].strip() == "disabled":
- return False
- except:
- pass
- return True
-
- def analyze(self):
- # Check for SELinux denials and capture raw output from sealert
- if self.policy().runlevelDefault() in self.policy().runlevelByService("setroubleshoot"):
- # TODO: fixup regex for more precise matching
- sealert=doRegexFindAll(r"^.*setroubleshoot:.*(sealert\s-l\s.*)","/var/log/messages")
- if sealert:
- for i in sealert:
- self.collectExtOutput("%s" % i)
- self.addAlert("There are numerous selinux errors present and "+
- "possible fixes stated in the sealert output.")
diff --git a/src/lib/sos/plugins/sendmail.py b/src/lib/sos/plugins/sendmail.py
deleted file mode 100644
index 56ea2e7a..00000000
--- a/src/lib/sos/plugins/sendmail.py
+++ /dev/null
@@ -1,32 +0,0 @@
-## Copyright (C) 2007 Red Hat, Inc., Eugene Teo <eteo@redhat.com>
-
-### 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 sos.plugintools
-import os
-
-class sendmail(sos.plugintools.PluginBase):
- """sendmail information
- """
- def checkenabled(self):
- if self.isInstalled("sendmail") or os.path.exists("/etc/rc.d/init.d/sendmail"):
- return True
- return False
-
- def setup(self):
- self.addCopySpec("/etc/mail/*")
- self.addCopySpec("/var/log/maillog")
- return
-
diff --git a/src/lib/sos/plugins/smartcard.py b/src/lib/sos/plugins/smartcard.py
deleted file mode 100644
index 1ce57bac..00000000
--- a/src/lib/sos/plugins/smartcard.py
+++ /dev/null
@@ -1,36 +0,0 @@
-## Copyright (C) 2007 Sadique Puthen <sputhenp@redhat.com>
-
-### 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 sos.plugintools
-import os
-
-class smartcard(sos.plugintools.PluginBase):
- """Smart Card related information
- """
-
- def checkenabled(self):
- if self.isInstalled("pam_pkcs11") or os.path.exists("/etc/pam_pkcs11/pam_pkcs11.conf"):
- return True
- return False
-
- def setup(self):
- self.addCopySpec("/etc/reader.conf")
- self.addCopySpec("/etc/reader.conf.d/")
- self.addCopySpec("/etc/pam_pkcs11/")
- self.collectExtOutput("/usr/bin/pkcs11_inspect debug")
- self.collectExtOutput("/usr/bin/pklogin_finder debug")
- self.collectExtOutput("/bin/ls -l /usr/lib/pam_pkcs11/")
- return
diff --git a/src/lib/sos/plugins/snmp.py b/src/lib/sos/plugins/snmp.py
deleted file mode 100644
index c9be4b2f..00000000
--- a/src/lib/sos/plugins/snmp.py
+++ /dev/null
@@ -1,31 +0,0 @@
-## Copyright (C) 2007 Sadique Puthen <sputhenp@redhat.com>
-
-### 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 sos.plugintools
-import os
-
-class snmp(sos.plugintools.PluginBase):
- """snmp related information
- """
- def checkenabled(self):
- if self.cInfo["policy"].pkgByName("net-snmp") or os.path.exists("/etc/snmp/snmpd.conf"):
- return True
- return False
-
- def setup(self):
- self.addCopySpec("/etc/snmp")
- return
-
diff --git a/src/lib/sos/plugins/soundcard.py b/src/lib/sos/plugins/soundcard.py
deleted file mode 100644
index bc94bb4a..00000000
--- a/src/lib/sos/plugins/soundcard.py
+++ /dev/null
@@ -1,30 +0,0 @@
-### 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 sos.plugintools
-import os
-
-class soundcard(sos.plugintools.PluginBase):
- """ Sound card information
- """
- def setup(self):
- self.addCopySpec("/proc/asound/*")
- self.addCopySpec("/etc/alsa/*")
- self.addCopySpec("/etc/asound.*")
- self.collectExtOutput("/sbin/lspci | grep -i audio")
- self.collectExtOutput("/usr/bin/aplay -l")
- self.collectExtOutput("/usr/bin/aplay -L")
- self.collectExtOutput("/usr/bin/amixer")
- self.collectExtOutput("/sbin/lsmod | /bin/grep snd | /bin/awk '{print $1}'", suggest_filename = "sndmodules_loaded")
- return
diff --git a/src/lib/sos/plugins/squid.py b/src/lib/sos/plugins/squid.py
deleted file mode 100644
index 3e9b3d8b..00000000
--- a/src/lib/sos/plugins/squid.py
+++ /dev/null
@@ -1,29 +0,0 @@
-### 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 sos.plugintools
-import os
-
-class squid(sos.plugintools.PluginBase):
- """squid related information
- """
- def checkenabled(self):
- self.files = [ "/etc/squid/squid.conf" ]
- self.packages = [ "squid" ]
- return sos.plugintools.PluginBase.checkenabled(self)
-
- def setup(self):
- self.addCopySpec("/etc/squid/squid.conf")
- return
-
diff --git a/src/lib/sos/plugins/ssh.py b/src/lib/sos/plugins/ssh.py
deleted file mode 100644
index 6352583b..00000000
--- a/src/lib/sos/plugins/ssh.py
+++ /dev/null
@@ -1,26 +0,0 @@
-## Copyright (C) 2007 Red Hat, Inc., Eugene Teo <eteo@redhat.com>
-
-### 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 sos.plugintools
-
-class ssh(sos.plugintools.PluginBase):
- """ssh-related information
- """
- def setup(self):
- self.addCopySpec("/etc/ssh/ssh_config")
- self.addCopySpec("/etc/ssh/sshd_config")
- return
-
diff --git a/src/lib/sos/plugins/startup.py b/src/lib/sos/plugins/startup.py
deleted file mode 100644
index 463f95fb..00000000
--- a/src/lib/sos/plugins/startup.py
+++ /dev/null
@@ -1,27 +0,0 @@
-### 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 sos.plugintools
-
-class startup(sos.plugintools.PluginBase):
- """startup information
- """
- def setup(self):
- self.addCopySpec("/etc/rc.d")
-
- self.collectExtOutput("/sbin/chkconfig --list", root_symlink = "chkconfig")
- self.collectExtOutput("/sbin/service --status-all")
- self.collectExtOutput("/sbin/runlevel")
- return
-
diff --git a/src/lib/sos/plugins/system.py b/src/lib/sos/plugins/system.py
deleted file mode 100644
index 82b04604..00000000
--- a/src/lib/sos/plugins/system.py
+++ /dev/null
@@ -1,33 +0,0 @@
-### 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 sos.plugintools
-
-class system(sos.plugintools.PluginBase):
- """core system related information
- """
- def setup(self):
- self.addCopySpec("/proc/sys")
- self.addCopySpec("/etc/sysctl.conf")
- self.addCopySpec("/etc/cron*")
- self.addCopySpec("/var/spool/cron*")
- self.addCopySpec("/var/log/cron*")
- self.addCopySpec("/etc/syslog.conf")
- self.addCopySpec("/etc/rsyslog.conf")
- self.addCopySpec("/etc/ntp.conf")
- self.addCopySpec("/etc/ntp/step-tickers")
- self.addCopySpec("/etc/ntp/ntpservers")
- self.collectExtOutput("/usr/bin/crontab -l")
- return
-
diff --git a/src/lib/sos/plugins/systemtap.py b/src/lib/sos/plugins/systemtap.py
deleted file mode 100644
index fc6c86db..00000000
--- a/src/lib/sos/plugins/systemtap.py
+++ /dev/null
@@ -1,35 +0,0 @@
-## Copyright (C) 2007 Red Hat, Inc., Eugene Teo <eteo@redhat.com>
-
-### 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 sos.plugintools
-
-class systemtap(sos.plugintools.PluginBase):
- """SystemTap information
- """
- def checkenabled(self):
- self.files = [ "/usr/bin/stap" ]
- self.packages = [ "systemtap", "systemtap-runtime" ]
- return sos.plugintools.PluginBase.checkenabled(self)
-
- def setup(self):
- # requires systemtap, systemtap-runtime, kernel-devel,
- # kernel-debuginfo, kernel-debuginfo-common
- # FIXME: do not use rpm -qa
- self.collectExtOutput("/bin/rpm -qa | /bin/egrep -e kernel.*`uname -r` -e systemtap -e elfutils | sort")
- self.collectExtOutput("/usr/bin/stap -V 2")
- self.collectExtOutput("/bin/uname -r")
- return
-
diff --git a/src/lib/sos/plugins/tftpserver.py b/src/lib/sos/plugins/tftpserver.py
deleted file mode 100644
index 0056d221..00000000
--- a/src/lib/sos/plugins/tftpserver.py
+++ /dev/null
@@ -1,31 +0,0 @@
-## Copyright (C) 2007 Shijoe George <spanjikk@redhat.com>
-
-### 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 sos.plugintools
-from os.path import exists
-
-class tftpserver(sos.plugintools.PluginBase):
- """tftpserver related information
- """
- def checkenabled(self):
- if self.cInfo["policy"].pkgByName("tftp-server") or exists("/etc/xinetd.d/tftp"):
- return True
- return False
-
- def setup(self):
- self.collectExtOutput("/bin/ls -laR /tftpboot")
- return
-
diff --git a/src/lib/sos/plugins/tomcat.py b/src/lib/sos/plugins/tomcat.py
deleted file mode 100644
index a6dc9055..00000000
--- a/src/lib/sos/plugins/tomcat.py
+++ /dev/null
@@ -1,28 +0,0 @@
-### 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 sos.plugintools
-
-class tomcat(sos.plugintools.PluginBase):
- """Tomcat related information
- """
- def checkenabled(self):
- if self.cInfo["policy"].pkgByName("tomcat5"):
- return True
- return False
-
- def setup(self):
- self.addCopySpec("/etc/tomcat5")
- self.addCopySpec("/var/log/tomcat5")
- return
diff --git a/src/lib/sos/plugins/udev.py b/src/lib/sos/plugins/udev.py
deleted file mode 100644
index 0b48e51e..00000000
--- a/src/lib/sos/plugins/udev.py
+++ /dev/null
@@ -1,23 +0,0 @@
-### 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 sos.plugintools
-
-class udev(sos.plugintools.PluginBase):
- """udev related information
- """
- def setup(self):
- self.addCopySpec("/etc/udev/udev.conf")
- self.addCopySpec("/etc/udev/rules.d/*")
- return
diff --git a/src/lib/sos/plugins/veritas.py b/src/lib/sos/plugins/veritas.py
deleted file mode 100644
index 6090627a..00000000
--- a/src/lib/sos/plugins/veritas.py
+++ /dev/null
@@ -1,221 +0,0 @@
-### 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 commands
-import sos.plugintools
-
-class veritas(sos.plugintools.PluginBase):
- """veritas related information
- """
- # License
- license = {"VXLICENSE" : "/usr/sbin/vxlicense", "VXLICREP" : "/usr/sbin/vxlicense",
- "OLD_VXLICREP" : "/var/adm/VRTSshrd/VRTSlic/bin/vxlicrep",
- "VXLICTEST" : "/sbin/vxlictest"}
-
- # Slim
- slim = {"VSSAT" : "/opt/VRTSat/bin/vssat"}
-
- # VxVM
- vxvm = {"VXDCTL" : "/usr/sbin/vxdctl", "VXPRINT" : "/usr/lib/vxvm/diag.d/vxkprint",
- "VXDISK" : "/usr/sbin/vxdisk", "VXDG" : "/usr/sbin/vxdg", "VXRLINK" : "/usr/sbin/vxrlink",
- "MACROSD" : "/usr/lib/vxvm/diag.d/macros.d", "VXDMPADM" : "/usr/sbin/vxdmpadm",
- "VXSTAT" : "/usr/sbin/vxstat", "VXCONFIGD" : "/usr/sbin/vxconfigd",
- "VXDDLADM" : "/usr/sbin/vxddladm", "VXDIAGDIR" : "/usr/lib/vxvm/diag.d",
- "VXTRACE" : "/usr/sbin/vxtrace", "VXRVG" : "/usr/sbin/vxrvg",
- "VXCLUSTADM" : "/etc/vx/bin/vxclustadm", "VXVSET" : "/usr/sbin/vxvset"}
-
- # VFR
- vfr = {"VFRC" : "/usr/sbin/vfrc"}
-
- # VxFS
- vxfs = {"VXLD_PRINT" : "/sbin/vxld_print", "FSCKPTADM" : "/usr/lib/fs/vxfs/fsckptadm",
- "FCLADM" : "/opt/VRTS/bin/fcladm", "FSAPADM" : "/opt/VRTS/bin/fsapadm",
- "FSDB" : "/opt/VRTS/bin/fsdb", "FSADM" : "/usr/lib/fs/vxfs/fsadm",
- "VXTUNEFS" : "/usr/lib/fs/vxfs/vxtunefs", "FSTYP" : "/usr/lib/fs/vxfs/fstyp"}
-
- #vcs
- vcs = {"HARES" : "/opt/VRTSvcs/bin/hares","HAGRP" : "/opt/VRTSvcs/bin/hagrp",
- "HASYS" : "/opt/VRTSvcs/bin/hasys","HACLUS" : "/opt/VRTSvcs/bin/haclus",
- "HACONF" : "/opt/VRTSvcs/bin/haconf","HASTATUS" : "/opt/VRTSvcs/bin/hastatus",
- "GABCONFIG" : "/sbin/gabconfig", "GABDISK" : "/sbin/gabdisk",
- "HATYPE" : "/opt/VRTSvcs/bin/hatype", "LLTSTAT" : "/sbin/lltstat",
- "GABDEBUG" : "/sbin/gabdebug", "GABDISKHB" : "/sbin/gabdiskhb",
- "GABDISKX" : "/sbin/gabdiskx", "GABPORT" : "/sbin/gabport",
- "HAD" : "/opt/VRTSvcs/bin/had","GETCOMMS" : "/opt/VRTSgab/getcomms",
- "HADISCOVER" : "/opt/VRTSvcs/bin/hadiscover",
- "OraDiscovery" : "/opt/VRTSvcs/bin/Oracle/OraDiscovery.pl",
- "GETVCSOPS" : "/opt/VRTSvcs/bin/getvcsops","GETDBAC" : "/opt/VRTSvcs/bin/getdbac"}
- # module list
- module_list = ["vxvm", "vxfs", "isis", "samba", "vcs", "spnas", "txpt", "vsap",
- "vrtsisp", "vlic", "vrw", "cpi", "cca", "spc", "vxfen", "cmc",
- "slim", "sfms", "dbed","vxportal","vxspec","vxio","vxdmpfs",
- "vxdmp"]
-
- package_list = ["VRTSfppm","VRTSfspro","VRTSob","VRTSlvmconv","VRTSvxmsa",
- "VRTSfsdoc", "VRTSap","VRTSap","VRTScpi","VRTSvxvm","VRTSvmpro",
- "VRTSddlpr","VRTSobgui","VRTSvmman","VRTScccfg","VRTSsal",
- "VRTSccshd","VRTStep","VRTStep","VRTSvxfs","VRTSalloc",
- "VRTSfsman","VRTSClariionCx600","VRTSccdam","VRTSccsta",
- "VRTSvlic"]
-
- def checkenabled(self):
- for pkgname in self.package_list:
- if self.policy().allPkgsByName(pkgname):
- return True
- return False
-
- def get_vxfs(self):
- """ capture information related to VXFS
- """
- self.addCopySpec("/etc/vx/tunefstab")
- # get all vxfs mountpoints and capture various information
- for mntpnt in commands.getoutput("/bin/df -P -T | /bin/grep vxfs | /usr/bin/awk '{ print $7 }'"):
- bdev = commands.getoutput("/bin/mount | /bin/grep 'on %s' | /usr/bin/awk '{ print $1 }'" % mntpnt)
- if mntpnt == "/":
- mntname="_root_"
- else:
- mntname=commands.getoutput("/bin/echo %s | sed s#/#_#g" % mntpnt)
- self.collectExtOutput("/bin/df -k %s" % mntpnt)
- self.collectExtOutput("%s -v %s" % (self.vxfs["FSTYP"],bdev))
- self.collectExtOutput("%s %s" % (self.vxfs["FSADM"],mntpnt))
- self.collectExtOutput("%s -p %s" % (self.vxfs["VXTUNEFS"],mntpnt))
- self.collectExtOutput("%s state %s" % (self.vxfs["FCLADM"],mntpnt))
- self.collectExtOutput("%s queryfs %S" % (self.vxfs["FSAPADM"],mntpnt))
- self.collectExtOutput("%s -n 'VERITAS File System' -l" % self.license["VXLICTEST"])
- return
-
- def get_vxvm(self):
- """ Veritas volume manager information
- """
- # vxdctl and vxclustadm information
- self.collectExtOutput("%s mode" % self.vxvm["VXDCTL"])
- self.collectExtOutput("%s -c mode" % self.vxvm["VXDCTL"])
- self.collectExtOutput("%s license" % self.vxvm["VXDCTL"])
- self.collectExtOutput("%s support" % self.vxvm["VXDCTL"])
- nodestate=commands.getoutput("%s help | grep '\[-v\] nodestate" % self.vxvm["VXCLUSTADM"])
- if nodestate is None:
- self.collectExtOutput("%s -v nodestate" % self.vxvm["VXCLUSTADM"])
- else:
- self.collectExtOutput("%s nodestate" % self.vxvm["VXCLUSTADM"])
- nidmap=commands.getoutput("% help | grep 'nidmap'" % self.vxvm["VXCLUSTADM"])
- if nidmap is None:
- self.collectExtOutput("%s nidmap" % self.vxvm["VXCLUSTADM"])
- self.collectExtOutput("%s dumpmsg" % self.vxvm["VXCLUSTADM"])
- self.collectExtOutput("%s transstate" % self.vxvm["VXCLUSTADM"])
- self.addCopySpec("/var/adm/vx/cmdlog*")
- self.addCopySpec("/var/adm/vx/translog*")
- self.addCopySpec("/VXVM*UPGRADE*")
- self.addCopySpec("/var/vxvm")
- self.collectExtOutput("/bin/ls -l /dev/vx*")
- self.collectExtOutput("/bin/ls -laR /etc/vx")
- self.addCopySpec("/etc/vx")
- self.addCopySpec("/etc/vxvmconf")
- self.addCopySpec("/etc/default/vxassist")
- # vxvm - vxdctl information
- vxdctlmode=commands.getoutput("%s mode | /usr/bin/awk ' { print $2 } '" % self.vxvm["VXDCTL"])
- if vxdctlmode == "disabled" or vxdctlmode == "not-running":
- return
- # vxvm - vxdisk information
- self.collectExtOutput("%s list" % self.vxvm["VXDISK"])
- vxdisk_path=commands.getoutput("%s help | grep 'path'" % self.vxvm["VXDISK"])
- if vxdisk_path is None:
- self.collectExtOutput("%s path" % self.vxvm["VXDISK"])
- self.collectExtOutput("%s -o alldgs list" % self.vxvm["VXDISK"])
- self.collectExtOutput("%s -s list" % self.vxvm["VXDISK"])
- for i in commands.getoutput("%s -q list | /usr/bin/awk ' { print $1 } ' | /bin/grep -v '^-$'" % self.vxvm["VXDISK"]):
- self.collectExtOutput("%s list %s" % (self.vxvm["VXDISK"], i))
- # vxvm - vxdg information
- self.collectExtOutput("%s list" % self.vxvm["VXDG"])
- self.collectExtOutput("%s free" % self.vxvm["VXDG"])
- if commands.getoutput("%s help | grep 'bootdg'" % self.vxvm["VXDG"]) is None:
- self.collectExtOutput("%s bootdg" % self.vxvm["VXDG"])
- # vxvm - vxtrace information
- self.collectExtOutput("%s -lE" % self.vxvm["VXTRACE"])
- for i in commands.getoutput("%s -q list | /usr/bin/awk ' { print $1 } '" % self.vxvm["VXDG"]):
- self.collectExtOutput("%s list %i" % (self.vxvm["VXDG"],i))
- self.collectExtOutput("%s -g %s" % (self.vxvm["VXSTAT"],i))
- self.collectExtOutput("%s -mvpshr -g %s" % (self.vxvm["VXPRINT"],i))
- self.collectExtOutput("%s -m -g %s" % (self.vxvm["VXPRINT"],i))
- self.collectExtOutput("%s list" % self.vxvm["VXVSET"])
- self.addCopySpec("/proc/sys/vxvm/vxinfo")
- self.addcopyspec("/proc/sys/vxvm/vxio")
- # vvr/svrm specific information
- self.addCopySpec("/etc/vx/vras")
- return
-
- def get_vcs(self):
- """ Veritas cluster information
- """
- self.collectExtOutput("%s -dump" % self.vcs["HACONF"])
- self.addCopySpec("/etc/VRTSvcs/*")
- self.addCopySpec("/etc/llt*")
- self.addCopySpec("/etc/gab*")
-
- #copy log files, etc
- self.addCopySpec("/var/VRTSvcs/*")
- self.addCopySpec("/var/adm/streams")
- self.addCopySpec("/var/adm/VRTSshrd/VRTSlic")
-
- # get state information
-
- self.collectExtOutput(self.vcs[LLTSTAT])
- self.collectExtOutput("%s -vvn" % self.vcs["LLTSTAT"])
- self.collectExtOutput("%s -a" % self.vcs["GABCONFIG"])
- self.collectExtOutput("%s -l" % self.vcs["GABDISK"])
- self.collectExtOutput("%s -l" % self.vcs["GABDISKHB"])
- self.collectExtOutput("%s -l" % self.vcs["GABDISKX"])
-
- self.collectExtOutput("%s -summary" % self.vcs["HASTATUS"])
- self.collectExtOutput("%s -display -all" % self.vcs["HARES"])
- self.collectExtOutput("%s -dep" % self.vcs["HARES"])
- self.collectExtOutput("%s -display -all" % self.vcs["HAGRP"])
- self.collectExtOutput("%s -dep" % self.vcs["HAGRP"])
- self.collectExtOutput("%s -display" % self.vcs["HATYPE"])
- self.collectExtOutput("%s -display" % self.vcs["HASYS"])
- self.collectExtOutput("%s -display" % self.vcs["HACLUS"])
-
- # TODO: get agents section
-
- # get cores
- self.addCopySpec("/opt/VRTSvcs/bin/core*")
- self.addCopySpec("/opt/VRTSvcs/core*")
-
- # TODO: get comms
-
- # vcs gui
- self.addCopySpec("/opt/VRTSvcs/gui/conf")
-
- # vcs quickstart
- vcsmode = commands.getoutput("%s -value VCSMODE" % self.vcs["HACLUS"])
- if vcsmode == "VCSQS":
- self.collectExtOutput("%s -discover Application User" % self.vcs["HADISCOVER"])
- self.collectExtOutput("%s -discover Mount MountPoint" % self.vcs["HADISCOVER"])
- self.collectExtOutput("%s -discover NFS Nservers" % self.vcs["HADISCOVER"])
- self.collectExtOutput("%s -discover NIC Device" % self.vcs["HADISCOVER"])
- self.collectExtOutput("%s -discover Oracle Instances" % self.vcs["HADISCOVER"])
- self.collectExtOutput("%s -discover Share PathName" % self.vcs["HADISCOVER"])
-
- def get_vxfen(self):
- pass
-
- def setup(self):
- # TODO: Do necessary checks for different archs, i.e. z-series and ia64
- self.collectExtOutput("/bin/rpm -qa | /bin/grep -i VRTS | /bin/grep -v doc | /bin/grep -v man")
- # Determine what information to collect based on installed packages
- if self.isInstalled("VRTSvxfs"): get_vxfs()
- if self.isInstalled("VRTSvxfs"): get_vxvm()
- # I think if one of these is present it is assumed that VCS is installed
- if self.isInstalled("VRTSvmpro") or self.isInstalled("VRTSfspro"): get_vcs()
- return
-
diff --git a/src/lib/sos/plugins/vmware.py b/src/lib/sos/plugins/vmware.py
deleted file mode 100644
index 7891576d..00000000
--- a/src/lib/sos/plugins/vmware.py
+++ /dev/null
@@ -1,30 +0,0 @@
-### 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 sos.plugintools
-import os
-
-class vmware(sos.plugintools.PluginBase):
- """VMWare related information
- """
- def checkenabled(self):
- if os.path.exists("/usr/bin/vmware"):
- return True
- return False
-
- def setup(self):
- self.collectExtOutput("/usr/bin/vmware -v")
- self.addCopySpec("/etc/vmware/locations")
- self.addCopySpec("/etc/vmware/config")
- return
diff --git a/src/lib/sos/plugins/x11.py b/src/lib/sos/plugins/x11.py
deleted file mode 100644
index 09b7c3c9..00000000
--- a/src/lib/sos/plugins/x11.py
+++ /dev/null
@@ -1,41 +0,0 @@
-### 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 sos.plugintools
-import os
-
-class x11(sos.plugintools.PluginBase):
- """X related information
- """
- def checkenabled(self):
- try:os.stat("/etc/X11")
- except:pass
- else:return True
- return False
-
- def setup(self):
- self.addCopySpec("/etc/X11")
- self.addCopySpec("/var/log/Xorg.*.log")
- self.addCopySpec("/var/log/XFree86.*.log")
- self.collectExtOutput("/bin/dmesg | grep -e 'agpgart.'")
-
- self.addForbiddenPath("/etc/X11/X")
- self.addForbiddenPath("/etc/X11/fontpath.d")
-
- # TODO: if there is a need for kde that can be added here as well
- if os.path.exists("/etc/gdm"):
- self.addCopySpec("/etc/gdm")
-
- return
-
diff --git a/src/lib/sos/plugins/xen.py b/src/lib/sos/plugins/xen.py
deleted file mode 100644
index a4adca75..00000000
--- a/src/lib/sos/plugins/xen.py
+++ /dev/null
@@ -1,99 +0,0 @@
-### 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 sos.plugintools
-import os, commands
-import re
-from stat import *
-
-class xen(sos.plugintools.PluginBase):
- """Xen related information
- """
- def determineXenHost(self):
- if os.access("/proc/acpi/dsdt", os.R_OK):
- (status, output) = commands.getstatusoutput("grep -qi xen /proc/acpi/dsdt")
- if status == 0:
- return "hvm"
-
- if os.access("/proc/xen/capabilities", os.R_OK):
- (status, output) = commands.getstatusoutput("grep -q control_d /proc/xen/capabilities")
- if status == 0:
- return "dom0"
- else:
- return "domU"
- return "baremetal"
-
- def checkenabled(self):
- if self.determineXenHost() == "baremetal":
- return False
- return True
-
- def is_running_xenstored(self):
- xs_pid = os.popen("pidof xenstored").read()
- xs_pidnum = re.split('\n$',xs_pid)[0]
- return xs_pidnum.isdigit()
-
- def domCollectProc(self):
- self.addCopySpec("/proc/xen/balloon")
- self.addCopySpec("/proc/xen/capabilities")
- self.addCopySpec("/proc/xen/xsd_kva")
- self.addCopySpec("/proc/xen/xsd_port")
- # determine if CPU has PAE support
- self.collectExtOutput("/bin/grep pae /proc/cpuinfo")
- # determine if CPU has Intel-VT or AMD-V support
- self.collectExtOutput("/bin/egrep -e 'vmx|svm' /proc/cpuinfo")
-
- def setup(self):
- host_type = self.determineXenHost()
- if host_type == "domU":
- # we should collect /proc/xen and /sys/hypervisor
- self.domCollectProc()
- # determine if hardware virtualization support is enabled
- # in BIOS: /sys/hypervisor/properties/capabilities
- self.addCopySpec("/sys/hypervisor")
- elif host_type == "hvm":
- # what do we collect here???
- pass
- elif host_type == "dom0":
- # default of dom0, collect lots of system information
- self.addCopySpec("/var/log/xen")
- self.addCopySpec("/etc/xen")
- self.collectExtOutput("/usr/sbin/xm dmesg")
- self.collectExtOutput("/usr/sbin/xm info")
- self.collectExtOutput("/usr/sbin/xm list")
- self.collectExtOutput("/usr/sbin/xm list --long")
- self.collectExtOutput("/usr/sbin/brctl show")
- self.domCollectProc()
- self.addCopySpec("/sys/hypervisor/version")
- self.addCopySpec("/sys/hypervisor/compilation")
- self.addCopySpec("/sys/hypervisor/properties")
- self.addCopySpec("/sys/hypervisor/type")
- if self.is_running_xenstored():
- self.addCopySpec("/sys/hypervisor/uuid")
- self.collectExtOutput("/usr/bin/xenstore-ls")
- else:
- # we need tdb instead of xenstore-ls if cannot get it.
- self.addCopySpec("/var/lib/xenstored/tdb")
-
- # FIXME: we *might* want to collect things in /sys/bus/xen*,
- # /sys/class/xen*, /sys/devices/xen*, /sys/modules/blk*,
- # /sys/modules/net*, but I've never heard of them actually being
- # useful, so I'll leave it out for now
- else:
- # for bare-metal, we don't have to do anything special
- return
-
- self.addCustomText("Xen hostType: "+host_type)
- return
-
diff --git a/src/lib/sos/plugins/xinetd.py b/src/lib/sos/plugins/xinetd.py
deleted file mode 100644
index b131f165..00000000
--- a/src/lib/sos/plugins/xinetd.py
+++ /dev/null
@@ -1,32 +0,0 @@
-## Copyright (C) 2007 Red Hat, Inc., Eugene Teo <eteo@redhat.com>
-
-### 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 sos.plugintools
-import os
-
-class xinetd(sos.plugintools.PluginBase):
- """xinetd information
- """
- def checkenabled(self):
- if self.isInstalled("xinetd") or os.path.exists("/etc/xinetd.conf"):
- return True
- return False
-
- def setup(self):
- self.addCopySpec("/etc/xinetd.conf")
- self.addCopySpec("/etc/xinetd.d")
- return
-
diff --git a/src/lib/sos/plugins/yum.py b/src/lib/sos/plugins/yum.py
deleted file mode 100644
index 25bbc7b9..00000000
--- a/src/lib/sos/plugins/yum.py
+++ /dev/null
@@ -1,60 +0,0 @@
-### 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 sos.plugintools
-import os
-import commands
-
-class yum(sos.plugintools.PluginBase):
- """yum information
- """
-
- optionList = [("yumlist", "list repositories and packages", "slow", False)]
- optionList = [("yumdebug", "gather yum debugging data", "slow", False)]
-
- def checkenabled(self):
- self.files = [ "/etc/yum.conf" ]
- self.packages = [ "yum" ]
- return sos.plugintools.PluginBase.checkenabled(self)
-
- def analyze(self):
- # repo sanity checking
- # TODO: elaborate/validate actual repo files, however this directory should
- # be empty on RHEL 5+ systems.
- if self.policy().rhelVersion() == 5:
- if len(os.listdir("/etc/yum.repos.d/")):
- self.addAlert("/etc/yum.repos.d/ contains additional repository "+
- "information and can cause rpm conflicts.")
-
- def setup(self):
- # Pull all yum related information
- self.addCopySpec("/etc/yum")
- self.addCopySpec("/etc/yum.repos.d")
- self.addCopySpec("/etc/yum.conf")
- self.addCopySpec("/var/log/yum.log")
-
- if self.getOption("yumlist"):
- # Get a list of channels the machine is subscribed to.
- self.collectExtOutput("/bin/echo \"repo list\" | /usr/bin/yum shell")
- # List various information about available packages
- self.collectExtOutput("/usr/bin/yum list")
-
- if self.getOption("yumdebug") and self.isInstalled('yum-utils'):
- for output in commands.getoutput("/usr/bin/yum-debug-dump").split("\n"):
- if "Output written to:" in output:
- try:
- self.collectExtOutput("/bin/zcat %s" % (output.split()[-1:][0],))
- except IndexError:
- pass
- return
diff --git a/src/lib/sos/plugintools.py b/src/lib/sos/plugintools.py
deleted file mode 100644
index b8b4ed7a..00000000
--- a/src/lib/sos/plugintools.py
+++ /dev/null
@@ -1,587 +0,0 @@
-## plugintools.py
-## This exports methods available for use by plugins for sos
-
-## Copyright (C) 2006 Steve Conklin <sconklin@redhat.com>
-
-### 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
-
-"""
-This is the base class for sosreport plugins
-"""
-from sos.helpers import *
-import os, os.path, sys, string, glob, re, traceback
-import shutil
-from stat import *
-from time import time
-from multiprocessing import Process
-
-class PluginException(Exception): pass
-
-class PluginBase:
- """
- Base class for plugins
- """
- def __init__(self, pluginname, commons):
- if not getattr(self, "optionList", False):
- self.optionList = []
-
- self.copiedFiles = []
- self.copiedDirs = []
- self.executedCommands = []
- self.diagnose_msgs = []
- self.alerts = []
- self.customText = ""
- self.optNames = []
- self.optParms = []
- self.piName = pluginname
- self.cInfo = commons
- self.forbiddenPaths = []
- self.copyPaths = []
- self.collectProgs = []
- self.thread = None
- self.pid = None
- self.eta_weight = 1
- self.time_start = None
- self.time_stop = None
-
- self.packages = []
- self.files = []
-
- self.must_exit = False
-
- self.soslog = logging.getLogger('sos')
-
- # get the option list into a dictionary
- for opt in self.optionList:
- self.optNames.append(opt[0])
- self.optParms.append({'desc':opt[1], 'speed':opt[2], 'enabled':opt[3]})
-
- def policy(self):
- return self.cInfo["policy"]
-
- def isInstalled(self, package_name):
- '''Is the package $package_name installed?
- '''
- return (self.policy().pkgByName(package_name) != {})
-
- # Method for applying regexp substitutions
- def doRegexSub(self, srcpath, regexp, subst):
- '''Apply a regexp substitution to a file archived by sosreport.
- '''
- if len(self.copiedFiles):
- for afile in self.copiedFiles:
- if afile['srcpath'] == srcpath:
- abspath = os.path.join(self.cInfo['dstroot'], srcpath.lstrip(os.path.sep))
- try:
- fp = open(abspath, 'r')
- tmpout, occurs = re.subn( regexp, subst, fp.read() )
- fp.close()
- if occurs > 0:
- fp = open(abspath,'w')
- fp.write(tmpout)
- fp.close()
- return occurs
- except SystemExit:
- raise SystemExit
- except KeyboardInterrupt:
- raise KeyboardInterrupt
- except Exception, e:
- self.soslog.log(logging.VERBOSE, "problem at path %s (%s)" % (abspath,e))
- break
- return False
-
- def doRegexFindAll(self, regex, fname):
- ''' Return a list of all non overlapping matches in the string(s)
- '''
- try:
- return re.findall(regex, open(fname, 'r').read(), re.MULTILINE)
- except: # IOError, AttributeError, etc.
- return []
-
- # Methods for copying files and shelling out
- def doCopyFileOrDir(self, srcpath, symlinks=True):
- # 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
- '''
- copyProhibited = 0
- for path in self.forbiddenPaths:
- if ( srcpath.count(path) > 0 ):
- copyProhibited = 1
-
- if copyProhibited:
- return ''
-
- if not os.path.exists(srcpath):
- self.soslog.debug("file or directory %s does not exist" % srcpath)
- return
-
- try:
- # What's the name of the symlink on the dest tree?
- dstslname = os.path.join(self.cInfo['dstroot'], srcpath.lstrip(os.path.sep))
- # make sure the dst dir exists
- if not (os.path.exists(os.path.dirname(dstslname)) and os.path.isdir(os.path.dirname(dstslname))):
- os.makedirs(os.path.dirname(dstslname))
- if symlinks and os.path.islink(srcpath):
- link = os.readlink(srcpath)
- os.symlink(link, dstslname)
- if os.path.isabs(srcpath):
- rpth = sosRelPath(os.path.dirname(dstslname), os.path.join(self.cInfo['dstroot'], link.lstrip(os.path.sep)))
- else:
- rpth = link
- self.copiedFiles.append({'srcpath':srcpath, 'dstpath':rpth, 'symlink':"yes", 'pointsto':link})
- elif os.path.isdir(srcpath):
- shutil.copytree(srcpath, dstslname, symlinks)
- else:
- # if we get here, it's definitely a regular file (not a symlink or dir)
- self.soslog.log(logging.VERBOSE3, "copying file %s" % srcpath)
- try:
- tdstpath, abspath = self.__copyFile(srcpath)
- except PluginException:
- self.soslog.log(logging.DEBUG, "error copying file %s (already exists)" % (srcpath))
- return
- except IOError:
- self.soslog.log(logging.VERBOSE2, "error copying file %s (IOError)" % (srcpath))
- return
- except:
- self.soslog.log(logging.VERBOSE2, "error copying file %s (SOMETHING HAPPENED)" % (srcpath))
- return
- self.copiedFiles.append({'srcpath':srcpath, 'dstpath':tdstpath, 'symlink':"no"}) # save in our list
- except (IOError, os.error), why:
- self.soslog.log(logging.DEBUG, "skipping symlink creation: (%s)" % (why,))
- except shutil.Error, err:
- self.soslog.log(logging.DEBUG, "error copying file %s (shutil.Error)" % (srcpath,))
-
- return
-
- def __copyFile(self, src):
- """ call cp to copy a file, collect return status and output. Returns the
- destination file name.
- """
- rel_dir = os.path.dirname(src).lstrip(os.path.sep)
-# if rel_dir[0] == "/": rel_dir = rel_dir[1:]
- new_dir = os.path.join(self.cInfo['dstroot'], rel_dir)
- new_fname = os.path.join(new_dir, os.path.basename(src))
-
- if not os.path.exists(new_fname):
- if not os.path.isdir(new_dir):
- os.makedirs(new_dir)
-
- if os.path.islink(src):
- linkto = os.readlink(src)
- os.symlink(linkto, new_fname)
- else:
- shutil.copy2(src, new_dir)
- else:
- raise PluginException('Error copying file: already exists')
-
- abspath = os.path.join(self.cInfo['dstroot'], src.lstrip(os.path.sep))
- relpath = sosRelPath(self.cInfo['rptdir'], abspath)
- return (relpath, abspath)
-
- def addForbiddenPath(self, forbiddenPath):
- """Specify a path to not copy, even if it's part of a copyPaths[] entry.
- """
- # Glob case handling is such that a valid non-glob is a reduced glob
- for filespec in glob.glob(forbiddenPath):
- self.forbiddenPaths.append(filespec)
-
- def getAllOptions(self):
- """
- return a list of all options selected
- """
- return (self.optNames, self.optParms)
-
- def setOption(self, optionname, value):
- ''' set the named option to value.
- '''
- for name, parms in zip(self.optNames, self.optParms):
- if name == optionname:
- parms['enabled'] = value
- return True
- else:
- return False
-
- def isOptionEnabled(self, optionname):
- ''' Deprecated, use getOption() instead
- '''
- return self.getOption(optionname)
-
- def getOption(self, optionname):
- ''' see whether the named option is enabled.
- '''
- for name, parms in zip(self.optNames, self.optParms):
- if name == optionname:
- return parms['enabled']
- # nonexistent options aren't enabled.
- return 0
-
- def addCopySpecLimit(self,fname,sizelimit = None):
- """Add a file specification (with limits)
- """
- if not ( fname and len(fname) ):
- self.soslog.warning("invalid file path")
- return False
- files = glob.glob(fname)
- files.sort()
- cursize = 0
- for flog in files:
- cursize += os.stat(flog)[ST_SIZE]
- if sizelimit and (cursize / 1024 / 1024) > sizelimit:
- break
- self.addCopySpec(flog)
-
- def addCopySpec(self, copyspec):
- """ 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):
- self.copyPaths.append(filespec)
-
- def callExtProg(self, prog):
- """ Execute a command independantly of the output gathering part of
- sosreport
- """
- # pylint: disable-msg = W0612
- status, shout, runtime = sosGetCommandOutput(prog)
- return status
-
- def collectExtOutput(self, exe, suggest_filename = None, root_symlink = None, timeout = 300):
- """
- Run a program and collect the output
- """
- self.collectProgs.append( (exe, suggest_filename, root_symlink, timeout) )
-
- def fileGrep(self, regexp, fname):
- try:
- return [l for l in open(fname).readlines() if re.match(regexp, l)]
- except: # IOError, AttributeError, etc.
- return []
-
- def mangleCommand(self, exe):
- # FIXME: this can be improved
- mangledname = re.sub(r"^/(usr/|)(bin|sbin)/", "", exe)
- mangledname = re.sub(r"[^\w\-\.\/]+", "_", mangledname)
- mangledname = re.sub(r"/", ".", mangledname).strip(" ._-")[0:64]
- return mangledname
-
- def makeCommandFilename(self, exe):
- """ The internal function to build up a filename based on a command """
-
- outfn = self.cInfo['cmddir'] + "/" + self.piName + "/" + self.mangleCommand(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 collectOutputNow(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
- """
-
- # pylint: disable-msg = W0612
- status, shout, runtime = sosGetCommandOutput(exe, timeout = timeout)
-
- if suggest_filename:
- outfn = self.makeCommandFilename(suggest_filename)
- else:
- outfn = self.makeCommandFilename(exe)
-
- if not os.path.isdir(os.path.dirname(outfn)):
- os.mkdir(os.path.dirname(outfn))
-
- if not (status == 127 or status == 32512): # if not command_not_found
- outfd = open(outfn, "w")
- if len(shout): outfd.write(shout+"\n")
- outfd.close()
-
- if root_symlink:
- curdir = os.getcwd()
- os.chdir(self.cInfo['dstroot'])
- try: os.symlink(outfn[len(self.cInfo['dstroot'])+1:], root_symlink.strip("/."))
- except: pass
- os.chdir(curdir)
-
- outfn_strip = outfn[len(self.cInfo['cmddir'])+1:]
-
- else:
- self.soslog.log(logging.VERBOSE, "could not run command: %s" % exe)
- outfn = None
- outfn_strip = None
-
- # sosStatus(status)
- # save info for later
- self.executedCommands.append({'exe': exe, 'file':outfn_strip}) # save in our list
- self.cInfo['xmlreport'].add_command(cmdline=exe,exitcode=status,f_stdout=outfn_strip,runtime=runtime)
- return outfn
-
- def writeTextToCommand(self, exe, text):
- """ A function that allows you to write a random text string to the
- command output location referenced by exe; this is useful if you want
- to conditionally collect information, but still want the output file
- to exist so as not to confuse readers """
-
- outfn = self.makeCommandFilename(exe)
-
- if not os.path.isdir(os.path.dirname(outfn)):
- os.mkdir(os.path.dirname(outfn))
-
- outfd = open(outfn, "w")
- outfd.write(text)
- outfd.close()
-
- self.executedCommands.append({'exe': exe, 'file': outfn}) # save in our list
- return outfn
-
- # For adding warning messages regarding configuration sanity
- def addDiagnose(self, alertstring):
- """ Add a configuration sanity warning for this plugin. These
- will be displayed on-screen before collection and in the report as well.
- """
- self.diagnose_msgs.append(alertstring)
- return
-
- # For adding output
- def addAlert(self, alertstring):
- """ Add an alert to the collection of alerts for this plugin. These
- will be displayed in the report
- """
- self.alerts.append(alertstring)
- return
-
-
- def addCustomText(self, text):
- """ Append text to the custom text that is included in the report. This
- is freeform and can include html.
- """
- self.customText = self.customText + text
- return
-
- def doCollect(self):
- """ This function has been replaced with copyStuff(threaded = True). Please change your
- module calls. Calling setup() now.
- """
- return self.copyStuff(threaded = True)
-
- def isRunning(self):
- """
- if threaded, is thread running ?
- """
- if self.thread: return self.thread.is_alive()
- return None
-
- def wait(self,timeout=None):
- """
- wait for a thread to complete - only called for threaded execution
- """
- self.thread.join(timeout)
- return self.thread.is_alive()
-
- def copyStuff(self, threaded = False, semaphore = None):
- """
- Collect the data for a plugin
- """
- if threaded and self.thread == None:
- self.thread = Process(target=self.copyStuff, name=self.piName+'-thread', args = [True, semaphore] )
- self.thread.start()
- return self.thread
-
- if semaphore: semaphore.acquire()
-
- if self.must_exit:
- semaphore.release()
- return
-
- self.soslog.log(logging.VERBOSE, "starting threaded plugin %s" % self.piName)
-
- self.time_start = time()
- self.time_stop = None
-
- for path in self.copyPaths:
- self.soslog.debug("copying pathspec %s" % path)
- try:
- self.doCopyFileOrDir(path)
- except SystemExit:
- if semaphore: semaphore.release()
- if threaded: return KeyboardInterrupt
- else: raise KeyboardInterrupt
- except KeyboardInterrupt:
- if semaphore: semaphore.release()
- if threaded: return KeyboardInterrupt
- else: raise KeyboardInterrupt
- except Exception, e:
- self.soslog.log(logging.VERBOSE2, "error copying from pathspec %s (%s), traceback follows:" % (path,e))
- self.soslog.log(logging.VERBOSE2, traceback.format_exc())
- for (prog, suggest_filename, root_symlink, timeout) in self.collectProgs:
- self.soslog.debug("collecting output of '%s'" % prog)
- try:
- self.collectOutputNow(prog, suggest_filename, root_symlink, timeout)
- except SystemExit:
- if semaphore: semaphore.release()
- if threaded: return SystemExit
- else: raise SystemExit
- except KeyboardInterrupt:
- if semaphore: semaphore.release()
- if threaded: return KeyboardInterrupt
- else: raise KeyboardInterrupt
- except Exception, e:
- self.soslog.log(logging.VERBOSE2, "error collection output of '%s', traceback follows:" % prog)
- self.soslog.log(logging.VERBOSE2, traceback.format_exc())
-
- self.time_stop = time()
-
- if semaphore: semaphore.release()
- self.soslog.log(logging.VERBOSE, "plugin %s returning" % self.piName)
-
- def exit_please(self):
- """ This function tells the plugin that it should exit ASAP"""
- self.must_exit = True
-
- def get_description(self):
- """ This function will return the description for the plugin"""
- try:
- return self.__doc__.strip()
- except:
- return "<no description available>"
-
- def checkenabled(self):
- """ This function can be overidden to let the plugin decide whether
- it should run or not.
- """
- # some files or packages have been specified for this package
- if len(self.files) or len(self.packages):
- for fname in self.files:
- if os.path.exists(fname):
- return True
- for pkgname in self.packages:
- if self.isInstalled(pkgname):
- return True
- return False
-
- return True
-
- def defaultenabled(self):
- """This devices whether a plugin should be automatically loaded or
- only if manually specified in the command line."""
- return True
-
- def collect(self):
- """ This function has been replaced with setup(). Please change your
- module calls. Calling setup() now.
- """
- self.setup()
-
- def diagnose(self):
- """This class must be overridden to check the sanity of the system's
- configuration before the collection begins.
- """
- pass
-
- def setup(self):
- """This class must be overridden to add the copyPaths, forbiddenPaths,
- and external programs to be collected at a minimum.
- """
- pass
-
- def analyze(self):
- """
- perform any analysis. To be replaced by a plugin if desired
- """
- 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 = '<hr/><a name="%s"></a>\n' % self.piName
-
- # Intro
- html = html + "<h2> Plugin <em>" + self.piName + "</em></h2>\n"
-
- # Files
- if len(self.copiedFiles):
- html = html + "<p>Files copied:<br><ul>\n"
- for afile in self.copiedFiles:
- html = html + '<li><a href="%s">%s</a>' % (afile['dstpath'], afile['srcpath'])
- if (afile['symlink'] == "yes"):
- html = html + " (symlink to %s)" % afile['pointsto']
- html = html + '</li>\n'
- html = html + "</ul></p>\n"
-
- # Dirs
- if len(self.copiedDirs):
- html = html + "<p>Directories Copied:<br><ul>\n"
- for adir in self.copiedDirs:
- html = html + '<li><a href="%s">%s</a>\n' % (adir['dstpath'], adir['srcpath'])
- if (adir['symlink'] == "yes"):
- html = html + " (symlink to %s)" % adir['pointsto']
- html = html + '</li>\n'
- html = html + "</ul></p>\n"
-
- # Command Output
- if len(self.executedCommands):
- html = html + "<p>Commands Executed:<br><ul>\n"
- # convert file name to relative path from our root
- for cmd in self.executedCommands:
- if cmd["file"] and len(cmd["file"]):
- cmdOutRelPath = sosRelPath(self.cInfo['rptdir'], self.cInfo['cmddir'] + "/" + cmd['file'])
- html = html + '<li><a href="%s">%s</a></li>\n' % (cmdOutRelPath, cmd['exe'])
- else:
- html = html + '<li>%s</li>\n' % (cmd['exe'])
- html = html + "</ul></p>\n"
-
- # Alerts
- if len(self.alerts):
- html = html + "<p>Alerts:<br><ul>\n"
- for alert in self.alerts:
- html = html + '<li>%s</li>\n' % alert
- html = html + "</ul></p>\n"
-
- # Custom Text
- if (self.customText != ""):
- html = html + "<p>Additional Information:<br>\n"
- html = html + self.customText + "</p>\n"
-
- return html
-
diff --git a/src/lib/sos/policyredhat.py b/src/lib/sos/policyredhat.py
deleted file mode 100755
index b5a02203..00000000
--- a/src/lib/sos/policyredhat.py
+++ /dev/null
@@ -1,377 +0,0 @@
-## policy-redhat.py
-## Implement policies required for the sos system support tool
-
-## Copyright (C) Steve Conklin <sconklin@redhat.com>
-
-### 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 commands
-import sys
-import string
-from tempfile import gettempdir
-from sos.helpers import *
-import random
-import re
-import hashlib
-import rpm
-import time
-
-sys.path.insert(0, "/usr/share/rhn/")
-try:
- from up2date_client import up2dateAuth
- from up2date_client import config
- from rhn import rpclib
-except:
- # might fail if non-RHEL
- pass
-
-#class SosError(Exception):
-# def __init__(self, code, message):
-# self.code = code
-# self.message = message
-#
-# def __str__(self):
-# return 'Sos Error %s: %s' % (self.code, self.message)
-
-def memoized(function):
- ''' function decorator to allow caching of return values
- '''
- function.cache={}
- def f(*args):
- try:
- return function.cache[args]
- except KeyError:
- result = function.cache[args] = function(*args)
- return result
- return f
-
-class SosPolicy:
- "This class implements various policies for sos"
- def __init__(self):
- self.report_file = ""
- self.report_md5 = ""
- self.reportName = ""
- self.ticketNumber = ""
-
- def setCommons(self, commons):
- self.cInfo = commons
- return
-
- def validatePlugin(self, pluginpath):
- "Validates the plugin as being acceptable to run"
- # return value
- # TODO implement this
- #print "validating %s" % pluginpath
- return True
-
- def pkgProvides(self, name):
- return self.pkgByName(name).get('providename')
-
- def pkgRequires(self, name):
- return self.pkgByName(name).get('requirename')
-
- def allPkgsByName(self, name):
- return self.allPkgs("name", name)
-
- def allPkgsByNameRegex(self, regex_name):
- reg = re.compile(regex_name)
- return [pkg for pkg in self.allPkgs() if reg.match(pkg['name'])]
-
- def pkgByName(self, name):
- # TODO: do a full NEVRA compare and return newest version, best arch
- try:
- # lame attempt at locating newest
- return self.allPkgsByName(name)[-1]
- except:
- pass
- return {}
-
- def allPkgs(self, ds = None, value = None):
- # if possible return the cached values
- try: return self._cache_rpm[ "%s-%s" % (ds,value) ]
- except AttributeError: self._cache_rpm = {}
- except KeyError: pass
-
- ts = rpm.TransactionSet()
- if ds and value:
- mi = ts.dbMatch(ds, value)
- else:
- mi = ts.dbMatch()
-
- self._cache_rpm[ "%s-%s" % (ds,value) ] = [pkg for pkg in mi]
- del mi, ts
- return self._cache_rpm[ "%s-%s" % (ds,value) ]
-
- def runlevelByService(self, name):
- ret = []
- try:
- for tabs in commands.getoutput("/sbin/chkconfig --list %s" % name).split():
- try:
- (runlevel, onoff) = tabs.split(":", 1)
- except:
- pass
- else:
- if onoff == "on":
- ret.append(int(runlevel))
- except:
- pass
- return ret
-
- def runlevelDefault(self):
- try:
- reg=self.doRegexFindAll(r"^id:(\d{1}):initdefault:", "/etc/inittab")
- for initlevel in reg:
- return initlevel
- except:
- return 3
-
- def kernelVersion(self):
- return commands.getoutput("/bin/uname -r").strip("\n")
-
- def hostName(self):
- return commands.getoutput("/bin/hostname").split(".")[0]
-
- def rhelVersion(self):
- try:
- pkgname = self.pkgByName("redhat-release")["version"]
- if pkgname[0] == "4":
- return 4
- elif pkgname in [ "5Server", "5Client" ]:
- return 5
- except: pass
- return False
-
- def rhnUsername(self):
- try:
- cfg = config.initUp2dateConfig()
-
- return rpclib.xmlrpclib.loads(up2dateAuth.getSystemId())[0][0]['username']
- except:
- # ignore any exception and return an empty username
- return ""
-
- def isKernelSMP(self):
- if commands.getoutput("/bin/uname -v").split()[1] == "SMP":
- return True
- else:
- return False
-
- def getArch(self):
- return commands.getoutput("/bin/uname -m").strip()
-
- def pkgNVRA(self, pkg):
- fields = pkg.split("-")
- version, release, arch = fields[-3:]
- name = "-".join(fields[:-3])
- return (name, version, release, arch)
-
- def getDstroot(self):
- """Find a temp directory to form the root for our gathered information
- and reports.
- """
- dstroot = "/tmp/%s-%s" % (self.hostName(), time.strftime("%Y%m%d%H%M%S"))
- try:
- os.mkdir(dstroot, 0700)
- except:
- return False
- return dstroot
-
- def preWork(self):
- # this method will be called before the gathering begins
-
- localname = self.rhnUsername()
- if len(localname) == 0: localname = self.hostName()
-
- if not self.cInfo['cmdlineopts'].batch:
- try:
- self.reportName = raw_input(_("Please enter your first initial and last name [%s]: ") % localname)
- self.reportName = re.sub(r"[^a-zA-Z.0-9]", "", self.reportName)
-
- self.ticketNumber = raw_input(_("Please enter the case number that you are generating this report for: "))
- self.ticketNumber = re.sub(r"[^0-9]", "", self.ticketNumber)
- print
- except:
- print
- sys.exit(0)
-
- if len(self.reportName) == 0:
- self.reportName = localname
-
- if self.cInfo['cmdlineopts'].customerName:
- self.reportName = self.cInfo['cmdlineopts'].customerName
- self.reportName = re.sub(r"[^a-zA-Z.0-9]", "", self.reportName)
-
- if self.cInfo['cmdlineopts'].ticketNumber:
- self.ticketNumber = self.cInfo['cmdlineopts'].ticketNumber
- self.ticketNumber = re.sub(r"[^0-9]", "", self.ticketNumber)
-
- return
-
- def renameResults(self, newName):
- newName = os.path.join(gettempdir(), newName)
- if len(self.report_file) and os.path.isfile(self.report_file):
- try: os.rename(self.report_file, newName)
- except: return False
- self.report_file = newName
-
- def packageResults(self):
-
- if len(self.ticketNumber):
- self.reportName = self.reportName + "." + self.ticketNumber
- else:
- self.reportName = self.reportName
-
- self.renameResults("sosreport-%s-%s.tar.bz2" % (self.reportName, time.strftime("%Y%m%d%H%M%S")))
-
- tarcmd = "/bin/tar -jcf %s %s" % (self.report_file, os.path.basename(self.cInfo['dstroot']))
-
- print _("Creating compressed archive...")
-
- curwd = os.getcwd()
- os.chdir(os.path.dirname(self.cInfo['dstroot']))
- oldmask = os.umask(077)
- status, shout = commands.getstatusoutput(tarcmd)
- os.umask(oldmask)
- os.chdir(curwd)
- return
-
- def cleanDstroot(self):
- if not os.path.isdir(os.path.join(self.cInfo['dstroot'],"sos_commands")):
- # doesn't look like a dstroot, refusing to clean
- return False
- os.system("/bin/rm -rf %s" % self.cInfo['dstroot'])
-
- def encryptResults(self):
- # make sure a report exists
- if not self.report_file:
- return False
-
- print _("Encrypting archive...")
- gpgname = self.report_file + ".gpg"
-
- try:
- keyring = self.cInfo['config'].get("general", "gpg_keyring")
- except:
- keyring = "/usr/share/sos/rhsupport.pub"
-
- try:
- recipient = self.cInfo['config'].get("general", "gpg_recipient")
- except:
- recipient = "support@redhat.com"
-
- status, output = commands.getstatusoutput("""/usr/bin/gpg --trust-model always --batch --keyring "%s" --no-default-keyring --compress-level 0 --encrypt --recipient "%s" --output "%s" "%s" """ % (keyring, recipient, gpgname, self.report_file))
- if status == 0:
- os.unlink(self.report_file)
- self.report_file = gpgname
- else:
- print _("There was a problem encrypting your report.")
- sys.exit(1)
-
- def displayResults(self):
- # make sure a report exists
- if not self.report_file:
- return False
-
- # calculate md5
- fp = open(self.report_file, "r")
- self.report_md5 = hashlib.md5(fp.read()).hexdigest()
- fp.close()
-
- self.renameResults("sosreport-%s-%s-%s.tar.bz2" % (self.reportName, time.strftime("%Y%m%d%H%M%S"), self.report_md5[-4:]))
-
- # store md5 into file
- fp = open(self.report_file + ".md5", "w")
- fp.write(self.report_md5 + "\n")
- fp.close()
-
- print
- print _("Your sosreport has been generated and saved in:\n %s") % self.report_file
- print
- if len(self.report_md5):
- print _("The md5sum is: ") + self.report_md5
- print
- print _("Please send this file to your support representative.")
- print
-
- def uploadResults(self):
- # make sure a report exists
- if not self.report_file:
- return False
-
- print
-
- # make sure it's readable
- try:
- fp = open(self.report_file, "r")
- except:
- return False
-
- # read ftp URL from configuration
- try:
- upload_url = self.cInfo['config'].get("general", "upload_url")
- except:
- upload_url = "ftp://dropbox.redhat.com/incoming"
-
- from urlparse import urlparse
- url = urlparse(upload_url)
-
- if url[0] != "ftp":
- print _("Cannot upload to specified URL.")
- return
-
- # extract username and password from URL, if present
- if url[1].find("@") > 0:
- username, host = url[1].split("@", 1)
- if username.find(":") > 0:
- username, passwd = username.split(":", 1)
- else:
- passwd = None
- else:
- username, passwd, host = None, None, url[1]
-
- # extract port, if present
- if host.find(":") > 0:
- host, port = host.split(":", 1)
- port = int(port)
- else:
- port = 21
-
- path = url[2]
-
- try:
- from ftplib import FTP
- upload_name = os.path.basename(self.report_file)
-
- ftp = FTP()
- ftp.connect(host, port)
- if username and passwd:
- ftp.login(username, passwd)
- else:
- ftp.login()
- ftp.cwd(path)
- ftp.set_pasv(True)
- ftp.storbinary('STOR %s' % upload_name, fp)
- ftp.quit()
- except:
- print _("There was a problem uploading your report to Red Hat support.")
- else:
- print _("Your report was successfully uploaded to Red Hat's ftp server with name:")
- print " " + upload_name
- print
- print _("Please communicate this name to your support representative.")
- print
-
- fp.close()
diff --git a/src/lib/sos/progressbar.py b/src/lib/sos/progressbar.py
deleted file mode 100644
index c8b5f0a7..00000000
--- a/src/lib/sos/progressbar.py
+++ /dev/null
@@ -1,368 +0,0 @@
-#!/usr/bin/python
-# -*- coding: iso-8859-1 -*-
-#
-# progressbar - Text progressbar library for python.
-# Copyright (c) 2005 Nilton Volpato
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This library 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
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-
-"""Text progressbar library for python.
-
-This library provides a text mode progressbar. This is tipically used
-to display the progress of a long running operation, providing a
-visual clue that processing is underway.
-
-The ProgressBar class manages the progress, and the format of the line
-is given by a number of widgets. A widget is an object that may
-display diferently depending on the state of the progress. There are
-three types of widget:
-- a string, which always shows itself;
-- a ProgressBarWidget, which may return a diferent value every time
-it's update method is called; and
-- a ProgressBarWidgetHFill, which is like ProgressBarWidget, except it
-expands to fill the remaining width of the line.
-
-The progressbar module is very easy to use, yet very powerful. And
-automatically supports features like auto-resizing when available.
-"""
-
-__author__ = "Nilton Volpato"
-__author_email__ = "first-name dot last-name @ gmail.com"
-__date__ = "2006-05-07"
-__version__ = "2.2"
-
-# Changelog
-#
-# 2006-05-07: v2.2 fixed bug in windows
-# 2005-12-04: v2.1 autodetect terminal width, added start method
-# 2005-12-04: v2.0 everything is now a widget (wow!)
-# 2005-12-03: v1.0 rewrite using widgets
-# 2005-06-02: v0.5 rewrite
-# 2004-??-??: v0.1 first version
-
-
-import sys, time
-from array import array
-try:
- from fcntl import ioctl
- import termios
-except ImportError:
- pass
-import signal
-
-class ProgressBarWidget(object):
- """This is an element of ProgressBar formatting.
-
- The ProgressBar object will call it's update value when an update
- is needed. It's size may change between call, but the results will
- not be good if the size changes drastically and repeatedly.
- """
- def update(self, pbar):
- """Returns the string representing the widget.
-
- The parameter pbar is a reference to the calling ProgressBar,
- where one can access attributes of the class for knowing how
- the update must be made.
-
- At least this function must be overriden."""
- pass
-
-class ProgressBarWidgetHFill(object):
- """This is a variable width element of ProgressBar formatting.
-
- The ProgressBar object will call it's update value, informing the
- width this object must the made. This is like TeX \\hfill, it will
- expand to fill the line. You can use more than one in the same
- line, and they will all have the same width, and together will
- fill the line.
- """
- def update(self, pbar, width):
- """Returns the string representing the widget.
-
- The parameter pbar is a reference to the calling ProgressBar,
- where one can access attributes of the class for knowing how
- the update must be made. The parameter width is the total
- horizontal width the widget must have.
-
- At least this function must be overriden."""
- pass
-
-
-class ETA(ProgressBarWidget):
- "Widget for the Estimated Time of Arrival"
- def format_time(self, seconds):
- return time.strftime('%H:%M:%S', time.gmtime(seconds))
- def update(self, pbar):
- if pbar.currval == 0:
- return 'ETA: --:--:--'
- elif pbar.finished:
- return 'Time: %s' % self.format_time(pbar.seconds_elapsed)
- else:
- elapsed = pbar.seconds_elapsed
- eta = elapsed * pbar.maxval / pbar.currval - elapsed
- return 'ETA: %s' % self.format_time(eta)
-
-class FileTransferSpeed(ProgressBarWidget):
- "Widget for showing the transfer speed (useful for file transfers)."
- def __init__(self):
- self.fmt = '%6.2f %s'
- self.units = ['B','K','M','G','T','P']
- def update(self, pbar):
- if pbar.seconds_elapsed < 2e-6:#== 0:
- bps = 0.0
- else:
- bps = float(pbar.currval) / pbar.seconds_elapsed
- spd = bps
- for u in self.units:
- if spd < 1000:
- break
- spd /= 1000
- return self.fmt % (spd, u+'/s')
-
-class RotatingMarker(ProgressBarWidget):
- "A rotating marker for filling the bar of progress."
- def __init__(self, markers='|/-\\'):
- self.markers = markers
- self.curmark = -1
- def update(self, pbar):
- if pbar.finished:
- return self.markers[0]
- self.curmark = (self.curmark + 1)%len(self.markers)
- return self.markers[self.curmark]
-
-class Percentage(ProgressBarWidget):
- "Just the percentage done."
- def update(self, pbar):
- return '%3d%%' % pbar.percentage()
-
-class Bar(ProgressBarWidgetHFill):
- "The bar of progress. It will strech to fill the line."
- def __init__(self, marker='#', left='|', right='|'):
- self.marker = marker
- self.left = left
- self.right = right
- def _format_marker(self, pbar):
- if isinstance(self.marker, (str, unicode)):
- return self.marker
- else:
- return self.marker.update(pbar)
- def update(self, pbar, width):
- percent = pbar.percentage()
- cwidth = width - len(self.left) - len(self.right)
- marked_width = int(percent * cwidth / 100)
- m = self._format_marker(pbar)
- bar = (self.left + (m*marked_width).ljust(cwidth) + self.right)
- return bar
-
-class ReverseBar(Bar):
- "The reverse bar of progress, or bar of regress. :)"
- def update(self, pbar, width):
- percent = pbar.percentage()
- cwidth = width - len(self.left) - len(self.right)
- marked_width = int(percent * cwidth / 100)
- m = self._format_marker(pbar)
- bar = (self.left + (m*marked_width).rjust(cwidth) + self.right)
- return bar
-
-default_widgets = [Percentage(), ' ', Bar()]
-class ProgressBar(object):
- """This is the ProgressBar class, it updates and prints the bar.
-
- The term_width parameter may be an integer. Or None, in which case
- it will try to guess it, if it fails it will default to 80 columns.
-
- The simple use is like this:
- >>> pbar = ProgressBar().start()
- >>> for i in xrange(100):
- ... # do something
- ... pbar.update(i+1)
- ...
- >>> pbar.finish()
-
- But anything you want to do is possible (well, almost anything).
- You can supply different widgets of any type in any order. And you
- can even write your own widgets! There are many widgets already
- shipped and you should experiment with them.
-
- When implementing a widget update method you may access any
- attribute or function of the ProgressBar object calling the
- widget's update method. The most important attributes you would
- like to access are:
- - currval: current value of the progress, 0 <= currval <= maxval
- - maxval: maximum (and final) value of the progress
- - finished: True if the bar is have finished (reached 100%), False o/w
- - start_time: first time update() method of ProgressBar was called
- - seconds_elapsed: seconds elapsed since start_time
- - percentage(): percentage of the progress (this is a method)
- """
- def __init__(self, maxval=100, widgets=default_widgets, term_width=None,
- fd=sys.stderr):
- assert maxval > 0
- self.maxval = maxval
- self.widgets = widgets
- self.fd = fd
- self.signal_set = False
- if term_width is None:
- try:
- self.handle_resize(None,None)
- signal.signal(signal.SIGWINCH, self.handle_resize)
- self.signal_set = True
- except:
- self.term_width = 79
- else:
- self.term_width = term_width
-
- self.currval = 0
- self.finished = False
- self.prev_percentage = -1
- self.start_time = None
- self.seconds_elapsed = 0
-
- def handle_resize(self, signum, frame):
- h,w=array('h', ioctl(self.fd,termios.TIOCGWINSZ,'\0'*8))[:2]
- self.term_width = w
-
- def percentage(self):
- "Returns the percentage of the progress."
- return self.currval*100.0 / self.maxval
-
- def _format_widgets(self):
- r = []
- hfill_inds = []
- num_hfill = 0
- currwidth = 0
- for i, w in enumerate(self.widgets):
- if isinstance(w, ProgressBarWidgetHFill):
- r.append(w)
- hfill_inds.append(i)
- num_hfill += 1
- elif isinstance(w, (str, unicode)):
- r.append(w)
- currwidth += len(w)
- else:
- weval = w.update(self)
- currwidth += len(weval)
- r.append(weval)
- for iw in hfill_inds:
- r[iw] = r[iw].update(self, (self.term_width-currwidth)/num_hfill)
- return r
-
- def _format_line(self):
- return ''.join(self._format_widgets()).ljust(self.term_width)
-
- def _need_update(self):
- return int(self.percentage()) != int(self.prev_percentage)
-
- def update(self, value):
- "Updates the progress bar to a new value."
- assert 0 <= value <= self.maxval
- self.currval = value
- if not self._need_update() or self.finished:
- return
- if not self.start_time:
- self.start_time = time.time()
- self.seconds_elapsed = time.time() - self.start_time
- self.prev_percentage = self.percentage()
- if value != self.maxval:
- self.fd.write(self._format_line() + '\r')
- else:
- self.finished = True
- self.fd.write(self._format_line() + '\n')
-
- def start(self):
- """Start measuring time, and prints the bar at 0%.
-
- It returns self so you can use it like this:
- >>> pbar = ProgressBar().start()
- >>> for i in xrange(100):
- ... # do something
- ... pbar.update(i+1)
- ...
- >>> pbar.finish()
- """
- self.update(0)
- return self
-
- def finish(self):
- """Used to tell the progress is finished."""
- self.update(self.maxval)
- if self.signal_set:
- signal.signal(signal.SIGWINCH, signal.SIG_DFL)
-
-
-
-
-
-
-if __name__=='__main__':
- import os
-
- def example1():
- widgets = ['Test: ', Percentage(), ' ', Bar(marker=RotatingMarker()),
- ' ', ETA(), ' ', FileTransferSpeed()]
- pbar = ProgressBar(widgets=widgets, maxval=10000000).start()
- for i in range(1000000):
- # do something
- pbar.update(10*i+1)
- pbar.finish()
- print
-
- def example2():
- class CrazyFileTransferSpeed(FileTransferSpeed):
- "It's bigger between 45 and 80 percent"
- def update(self, pbar):
- if 45 < pbar.percentage() < 80:
- return 'Bigger Now ' + FileTransferSpeed.update(self,pbar)
- else:
- return FileTransferSpeed.update(self,pbar)
-
- widgets = [CrazyFileTransferSpeed(),' <<<', Bar(), '>>> ', Percentage(),' ', ETA()]
- pbar = ProgressBar(widgets=widgets, maxval=10000000)
- # maybe do something
- pbar.start()
- for i in range(2000000):
- # do something
- pbar.update(5*i+1)
- pbar.finish()
- print
-
- def example3():
- widgets = [Bar('>'), ' ', ETA(), ' ', ReverseBar('<')]
- pbar = ProgressBar(widgets=widgets, maxval=10000000).start()
- for i in range(1000000):
- # do something
- pbar.update(10*i+1)
- pbar.finish()
- print
-
- def example4():
- widgets = ['Test: ', Percentage(), ' ',
- Bar(marker='0',left='[',right=']'),
- ' ', ETA(), ' ', FileTransferSpeed()]
- pbar = ProgressBar(widgets=widgets, maxval=500)
- pbar.start()
- for i in range(100,500+1,50):
- time.sleep(0.2)
- pbar.update(i)
- pbar.finish()
- print
-
-
- example1()
- example2()
- example3()
- example4()
-