sosreport是一个类型于supportconfig 的工具,sosreport是python编写的一个工具,适用于centos(和redhat一样,包名为sos)、ubuntu(其下包名为sosreport)等大多数版本的linux 。sosreport在github上的托管页面为:https://github.com/sosreport/sos,而且默认在很多系统的源里都已经集成有。如果使用的是正版redhat,在出现系统问题,寻求官方支持时,官方一般也会通过sosreport将收集的信息进行分析查看。需要注意的是在一些老的redhat发行版中叫sysreport ------ 如redhat4.5之前的版本中。

一、sosreport的安装

在默认使用linux发行版的源进行安装时,由于在不同的系统上包名称也会有差异,所以使用的命令也不同,如redhat和ubuntu平台的安装如下:

  1. // redhat/centos下的安装
  2. # yum -y insatll sos
  3. // ubuntu下的安装
  4. # sudo apt-get install sosreport

二、sosreport用法

可以使用sosreport --help或man sosreport 获取使用帮助手册,如下:

  1. [root@361way ~]# sosreport --help
  2. Usage: sosreport [options]
  3. Options:
  4. -h, --help show this help message and exit
  5. -l, --list-plugins list plugins and available plugin options
  6. -n NOPLUGINS, --skip-plugins=NOPLUGINS
  7. disable these plugins
  8. -e ENABLEPLUGINS, --enable-plugins=ENABLEPLUGINS
  9. enable these plugins
  10. -o ONLYPLUGINS, --only-plugins=ONLYPLUGINS
  11. enable these plugins only
  12. -k PLUGOPTS, --plugin-option=PLUGOPTS
  13. plugin options in plugname.option=value format (see
  14. -l)
  15. -a, --alloptions enable all options for loaded plugins
  16. --batch batch mode - do not prompt interactively
  17. --build keep sos tree available and dont package results
  18. -v, --verbose increase verbosity
  19. --quiet only print fatal errors
  20. --debug enable interactive debugging using the python debugger
  21. --ticket-number=TICKET_NUMBER
  22. specify ticket number
  23. --name=CUSTOMER_NAME specify report name
  24. --config-file=CONFIG_FILE
  25. specify alternate configuration file
  26. --tmp-dir=TMP_DIR specify alternate temporary directory
  27. --report Enable HTML/XML reporting
  28. --profile turn on profiling
  29. -z COMPRESSION_TYPE, --compression-type=COMPRESSION_TYPE
  30. compression technology to use [auto, zip, gzip, bzip2,
  31. xz] (default=auto)
  32. Some examples:
  33. enable cluster plugin only and collect dlm lockdumps:
  34. # sosreport -o cluster -k cluster.lockdump
  35. disable memory and samba plugins, turn off rpm -Va collection:
  36. # sosreport -n memory,samba -k rpm.rpmva=off

上面也列出了具体操作的示例。其中-l 参数会列出当前enable和disable的所有服务插件及当前available的所有插件。

  1. [root@361way log]# sosreport -a --report
  2. sosreport (version 3.0)
  3. This command will collect diagnostic and configuration information from
  4. this CentOS Linux system and installed applications.
  5. An archive containing the collected information will be generated in
  6. /var/tmp and may be provided to a CentOS support representative.
  7. Any information provided to CentOS will be treated in accordance with
  8. the published support policies at:
  9. https://www.centos.org/
  10. The generated archive may contain data considered sensitive and its
  11. content should be reviewed by the originating organization before being
  12. passed to any third party.
  13. No changes will be made to system configuration.
  14. Press ENTER to continue, or CTRL-C to quit.
  15. Please enter your first initial and last name [361way.com]:
  16. Please enter the case number that you are generating this report for:
  17. Running plugins. Please wait ...
  18. Running 68/68: yum...
  19. Creating compressed archive...
  20. Your sosreport has been generated and saved in:
  21. /var/tmp/sosreport-361way.com-20140912204339.tar.xz
  22. The checksum is: eaf5b2cbb1e9be68d41be5e5a60a61b6
  23. Please send this file to your support representative.

如上所示,我使用-A 启用所有的模块,--report是开启所有的结果以html /xml 的格式一个总的报告。生成的包需要通过下面的命令进行解包。

  1. # xz -d ***.tar.xz
  2. # tar -xvf ***.tar
  3. 或直接使用下面的命令一步完成解压
  4. tar xvJf ***.tar.xz

在解包后的sos_reports 目录会有report的结果sos.html文件生成,同时会有sos.txt文件生成,该文件内列出了具体执行的命令及copy 文件的一些信息。html 打开的内容如下:

由于页面较大,这里只截出了最上面的部分,列出了所有的收集模块,下面alerts 给出了报警模块的信息。再往下就是具体到每一个模块的信息。

三、sosreport配置文件

sosreport的配置文件是/etc/sos.conf ,默认内容如下:

  1. [root@361way ~]# cat /etc/sos.conf
  2. [general]
  3. #ftp_upload_url = ftp://example.com/incoming
  4. #gpg_keyring = /usr/share/sos/rhsupport.pub
  5. #gpg_recipient = support@redhat.com
  6. smtp_server = None
  7. [plugins] //此处可以设置默认enable和disable的模块
  8. #disable = rpm, selinux, dovecot
  9. [tunables] //可调参数
  10. #rpm.rpmva = off
  11. #general.syslogsize = 15

从配置文件上可以看出,sosreport同样将收集的结果上传到server 上,可以通过man sos.conf 查看配置文件的帮助信息,不过man给出的并没有太多信息,想在了解更多的信息可以查看 sosreport在github上的wiki页 。

