xsos:一个在Linux上阅读SOSReport的工具

系统 Linux
我们都已经知道 SOSReport。它用来收集可用于诊断的系统信息。Redhat 的支持服务建议我们在提交案例时提供 SOSReport 来分析当前的系统状态。那么,在 Linux 中使用语法高亮显示阅读所有这些内容的最佳方法是什么。是的,这可以通过 xsos 工具做到。

[[266272]]

我们都已经知道 SOSReport。它用来收集可用于诊断的系统信息。Redhat 的支持服务建议我们在提交案例时提供 SOSReport 来分析当前的系统状态。

它会收集全部类型的报告,以帮助用户找出问题的根本原因。我们可以轻松地提取和阅读 SOSReport,但它很难阅读。因为它的每个部分都是一个单独的文件。

那么,在 Linux 中使用语法高亮显示阅读所有这些内容的***方法是什么。是的,这可以通过 xsos 工具做到。

sosreport

sosreport 命令是一个从运行中的系统(尤其是 RHEL 和 OEL 系统)收集大量配置细节、系统信息和诊断信息的工具。它可以帮助技术支持工程师在很多方面分析系统。

此报告包含有关系统的大量信息,例如引导信息、文件系统、内存、主机名、已安装的 RPM、系统 IP、网络详细信息、操作系统版本、已安装的内核、已加载的内核模块、打开的文件列表、PCI 设备列表、挂载点及其细节、运行中的进程信息、进程树输出、系统路由、位于 /etc 文件夹中的所有配置文件,以及位于 /var 文件夹中的所有日志文件。

这将需要一段时间来生成报告,这取决于你的系统安装和配置。

完成后,sosreport 将在 /tmp 目录下生成一个压缩的归档文件。

xsos

xsos 是一个帮助用户轻松读取 Linux 系统上的 sosreport 的工具。另一方面,我们可以说它是 sosreport 考官。

它可以立即从 sosreport 或正在运行的系统中汇总系统信息。

xsos 将尝试简化、解析、计算并格式化来自数十个文件(和命令)的数据,以便为你提供有关系统的详细概述。

你可以通过运行以下命令立即汇总系统信息。

  1. # curl -Lo ./xsos bit.ly/xsos-direct; chmod +x ./xsos; ./xsos -ya

如何在 Linux 上安装 xsos

我们可以使用以下两种方法轻松安装 xsos

如果你正在寻找***的前沿版本。使用以下步骤:

  1. # curl -Lo /usr/local/bin/xsos bit.ly/xsos-direct
  2. # chmod +x /usr/local/bin/xsos

下面是安装 xsos 的推荐方法。它将从 rpm 文件安装 xsos

  1. # yum install http://people.redhat.com/rsawhill/rpms/latest-rsawaroha-release.rpm
  2. # yum install xsos

如何在 Linux 上使用 xsos

一旦通过上述方法之一安装了 xsos。只需运行 xsos 命令,不带任何选项,它们会显示有关系统的基本信息。

  1. # xsos
  2.  
  3. OS
  4. Hostname: CentOS7.2daygeek.com
  5. Distro: [redhat-release] CentOS Linux release 7.6.1810 (Core)
  6. [centos-release] CentOS Linux release 7.6.1810 (Core)
  7. [os-release] CentOS Linux 7 (Core) 7 (Core)
  8. RHN: (missing)
  9. RHSM: (missing)
  10. YUM: 2 enabled plugins: fastestmirror, langpacks
  11. Runlevel: N 5 (default graphical)
  12. SELinux: enforcing (default enforcing)
  13. Arch: mach=x86_64 cpu=x86_64 platform=x86_64
  14. Kernel:
  15. Booted kernel: 3.10.0-957.el7.x86_64
  16. GRUB default: 3.10.0-957.el7.x86_64
  17. Build version:
  18. Linux version 3.10.0-957.el7.x86_64 ([email protected]) (gcc version 4.8.5 20150623 (Red
  19. Hat 4.8.5-36) (GCC) ) #1 SMP Thu Nov 8 23:39:32 UTC 2018
  20. Booted kernel cmdline:
  21. root=/dev/mapper/centos-root ro crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet
  22. LANG=en_US.UTF-8
  23. GRUB default kernel cmdline:
  24. root=/dev/mapper/centos-root ro crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet
  25. LANG=en_US.UTF-8
  26. Taint-check: 0 (kernel untainted)
  27. - - - - - - - - - - - - - - - - - - -
  28. Sys time: Sun May 12 10:05:21 CDT 2019
  29. Boot time: Sun May 12 09:50:20 CDT 2019 (epoch: 1557672620)
  30. Time Zone: America/Chicago
  31. Uptime: 15 min, 1 user
  32. LoadAvg: [1 CPU] 0.00 (0%), 0.04 (4%), 0.09 (9%)
  33. /proc/stat:
  34. procs_running: 2 procs_blocked: 0 processes [Since boot]: 6423
  35. cpu [Utilization since boot]:
  36. us 1%, ni 0%, sys 1%, idle 99%, iowait 0%, irq 0%, sftirq 0%, steal 0%

