diff options
author | astokes_rhn <astokes_rhn@ef72aa8b-4018-0410-8976-d6e080ef94d8> | 2007-08-08 19:09:04 +0000 |
---|---|---|
committer | astokes_rhn <astokes_rhn@ef72aa8b-4018-0410-8976-d6e080ef94d8> | 2007-08-08 19:09:04 +0000 |
commit | 5533d5c15d0ec59b0a512a4029a28d239c8ffbb0 (patch) | |
tree | 6bea3b58540839cc96c733633c8a0a27203d398b /src | |
parent | 575a269c1e972aa88cb65d889e690b201429895d (diff) | |
download | sos-5533d5c15d0ec59b0a512a4029a28d239c8ffbb0.tar.gz |
merge stokes-dev to trunk
git-svn-id: svn+ssh://svn.fedorahosted.org/svn/sos/trunk@344 ef72aa8b-4018-0410-8976-d6e080ef94d8
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/sos/plugins/autofs.py | 22 | ||||
-rw-r--r-- | src/lib/sos/plugins/filesys.py | 2 | ||||
-rw-r--r-- | src/lib/sos/plugins/general.py | 1 | ||||
-rw-r--r-- | src/lib/sos/plugins/ldap.py | 14 | ||||
-rw-r--r-- | src/lib/sos/plugins/networking.py | 5 | ||||
-rw-r--r-- | src/lib/sos/plugins/rpm.py | 4 | ||||
-rw-r--r-- | src/lib/sos/plugins/selinux.py | 11 | ||||
-rw-r--r-- | src/lib/sos/plugins/x11.py | 9 | ||||
-rw-r--r-- | src/lib/sos/plugins/yum.py | 8 | ||||
-rw-r--r-- | src/lib/sos/plugintools.py | 21 | ||||
-rwxr-xr-x | src/lib/sos/policyredhat.py | 2 |
11 files changed, 63 insertions, 36 deletions
diff --git a/src/lib/sos/plugins/autofs.py b/src/lib/sos/plugins/autofs.py index cbf3b299..85cb72a7 100644 --- a/src/lib/sos/plugins/autofs.py +++ b/src/lib/sos/plugins/autofs.py @@ -24,26 +24,29 @@ class autofs(sos.plugintools.PluginBase): if self.cInfo["policy"].runlevelDefault() in self.cInfo["policy"].runlevelByService("autofs"): return True return False - + def checkdebug(self): - """ testing if autofs debug has been enabled anywhere + """ + Probably not needed? I think we can pretty much assume that if daemon.* is + set in /etc/syslog.conf then debugging is enabled. + FIXME: remove checkdebug if not needed in future release """ + pass # Global debugging optlist=[] - opt = self.fileGrep(r"^(DEFAULT_LOGGING|DAEMONOPTIONS)=(.*)", "/etc/sysconfig/autofs") + opt = self.doRegexFindAll(r"^(DEFAULT_LOGGING|DAEMONOPTIONS)=(.*)", "/etc/sysconfig/autofs") for opt1 in opt: - for opt2 in opt1.split(" "): - optlist.append(opt2) + optlist.append(opt1)[1] 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") + debugout=self.doRegexFindAll(r"^daemon.*\s+(\/var.*)", "/etc/syslog.conf") for i in debugout: - return i[1] + return i def setup(self): self.addCopySpec("/etc/auto*") @@ -55,7 +58,6 @@ class autofs(sos.plugintools.PluginBase): 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()) + self.addCopySpec(self.getdaemondebug()) return diff --git a/src/lib/sos/plugins/filesys.py b/src/lib/sos/plugins/filesys.py index e9d1faa5..3ae4da51 100644 --- a/src/lib/sos/plugins/filesys.py +++ b/src/lib/sos/plugins/filesys.py @@ -37,8 +37,10 @@ class filesys(sos.plugintools.PluginBase): for disk in raiddevs.split('\n'): if '' != disk.strip(): self.collectExtOutput("/sbin/fdisk -l /dev/%s" % (disk,)) + self.collectExtOutput("/sbin/tune2fs -l /dev/%s" % (disk,)) for disk in disks.split('\n'): if '' != disk.strip(): self.collectExtOutput("/sbin/fdisk -l /dev/%s" % (disk,)) + self.collectExtOutput("/sbin/tune2fs -l /dev/%s" % (disk,)) return diff --git a/src/lib/sos/plugins/general.py b/src/lib/sos/plugins/general.py index 44d9da05..e4be4941 100644 --- a/src/lib/sos/plugins/general.py +++ b/src/lib/sos/plugins/general.py @@ -36,6 +36,7 @@ class general(sos.plugintools.PluginBase): self.collectExtOutput("/bin/hostname", root_symlink = "hostname") self.collectExtOutput("/bin/date", root_symlink = "date") self.collectExtOutput("/usr/bin/uptime", root_symlink = "uptime") + self.collectExtOutput("/bin/env") return def postproc(self): diff --git a/src/lib/sos/plugins/ldap.py b/src/lib/sos/plugins/ldap.py index ee50acde..59ab53fc 100644 --- a/src/lib/sos/plugins/ldap.py +++ b/src/lib/sos/plugins/ldap.py @@ -25,13 +25,18 @@ class ldap(sos.plugintools.PluginBase): results={} tmplist=[] for i in ldapopts: - t=fileGrep(r"^%s*" % i,"/etc/openldap/ldap.conf") + t=self.doRegexFindAll(r"^(%s)\s+(.*)" % i,"/etc/openldap/ldap.conf") for x in t: - tmplist.append(x.split(" ")) - for i in tmplist: - results[i[0]]=i[1].rstrip("\n") + results[x[0]]=x[1].rstrip("\n") return results + def get_slapd_debug(self): + """ Capture debugging information based on an existing log level + """ + loglevel=self.doRegexFindAll(r"^local4.*\s+(\/var.*)", "/etc/syslog.conf") + for i in loglevel: + return i + def diagnose(self): # Validate ldap client options ldapopts=self.get_ldap_opts() @@ -44,6 +49,7 @@ class ldap(sos.plugintools.PluginBase): def setup(self): self.addCopySpec("/etc/ldap.conf") self.addCopySpec("/etc/openldap") + self.addCopySpec(self.get_slapd_debug()) return def postproc(self): diff --git a/src/lib/sos/plugins/networking.py b/src/lib/sos/plugins/networking.py index e578f830..1dcb0375 100644 --- a/src/lib/sos/plugins/networking.py +++ b/src/lib/sos/plugins/networking.py @@ -24,10 +24,7 @@ class networking(sos.plugintools.PluginBase): """Return a dictionary for which key are interface name according to the output of ifconifg-a stored in ifconfigFile. """ - out={} - reg=self.fileGrep(r"^(eth\d+)\D", ifconfigFile) - for name in reg: - out[name]=1 + out=self.doRegexFindAll(r"^(eth\d+)\D", ifconfigFile) return out def collectIPTable(self,tablename): diff --git a/src/lib/sos/plugins/rpm.py b/src/lib/sos/plugins/rpm.py index c899d141..bcddaccb 100644 --- a/src/lib/sos/plugins/rpm.py +++ b/src/lib/sos/plugins/rpm.py @@ -22,10 +22,10 @@ class rpm(sos.plugintools.PluginBase): def setup(self): self.addCopySpec("/var/log/rpmpkgs") - + if self.isOptionEnabled("rpmq"): self.collectExtOutput("/bin/rpm -qa --qf \"%{NAME}-%{VERSION}-%{RELEASE}-%{ARCH}\n\"", root_symlink = "installed-rpms") - + if self.isOptionEnabled("rpmva"): self.eta_weight += 800 # this plugins takes 200x longer (for ETA) self.collectExtOutput("/bin/rpm -Va", root_symlink = "rpm-Va") diff --git a/src/lib/sos/plugins/selinux.py b/src/lib/sos/plugins/selinux.py index 897c3991..dc82e608 100644 --- a/src/lib/sos/plugins/selinux.py +++ b/src/lib/sos/plugins/selinux.py @@ -34,3 +34,14 @@ class selinux(sos.plugintools.PluginBase): except: pass return True + + def analyze(self): + # Check for SELinux denials and capture raw output from sealert + if self.cInfo["policy"].runlevelDefault() in self.cInfo["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/x11.py b/src/lib/sos/plugins/x11.py index 4abd8782..5de25153 100644 --- a/src/lib/sos/plugins/x11.py +++ b/src/lib/sos/plugins/x11.py @@ -19,11 +19,10 @@ class x11(sos.plugintools.PluginBase): """X related information """ def checkenabled(self): - try: os.stat("/etc/X11") - except: pass - else: return True - - return False + try:os.stat("/etc/X11") + except:pass + else:return True + return False def setup(self): self.addCopySpec("/etc/X11") diff --git a/src/lib/sos/plugins/yum.py b/src/lib/sos/plugins/yum.py index 1f389d30..0cdf0740 100644 --- a/src/lib/sos/plugins/yum.py +++ b/src/lib/sos/plugins/yum.py @@ -26,9 +26,7 @@ class yum(sos.plugintools.PluginBase): return True return False - def diagnose(self): - # FIXME: diagnose should only report actual problems, disabling this for now. - return True + def analyze(self): # repo sanity checking # TODO: elaborate/validate actual repo files, however this directory should # be empty on RHEL 5+ systems. @@ -36,8 +34,8 @@ class yum(sos.plugintools.PluginBase): except: rhelver = None if rhelver == "5" or True: - if len(os.listdir('/etc/yum.repos.d/')): - self.addDiagnose("/etc/yum.repos.d/ contains additional repository "+ + 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): diff --git a/src/lib/sos/plugintools.py b/src/lib/sos/plugintools.py index 8809100f..eb53ca86 100644 --- a/src/lib/sos/plugintools.py +++ b/src/lib/sos/plugintools.py @@ -97,7 +97,19 @@ class PluginBase: 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) + ''' + out=[] + f=open(fname,'r') + content=f.read() + f.close() + reg=re.compile(regex,re.MULTILINE) + for i in reg.findall(content): + out.append(i) + return out + # Methods for copying files and shelling out def doCopyFileOrDir(self, srcpath): # pylint: disable-msg = R0912 @@ -290,15 +302,15 @@ class PluginBase: def callExtProg(self, prog): """ Execute a command independantly of the output gathering part of sosreport - """ + """ # Log if binary is not runnable or does not exist if not os.access(prog.split()[0], os.X_OK): self.soslog.log(logging.VERBOSE, "binary '%s' does not exist or is not runnable" % prog.split()[0]) # pylint: disable-msg = W0612 - status, shout, runtime = sosGetCommandOutput(prog) + status, shout, runtime = sosGetCommandOutput(prog) return status - + def runExe(self, exe): """ Deprecated - use collectExtOutput() """ @@ -598,4 +610,3 @@ class PluginBase: return html - diff --git a/src/lib/sos/policyredhat.py b/src/lib/sos/policyredhat.py index aed36434..d2139afa 100755 --- a/src/lib/sos/policyredhat.py +++ b/src/lib/sos/policyredhat.py @@ -96,7 +96,7 @@ class SosPolicy: def runlevelDefault(self): try: - reg=self.fileGrep(r"^id:(\d{1}):initdefault:", "/etc/inittab") + reg=self.doRegexFindAll(r"^id:(\d{1}):initdefault:", "/etc/inittab") for initlevel in reg: return initlevel except: |