Sosreport:收集Unix系统日志和诊断信息的工具

系统 Linux
如果你是 RHEL 管理员,你可能肯定听说过 Sosreport :一个可扩展、可移植的支持数据收集工具。它是一个从类 Unix 操作系统中收集系统配置详细信息和诊断信息的工具。当用户提出支持服务单时,他/她必须运行此工具并将由 Sosreport 工具生成的结果报告发送给 Red Hat 支持人员。

[[235856]]

如果你是 RHEL 管理员,你可能肯定听说过 Sosreport :一个可扩展、可移植的支持数据收集工具。它是一个从类 Unix 操作系统中收集系统配置详细信息和诊断信息的工具。当用户提出支持服务单时,他/她必须运行此工具并将由 Sosreport 工具生成的结果报告发送给 Red Hat 支持人员。然后,执行人员将根据报告进行初步分析,并尝试找出系统中的问题。不仅在 RHEL 系统上,你可以在任何类 Unix 操作系统上使用它来收集系统日志和其他调试信息。

 

安装 Sosreport

Sosreport 在 Red Hat 官方系统仓库中,因此你可以使用 Yum 或 DNF 包管理器安装它,如下所示。

  1. $ sudo yum install sos

要么,

  1. $ sudo dnf install sos

在 Debian、Ubuntu 和 Linux Mint 上运行:

  1. $ sudo apt install sosreport

 

用法

安装后,运行以下命令以收集系统配置详细信息和其他诊断信息。

  1. $ sudo sosreport

系统将要求你输入系统的一些详细信息,例如系统名称、案例 ID 等。相应地输入详细信息,然后按回车键生成报告。如果你不想更改任何内容并使用默认值,只需按回车键即可。

我的 CentOS 7 服务器的示例输出:

  1. sosreport (version 3.5)
  2.  
  3. This command will collect diagnostic and configuration information from
  4. this CentOS Linux system and installed applications.
  5.  
  6. An archive containing the collected information will be generated in
  7. /var/tmp/sos.DiJXi7 and may be provided to a CentOS support
  8. representative.
  9.  
  10. Any information provided to CentOS will be treated in accordance with
  11. the published support policies at:
  12.  
  13. https://wiki.centos.org/
  14.  
  15. The generated archive may contain data considered sensitive and its
  16. content should be reviewed by the originating organization before being
  17. passed to any third party.
  18.  
  19. No changes will be made to system configuration.
  20.  
  21. Press ENTER to continue, or CTRL-C to quit.
  22.  
  23. Please enter your first initial and last name [server.ostechnix.local]:
  24. Please enter the case id that you are generating this report for []:
  25.  
  26. Setting up archive ...
  27. Setting up plugins ...
  28. Running plugins. Please wait ...
  29.  
  30. Running 73/73: yum...
  31. Creating compressed archive...
  32.  
  33. Your sosreport has been generated and saved in:
  34. /var/tmp/sosreport-server.ostechnix.local-20180628171844.tar.xz
  35.  
  36. The checksum is: 8f08f99a1702184ec13a497eff5ce334
  37.  
  38. Please send this file to your support representative.
  39.  

如果你不希望系统提示你输入此类详细信息,请如下使用批处理模式。

  1. $ sudo sosreport --batch

正如你在上面的输出中所看到的,生成了一个归档报告并保存在 /var/tmp/sos.DiJXi7 中。在 RHEL 6/CentOS 6 中,报告将在 /tmp 中生成。你现在可以将此报告发送给你的支持人员,以便他可以进行初步分析并找出问题所在。

你可能会担心或想知道报告中的内容。如果是这样,你可以通过运行以下命令来查看它:

  1. $ sudo tar -tf /var/tmp/sosreport-server.ostechnix.local-20180628171844.tar.xz

要么,

  1. $ sudo vim /var/tmp/sosreport-server.ostechnix.local-20180628171844.tar.xz

请注意,上述命令不会解压存档,而只显示存档中的文件和文件夹列表。如果要查看存档中文件的实际内容,请首先使用以下命令解压存档:

  1. $ sudo tar -xf /var/tmp/sosreport-server.ostechnix.local-20180628171844.tar.xz

存档的所有内容都将解压当前工作目录中 ssosreport-server.ostechnix.local-20180628171844/ 目录中。进入目录并使用 cat 命令或任何其他文本浏览器查看文件内容:

  1. $ cd sosreport-server.ostechnix.local-20180628171844/
  2.  
  3. $ cat uptime
  4. 17:19:02 up 1:03, 2 users, load average: 0.50, 0.17, 0.10

有关 Sosreport 的更多详细信息,请参阅手册页。

  1. $ man sosreport

就是这些了。希望这些有用。还有更多好东西。敬请关注! 

责任编辑:庞桂玉 来源: Linux中国
相关推荐

2019-05-23 14:36:24

LinuxSOSReportxsos

2013-08-19 09:53:01

系统监控lsof 监控工具

2022-06-12 21:28:26

Fluentd开源

2010-05-04 17:24:28

Unix系统

2010-04-28 14:52:55

Unix系统

2009-10-15 09:55:48

2011-08-17 13:53:03

2011-11-21 16:39:43

Syslog

2010-04-08 16:18:22

Unix操作系统工具

2011-04-02 11:20:01

2022-01-10 09:35:50

日志语言解析器

2018-09-05 10:43:47

MySQL诊断思路工具

2010-04-07 17:01:08

Unix命令

2022-02-18 15:19:52

日志收集工具开源

2010-04-30 13:43:16

Unix系统

2010-04-08 16:40:35

2014-12-15 10:06:13

linux诊断工具系统监控

2010-04-14 16:26:14

Unix操作系统

2010-05-10 19:03:00

Unix文件

2015-09-23 09:22:01

系统硬件命令
点赞
收藏

51CTO技术栈公众号