From 928f48f80a6b3817d4779772c53e64dfa5517eb2 Mon Sep 17 00:00:00 2001 From: Adam Stokes Date: Thu, 23 Feb 2012 22:45:59 +0000 Subject: sos/plugins: 2 new Ubuntu specific and ported plugins 2 New plugins that were relevant to Ubuntu and other Debian based systems. Altered a few more base plugins to handle Ubuntu platforms as well. Signed-off-by: Jesse Jaggars --- sos/plugins/apparmor.py | 24 ++++++++++++++++++++++++ sos/plugins/bootloader.py | 5 +++-- sos/plugins/dpkg.py | 3 ++- sos/plugins/filesys.py | 4 ++-- sos/plugins/general.py | 37 ++++++++++++++++++++++++++++++++++++- sos/plugins/hardware.py | 4 ++-- sos/plugins/libraries.py | 4 ++-- sos/plugins/libvirt.py | 4 ++-- sos/plugins/udhcp.py | 30 ++++++++++++++++++++++++++++++ 9 files changed, 103 insertions(+), 12 deletions(-) create mode 100644 sos/plugins/apparmor.py create mode 100644 sos/plugins/udhcp.py diff --git a/sos/plugins/apparmor.py b/sos/plugins/apparmor.py new file mode 100644 index 00000000..06c17c71 --- /dev/null +++ b/sos/plugins/apparmor.py @@ -0,0 +1,24 @@ +## Copyright (c) 2012 Adam Stokes +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2 of the License, or +## (at your option) any later version. + +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. + +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +from sos.plugins import Plugin, UbuntuPlugin + +class apparmor(Plugin, UbuntuPlugin): + """Apparmor related information + """ + def setup(self): + self.addCopySpecs([ + "/etc/apparmor" + ]) diff --git a/sos/plugins/bootloader.py b/sos/plugins/bootloader.py index b0df9a9f..e447bd9d 100644 --- a/sos/plugins/bootloader.py +++ b/sos/plugins/bootloader.py @@ -12,9 +12,9 @@ ## along with this program; if not, write to the Free Software ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -from sos.plugins import Plugin, RedHatPlugin +from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin -class bootloader(Plugin, RedHatPlugin): +class bootloader(Plugin, RedHatPlugin, UbuntuPlugin): """Bootloader information """ def setup(self): @@ -25,6 +25,7 @@ class bootloader(Plugin, RedHatPlugin): "/boot/efi/efi/redhat/elilo.conf", "/boot/grub/grub.conf", "/boot/grub/device.map", + "/etc/grub.d", "/boot/yaboot.conf"]) self.collectExtOutput("/sbin/lilo -q") self.collectExtOutput("/bin/ls -lanR /boot") diff --git a/sos/plugins/dpkg.py b/sos/plugins/dpkg.py index 47c2c9e4..db305f71 100644 --- a/sos/plugins/dpkg.py +++ b/sos/plugins/dpkg.py @@ -1,4 +1,5 @@ -### This program is free software; you can redistribute it and/or modify +## Copyright (c) 2012 Adam Stokes +## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. diff --git a/sos/plugins/filesys.py b/sos/plugins/filesys.py index 25e46c50..0b7b8e4f 100644 --- a/sos/plugins/filesys.py +++ b/sos/plugins/filesys.py @@ -12,12 +12,12 @@ ## along with this program; if not, write to the Free Software ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -from sos.plugins import Plugin, RedHatPlugin +from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin import os import re from itertools import * -class filesys(Plugin, RedHatPlugin): +class filesys(Plugin, RedHatPlugin, UbuntuPlugin): """information on filesystems """ optionList = [("lsof", 'gathers information on all open files', 'slow', False)] diff --git a/sos/plugins/general.py b/sos/plugins/general.py index 92244ceb..434554ee 100644 --- a/sos/plugins/general.py +++ b/sos/plugins/general.py @@ -13,7 +13,7 @@ ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. import os -from sos.plugins import Plugin, RedHatPlugin +from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin, DebianPlugin import commands class general(Plugin, RedHatPlugin): @@ -63,3 +63,38 @@ class general(Plugin, RedHatPlugin): def postproc(self): self.doRegexSub("/etc/sysconfig/rhn/up2date", r"(\s*proxyPassword\s*=\s*)\S+", r"\1***") + +class generalDebian(Plugin, DebianPlugin, UbuntuPlugin): + """Basic system information for Debian based distributions""" + @classmethod + def name(self): + return "general" + + def setup(self): + self.addCopySpecs([ + "/etc/debian_version", + "/etc/init", # upstart + "/etc/event.d", # " + "/etc/inittab", + "/etc/sos.conf", + "/etc/sysconfig", + "/proc/stat", + "/var/log/dmesg", + "/var/log/sa", + "/var/log/pm/suspend.log", + "/var/log/up2date", + "/etc/hostid", + "/var/lib/dbus/machine-id", + "/etc/exports", + "/etc/lsb-release" + ]) + 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.collectExtOutput("/usr/bin/hostid") + 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/dmesg") + self.collectExtOutput("/usr/sbin/alternatives --display java", root_symlink = "java") + self.collectExtOutput("/usr/bin/readlink -f /usr/bin/java") diff --git a/sos/plugins/hardware.py b/sos/plugins/hardware.py index 631701f4..09248b7a 100644 --- a/sos/plugins/hardware.py +++ b/sos/plugins/hardware.py @@ -12,10 +12,10 @@ ## along with this program; if not, write to the Free Software ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -from sos.plugins import Plugin, RedHatPlugin +from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin from glob import glob -class hardware(Plugin, RedHatPlugin): +class hardware(Plugin, RedHatPlugin, UbuntuPlugin): """hardware related information """ def setup(self): diff --git a/sos/plugins/libraries.py b/sos/plugins/libraries.py index bf0223a2..5f2210fb 100644 --- a/sos/plugins/libraries.py +++ b/sos/plugins/libraries.py @@ -12,9 +12,9 @@ ## along with this program; if not, write to the Free Software ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -from sos.plugins import Plugin, RedHatPlugin +from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin -class libraries(Plugin, RedHatPlugin): +class libraries(Plugin, RedHatPlugin, UbuntuPlugin): """information on shared libraries """ diff --git a/sos/plugins/libvirt.py b/sos/plugins/libvirt.py index 9f2a18d5..4eba7963 100644 --- a/sos/plugins/libvirt.py +++ b/sos/plugins/libvirt.py @@ -12,8 +12,8 @@ ## along with this program; if not, write to the Free Software ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -from sos.plugins import Plugin, RedHatPlugin -class libvirt(Plugin, RedHatPlugin): +from sos.plugins import Plugin, RedHatPlugin, UbuntuPlugin +class libvirt(Plugin, RedHatPlugin, UbuntuPlugin): """libvirt-related information """ def setup(self): diff --git a/sos/plugins/udhcp.py b/sos/plugins/udhcp.py new file mode 100644 index 00000000..f884e796 --- /dev/null +++ b/sos/plugins/udhcp.py @@ -0,0 +1,30 @@ +## Copyright (c) 2012 Adam Stokes +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2 of the License, or +## (at your option) any later version. + +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. + +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +from sos.plugins import Plugin, UbuntuPlugin + +class udhcp(Plugin, UbuntuPlugin): + """DHCP related information + """ + def checkenabled(self): + self.files = ['/etc/init.d/udhcpd'] + self.packages = ['udhcpd'] + return Plugin.checkenabled(self) + + def setup(self): + self.addCopySpecs([ + "/etc/default/udhcpd", + "/etc/udhcpd.conf" + ]) -- cgit