如何使用 xsos 命令在 Linux 中查看生成的 SOSReport 输出?

我们需要份 SOSReport 以使用 xsos 命令进一步阅读。

是的,我已经生成了一个 SOSReport,文件如下。

  1. # ls -lls -lh /var/tmp/sosreport-CentOS7-01-1005-2019-05-12-pomeqsa.tar.xz
  2. 9.8M -rw-------. 1 root root 9.8M May 12 10:13 /var/tmp/sosreport-CentOS7-01-1005-2019-05-12-pomeqsa.tar.xz

运行如下命令解开它。

  1. # tar xf sosreport-CentOS7-01-1005-2019-05-12-pomeqsa.tar.xz

要查看全部信息,带上 -a--all 开关运行 xsos

  1. # xsos --all /var/tmp/sosreport-CentOS7-01-1005-2019-05-12-pomeqsa

要查看 BIOS 信息,带上 -b--bios 开关运行 xsos

  1. # xsos --bios /var/tmp/sosreport-CentOS7-01-1005-2019-05-12-pomeqsa
  2. DMIDECODE
  3. BIOS:
  4. Vend: innotek GmbH
  5. Vers: VirtualBox
  6. Date: 12/01/2006
  7. BIOS Rev:
  8. FW Rev:
  9. System:
  10. Mfr: innotek GmbH
  11. Prod: VirtualBox
  12. Vers: 1.2
  13. Ser: 0
  14. UUID: 002f47b8-2af2-48f5-be1d-67b67e03514c
  15. CPU:
  16. 0 of 0 CPU sockets populated, 0 cores/0 threads per CPU
  17. 0 total cores, 0 total threads
  18. Mfr:
  19. Fam:
  20. Freq:
  21. Vers:
  22. Memory:
  23. Total: 0 MiB (0 GiB)
  24. DIMMs: 0 of 0 populated
  25. MaxCapacity: 0 MiB (0 GiB / 0.00 TiB)