四、sosreport总结

相于supportconfig,由于sosreport是由python语言进行编写的,所以其在功能扩展上更有优势,但由于在不同的发行版本上的python版本不同,在进行功能扩展时,对不同版本间的异常处理相对麻烦。而supportconfig由于是shell 语言编写的一个工具,对版本的依赖相对少些 ,但对一些工具的依赖相对多些 ,如在获取进程相关的信息时,shell 需要将ps 工具或处理proc的结果,而sosreport则可以直接import psutil 模块,两者之间的区别,归根到底就是shell 和python的区别。

linux信息收集篇之sosreport的更多相关文章

  1. Kali Linux信息收集工具

    http://www.freebuf.com/column/150118.html 可能大部分渗透测试者都想成为网络空间的007,而我个人的目标却是成为Q先生! 看过007系列电影的朋友,应该都还记得 ...

  2. Kali Linux信息收集工具全集

    001:0trace.tcptraceroute.traceroute 描述:进行路径枚举时,传统基于ICMP协议的探测工具经常会受到屏蔽,造成探测结果不够全面的问题.与此相对基于TCP协议的探测,则 ...

  3. Kali Linux信息收集工具全

    可能大部分渗透测试者都想成为网络空间的007,而我个人的目标却是成为Q先生! 看过007系列电影的朋友,应该都还记得那个戏份不多但一直都在的Q先生(由于年级太长目前已经退休).他为007发明了众多神奇 ...

  4. 内网渗透----Linux信息收集整理

    一.基础信息收集 1.查看系统类型 cat /etc/issue cat /etc/*-release cat /etc/lsb-release cat /etc/redhat-release 2.内 ...

  5. web安全之信息收集篇

    信息收集 1.网络信息 网络信息就包括网站的厂商.运营商,网站的外网出口.后台.OA. 2.域名信息 通过域名可以查洵网站的所有人.注册商.邮箱等信息 --->Whois 第三方查询,查询子域网 ...

  6. linux信息收集

    1.系统区分debian系列:debian.ubunturedhat系列:redhat.centos 是否为docker.或者为虚拟机 分为通用模块.单独模块的信息获取 2.系统信息收集 内核(是否为 ...

  7. kali linux 信息收集(Kismet)

    1.kismet工具,是一个无线扫描工具,该工具通过测量周围的无线信号,可以扫描到周围附近所用可用的Ap,以及信道等信息.同时还可以捕获网络中的数据包到一个文件中.这样可以方便分析数据包.下面我将详细 ...

  8. 网络安全-主动信息收集篇第二章-三层网络发现之ping

    第三层网络扫描基于TCP/IP.ICMP协议. 优点:可路由.速度比较快 缺点:相对于二层网络扫描较慢,容易被边界防火墙过滤 所有扫描发现技术,都会有相应的对抗办法,所以无论是来自二层的网络扫描还是来 ...

  9. 网络安全-主动信息收集篇第二章SNMP扫描

    SNMP扫描: snmp在中大型企业中可以用来做网络管理和网络监控的使用,当开启了snmp简单网络管理后,那么客户机就可以通过这个协议向该设备发送snmp协议内容可以轻松查询到目标主机的相关信息. 以 ...

随机推荐

  1. Ajax(javascript)案例

    一.注册案例(Get方式) 1.前台 <%@ page language="java" import="java.util.*" pageEncoding ...

  2. 将本地代码提交到github

    最近练习了freemarker 做了个代码生成工具,想提交到github上,在本地进行了提交,执行如下些命令 git init git add . * git commit -m "comm ...

  3. Oracle10g 64位 在Windows 2008 Server R2 中的安装 解决方案

    背景: 操作系统Windows 2008 Server R2 要安装Oracle10g 64位版本 安装时出现如下错误: 检查操作系统版本:必须是5.0,5.1,5.2 or 6.0.实际为6.1 未 ...

  4. CustomSqlSessionFactoryBean

    import java.io.File; import java.net.JarURLConnection; import java.net.URL; import java.util.ArrayLi ...

  5. JS和Java正则表达式验证

    js代码 <script type="text/javascript"> function SubmitCk() { var reg = /^([a-zA-Z0-9]+ ...

  6. Web服务器与客户端三种http交互方式

    近期在对接项目时用到http方式与第三方交互数据,由于中间沟通不足导致走了不少弯路,至此特意花了点时间总结服务端与客户端数据交互的方式,本地搭建两个项目一个作为服务端,一个作为客户端.post可以有两 ...

  7. c++中友元机制

    友元的概念:遵循一定规则而使对象以外的软件系统能够不经过消息传递方式而直接访问对象内封装的数据成员的技术方法便是友元. 只要将外界的某个对象说明为一个类的友元,那么这个外界对象就可以访问这个类对象中的 ...

  8. [日常] 高性能MySQL-索引

    1.mysql的索引工作类似一本书的目录部分,想找某个特定主题,先查找书的目录部分,找到对应的页码2.ORM工具只能生成基本的合法的查询3.索引是在存储引擎层实现的,不是服务器层4.B-tree就是指 ...

  9. Java JDBC的基础知识(一)

    一.为什么引入JDBC 在学习JDBC之前,抛开它的概念,我先按照我的理解解释一下,为什么要引入JDBC.在我看来,引入JDBC跟我之前学过的引入JVM(Java虚拟机)有些相似之处.当然,关于JVM ...

  10. 【JVM】1、java虚拟机参数-X 与 -XX的区别

    Options that begin with -X are non-standard (not guaranteed to be supported on all VM implementation ...