要查看系统基本信息,如主机名、发行版、SELinux、内核信息、正常运行时间等,请使用 -o--os 开关运行 xsos

  1. # xsos --os /var/tmp/sosreport-CentOS7-01-1005-2019-05-12-pomeqsa
  2. OS
  3. Hostname: CentOS7.2daygeek.com
  4. Distro: [redhat-release] CentOS Linux release 7.6.1810 (Core)
  5. [centos-release] CentOS Linux release 7.6.1810 (Core)
  6. [os-release] CentOS Linux 7 (Core) 7 (Core)
  7. RHN: (missing)
  8. RHSM: (missing)
  9. YUM: 2 enabled plugins: fastestmirror, langpacks
  10. SELinux: enforcing (default enforcing)
  11. Arch: mach=x86_64 cpu=x86_64 platform=x86_64
  12. Kernel:
  13. Booted kernel: 3.10.0-957.el7.x86_64
  14. GRUB default: 3.10.0-957.el7.x86_64
  15. Build version:
  16. Linux version 3.10.0-957.el7.x86_64 ([email protected]) (gcc version 4.8.5 20150623 (Red
  17. Hat 4.8.5-36) (GCC) ) #1 SMP Thu Nov 8 23:39:32 UTC 2018
  18. Booted kernel cmdline:
  19. root=/dev/mapper/centos-root ro crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet
  20. LANG=en_US.UTF-8
  21. GRUB default kernel cmdline:
  22. root=/dev/mapper/centos-root ro crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet
  23. LANG=en_US.UTF-8
  24. Taint-check: 536870912 (see https://access.redhat.com/solutions/40594)
  25. 29 TECH_PREVIEW: Technology Preview code is loaded
  26. - - - - - - - - - - - - - - - - - - -
  27. Sys time: Sun May 12 10:12:22 CDT 2019
  28. Boot time: Sun May 12 09:50:20 CDT 2019 (epoch: 1557672620)
  29. Time Zone: America/Chicago
  30. Uptime: 22 min, 1 user
  31. LoadAvg: [1 CPU] 1.19 (119%), 0.27 (27%), 0.14 (14%)
  32. /proc/stat:
  33. procs_running: 8 procs_blocked: 2 processes [Since boot]: 9005
  34. cpu [Utilization since boot]:
  35. us 1%, ni 0%, sys 1%, idle 99%, iowait 0%, irq 0%, sftirq 0%, steal 0%

要查看 kdump 配置,请使用 -k--kdump 开关运行 xsos

  1. # xsos --kdump /var/tmp/sosreport-CentOS7-01-1005-2019-05-12-pomeqsa
  2. KDUMP CONFIG
  3. kexec-tools rpm version:
  4. kexec-tools-2.0.15-21.el7.x86_64
  5. Service enablement:
  6. UNIT STATE
  7. kdump.service enabled
  8. kdump initrd/initramfs:
  9. 13585734 Feb 19 05:51 initramfs-3.10.0-957.el7.x86_64kdump.img
  10. Memory reservation config:
  11. /proc/cmdline { crashkernel=auto }
  12. GRUB default { crashkernel=auto }
  13. Actual memory reservation per /proc/iomem:
  14. 2a000000-340fffff : Crash kernel
  15. kdump.conf:
  16. path /var/crash
  17. core_collector makedumpfile -l --message-level 1 -d 31
  18. kdump.conf "path" available space:
  19. System MemTotal (uncompressed core size) { 1.80 GiB }
  20. Available free space on target path's fs { 22.68 GiB } (fs=/)
  21. Panic sysctls:
  22. kernel.sysrq [bitmask] = "16" (see proc man page)
  23. kernel.panic [secs] = 0 (no autoreboot on panic)
  24. kernel.hung_task_panic = 0
  25. kernel.panic_on_oops = 1
  26. kernel.panic_on_io_nmi = 0
  27. kernel.panic_on_unrecovered_nmi = 0
  28. kernel.panic_on_stackoverflow = 0
  29. kernel.softlockup_panic = 0
  30. kernel.unknown_nmi_panic = 0
  31. kernel.nmi_watchdog = 1
  32. vm.panic_on_oom [0-2] = 0 (no panic)

要查看有关 CPU 的信息,请使用 -c--cpu 开关运行 xsos

  1. # xsos --cpu /var/tmp/sosreport-CentOS7-01-1005-2019-05-12-pomeqsa
  2. CPU
  3. 1 logical processors
  4. 1 Intel Core i7-6700HQ CPU @ 2.60GHz (flags: aes,constant_tsc,ht,lm,nx,pae,rdrand)

要查看内存利用情况,请使用 -m--mem 开关运行 xsos

  1. # xsos --mem /var/tmp/sosreport-CentOS7-01-1005-2019-05-12-pomeqsa
  2. MEMORY
  3. Stats graphed as percent of MemTotal:
  4. MemUsed ▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊..................... 58.8%
  5. Buffers .................................................. 0.6%
  6. Cached ▊▊▊▊▊▊▊▊▊▊▊▊▊▊▊................................... 29.9%
  7. HugePages .................................................. 0.0%
  8. Dirty .................................................. 0.7%
  9. RAM:
  10. 1.8 GiB total ram
  11. 1.1 GiB (59%) used
  12. 0.5 GiB (28%) used excluding Buffers/Cached
  13. 0.01 GiB (1%) dirty
  14. HugePages:
  15. No ram pre-allocated to HugePages
  16. LowMem/Slab/PageTables/Shmem:
  17. 0.09 GiB (5%) of total ram used for Slab
  18. 0.02 GiB (1%) of total ram used for PageTables
  19. 0.01 GiB (1%) of total ram used for Shmem
  20. Swap:
  21. 0 GiB (0%) used of 2 GiB total

要查看添加的磁盘信息,请使用 -d-disks 开关运行 xsos

  1. # xsos --disks /var/tmp/sosreport-CentOS7-01-1005-2019-05-12-pomeqsa
  2. STORAGE
  3. Whole Disks from /proc/partitions:
  4. 2 disks, totaling 40 GiB (0.04 TiB)
  5. - - - - - - - - - - - - - - - - - - - - -
  6. Disk Size in GiB
  7. ---- -----------
  8. sda 30
  9. sdb 10

要查看网络接口配置,请使用 -e--ethtool 开关运行 xsos

  1. # xsos --ethtool /var/tmp/sosreport-CentOS7-01-1005-2019-05-12-pomeqsa
  2. ETHTOOL
  3. Interface Status:
  4. enp0s10 0000:00:0a.0 link=up 1000Mb/s full (autoneg=Y) rx ring 256/4096 drv e1000 v7.3.21-k8-NAPI / fw UNKNOWN
  5. enp0s9 0000:00:09.0 link=up 1000Mb/s full (autoneg=Y) rx ring 256/4096 drv e1000 v7.3.21-k8-NAPI / fw UNKNOWN
  6. virbr0 N/A link=DOWN rx ring UNKNOWN drv bridge v2.3 / fw N/A
  7. virbr0-nic tap link=DOWN rx ring UNKNOWN drv tun v1.6 / fw UNKNOWN

要查看有关 IP 地址的信息,请使用 -i--ip 开关运行 xsos

  1. # xsos --ip /var/tmp/sosreport-CentOS7-01-1005-2019-05-12-pomeqsa
  2. IP4
  3. Interface Master IF MAC Address MTU State IPv4 Address
  4. ========= ========= ================= ====== ===== ==================
  5. lo - - 65536 up 127.0.0.1/8
  6. enp0s9 - 08:00:27:0b:bc:e9 1500 up 192.168.1.8/24
  7. enp0s10 - 08:00:27:b2:08:91 1500 up 192.168.1.9/24
  8. virbr0 - 52:54:00:ae:01:94 1500 up 192.168.122.1/24
  9. virbr0-nic virbr0 52:54:00:ae:01:94 1500 DOWN -
  10.  
  11. IP6
  12. Interface Master IF MAC Address MTU State IPv6 Address Scope
  13. ========= ========= ================= ====== ===== =========================================== =====
  14. lo - - 65536 up ::1/128 host
  15. enp0s9 - 08:00:27:0b:bc:e9 1500 up fe80::945b:8333:f4bc:9723/64 link
  16. enp0s10 - 08:00:27:b2:08:91 1500 up fe80::7ed4:1fab:23c3:3790/64 link
  17. virbr0 - 52:54:00:ae:01:94 1500 up - -
  18. virbr0-nic virbr0 52:54:00:ae:01:94 1500 DOWN - -

要通过 ps 查看正在运行的进程,请使用 -p--ps 开关运行 xsos

  1. # xsos --ps /var/tmp/sosreport-CentOS7-01-1005-2019-05-12-pomeqsa
  2. PS CHECK
  3. Total number of threads/processes:
  4. 501 / 171
  5. Top users of CPU & MEM:
  6. USER %CPU %MEM RSS
  7. root 20.6% 14.1% 0.30 GiB
  8. gdm 0.3% 16.8% 0.33 GiB
  9. postfix 0.0% 0.6% 0.01 GiB
  10. polkitd 0.0% 0.6% 0.01 GiB
  11. daygeek 0.0% 0.2% 0.00 GiB
  12. colord 0.0% 0.4% 0.01 GiB
  13. Uninteruptible sleep threads/processes (0/0):
  14. [None]
  15. Defunct zombie threads/processes (0/0):
  16. [None]
  17. Top CPU-using processes:
  18. USER PID %CPU %MEM VSZ-MiB RSS-MiB TTY STAT START TIME COMMAND
  19. root 6542 15.6 4.2 875 78 pts/0 Sl+ 10:11 0:07 /usr/bin/python /sbin/sosreport
  20. root 7582 3.0 0.1 10 2 pts/0 S 10:12 0:00 /bin/bash /usr/sbin/dracut --print-cmdline
  21. root 7969 0.7 0.1 95 4 ? Ss 10:12 0:00 /usr/sbin/certmonger -S -p
  22. root 7889 0.4 0.2 24 4 ? Ss 10:12 0:00 /usr/lib/systemd/systemd-hostnamed
  23. gdm 3866 0.3 7.1 2856 131 ? Sl 09:50 0:04 /usr/bin/gnome-shell
  24. root 8553 0.2 0.1 47 3 ? S 10:12 0:00 /usr/lib/systemd/systemd-udevd
  25. root 6971 0.2 0.4 342 9 ? Sl 10:12 0:00 /usr/sbin/abrt-dbus -t133
  26. root 3200 0.2 0.9 982 18 ? Ssl 09:50 0:02 /usr/sbin/libvirtd
  27. root 2855 0.1 0.1 88 3 ? Ss 09:50 0:01 /sbin/rngd -f
  28. rtkit 2826 0.0 0.0 194 2 ? SNsl 09:50 0:00 /usr/libexec/rtkit-daemon
  29. Top MEM-using processes:
  30. USER PID %CPU %MEM VSZ-MiB RSS-MiB TTY STAT START TIME COMMAND
  31. gdm 3866 0.3 7.1 2856 131 ? Sl 09:50 0:04 /usr/bin/gnome-shell
  32. root 6542 15.6 4.2 875 78 pts/0 Sl+ 10:11 0:07 /usr/bin/python /sbin/sosreport
  33. root 3264 0.0 1.2 271 23 tty1 Ssl+ 09:50 0:00 /usr/bin/X :0 -background
  34. root 3200 0.2 0.9 982 18 ? Ssl 09:50 0:02 /usr/sbin/libvirtd
  35. root 3189 0.0 0.9 560 17 ? Ssl 09:50 0:00 /usr/bin/python2 -Es /usr/sbin/tuned
  36. gdm 4072 0.0 0.9 988 17 ? Sl 09:50 0:00 /usr/libexec/gsd-media-keys
  37. gdm 4076 0.0 0.8 625 16 ? Sl 09:50 0:00 /usr/libexec/gsd-power
  38. gdm 4056 0.0 0.8 697 16 ? Sl 09:50 0:00 /usr/libexec/gsd-color
  39. root 2853 0.0 0.7 622 14 ? Ssl 09:50 0:00 /usr/sbin/NetworkManager --no-daemon
  40. gdm 4110 0.0 0.7 544 14 ? Sl 09:50 0:00 /usr/libexec/gsd-wacom
  41. Top thread-spawning processes:
  42. # USER PID %CPU %MEM VSZ-MiB RSS-MiB TTY STAT START TIME COMMAND
  43. 17 root 3200 0.2 0.9 982 18 ? - 09:50 0:02 /usr/sbin/libvirtd
  44. 12 root 6542 16.1 4.5 876 83 pts/0 - 10:11 0:07 /usr/bin/python /sbin/sosreport
  45. 10 gdm 3866 0.3 7.1 2856 131 ? - 09:50 0:04 /usr/bin/gnome-shell
  46. 7 polkitd 2864 0.0 0.6 602 13 ? - 09:50 0:01 /usr/lib/polkit-1/polkitd --no-debug
  47. 6 root 2865 0.0 0.0 203 1 ? - 09:50 0:00 /usr/sbin/gssproxy -D
  48. 5 root 3189 0.0 0.9 560 17 ? - 09:50 0:00 /usr/bin/python2 -Es /usr/sbin/tuned
  49. 5 root 2823 0.0 0.3 443 6 ? - 09:50 0:00 /usr/libexec/udisks2/udisksd
  50. 5 gdm 4102 0.0 0.2 461 5 ? - 09:50 0:00 /usr/libexec/gsd-smartcard
  51. 4 root 3215 0.0 0.2 470 4 ? - 09:50 0:00 /usr/sbin/gdm
  52. 4 gdm 4106 0.0 0.2 444 5 ? - 09:50 0:00 /usr/libexec/gsd-sound

 

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

2021-09-08 08:36:50

ncursesLinux猜谜游戏

2021-02-03 19:46:01

工具Snipaste软件开发

2021-04-14 15:25:39

Linux加密文件保险库

2018-07-16 08:40:08

Linux段错误C++

2019-07-26 09:20:21

ClusterShel命令Linux

2018-01-19 12:56:19

Linux进程

2022-07-01 15:33:53

LinuxBash

2019-10-16 17:00:51

LinuxUbuntuVMware

2021-05-17 10:32:10

命令行工具GitHub代码

2020-12-08 10:33:56

DDoS攻击开源安全安全工具

2022-09-27 18:31:42

Komikku开源日漫阅读器

2021-02-04 11:11:08

开发技能工具

2021-02-04 11:46:49

GithubSQL工具Franchise

2019-08-02 15:39:06

PythonLinuxJSON

2012-11-21 11:48:23

i-NVMM加密密码

2012-03-02 12:14:19

JavaJstackJmap

2021-06-26 16:24:21

Linux命令系统

2012-08-13 10:16:34

IBMdW

2017-05-03 13:37:05

Linuxweb性能监测

2021-11-01 12:13:53

Linux僵尸进程
点赞
收藏

51CTO技术栈公众号