xsos: a tool to read sosreport in RHEL/CentOS

Learn how to use xsos tool to read sosreport in RHEL/CentOS. xsos is a very helpful tool for Linux sysadmins. Different options and their examples included in the article.

xsos tool to read sosreport

an xsos tool is a tool coded to read a sosreport on Linux systems. sosreport is a tool from RedHat which collects system information which helps vendors to troubleshoot issues. sosreport creates the tarball which contains all the system information but you can not read it directly. For simplicity, Ryan Sawhill created a tool named xsos which will help you to read sosreport in a much easier way in your terminal itself. In this article, we will walk you through how to read sosreport on the Linux terminal.

xsos installation

xsos rpm is available on Ryan’s page on redhat.com. One can simply use the URL as below to install his yum repo and then install the xsos package.

yum install http://people.redhat.com/rsawhill/rpms/latest-rsawaroha-release.rpm &

yum install xsos

Refer below outputs for your reference.

root@kerneltalks # yum install http://people.redhat.com/rsawhill/rpms/latest-rsawaroha-release.rpm
Loaded plugins: amazon-id, rhui-lb, search-disabled-repos
latest-rsawaroha-release.rpm                             |  24 kB     00:00
Examining /var/tmp/yum-root-b0cGf5/latest-rsawaroha-release.rpm: rsawaroha-release-1-1.noarch
Marking /var/tmp/yum-root-b0cGf5/latest-rsawaroha-release.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package rsawaroha-release.noarch 0:1-1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package               Arch       Version   Repository                     Size
================================================================================
Installing:
 rsawaroha-release     noarch     1-1       /latest-rsawaroha-release      27 k

Transaction Summary
================================================================================
Install  1 Package

Total size: 27 k
Installed size: 27 k
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : rsawaroha-release-1-1.noarch                                 1/1
  Verifying  : rsawaroha-release-1-1.noarch                                 1/1

Installed:
  rsawaroha-release.noarch 0:1-1

Complete!


root@kerneltalks # yum install xsos
Loaded plugins: amazon-id, rhui-lb, search-disabled-repos
rsawaroha                                                | 2.9 kB     00:00
rsawaroha/primary_db                                       |  11 kB   00:00
Resolving Dependencies
--> Running transaction check
---> Package xsos.noarch 0:0.7.13-1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package        Arch             Version              Repository           Size
================================================================================
Installing:
 xsos           noarch           0.7.13-1             rsawaroha            54 k

Transaction Summary
================================================================================
Install  1 Package

Total download size: 54 k
Installed size: 137 k
Is this ok [y/d/N]: y
Downloading packages:
warning: /var/cache/yum/x86_64/7Server/rsawaroha/packages/latest-xsos.rpm: Header V4 RSA/SHA256 Signature, key ID 4c4ffd02: NOKEY
Public key for latest-xsos.rpm is not installed
latest-xsos.rpm                                            |  54 kB   00:00
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rsaw.aroha
Importing GPG key 0x4C4FFD02:
 Userid     : "Ryan Sawhill Aroha <rsaw@redhat.com>"
 Fingerprint: bac2 74b8 9f6b 5907 b3d0 e467 fba4 72a7 4c4f fd02
 Package    : rsawaroha-release-1-1.noarch (installed)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-rsaw.aroha
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : xsos-0.7.13-1.noarch                                         1/1
  Verifying  : xsos-0.7.13-1.noarch                                         1/1

Installed:
  xsos.noarch 0:0.7.13-1

Complete!

Now xsos utility is installed on your system. Lets check it out.

Using xsos

Without any argument, running xsos command will give you current system information in a summarized format.

root@kerneltalks # xsos
OS
  Hostname: kerneltalks
  Distro:   [redhat-release] Red Hat Enterprise Linux Server release 7.4 (Maipo)
            [os-release] Red Hat Enterprise Linux Server 7.4 (Maipo) 7.4 (Maipo)
  RHN:      serverURL = https://enter.your.server.url.here/XMLRPC
            enableProxy = 0
  RHSM:     hostname = subscription.rhsm.redhat.com
            proxy_hostname =
  YUM:      4 enabled plugins: amazon-id, langpacks, rhui-lb, search-disabled-repos
  Runlevel: N 3  (default multi-user)
  SELinux:  enforcing  (default enforcing)
  Arch:     mach=x86_64  cpu=x86_64  platform=x86_64
  Kernel:
    Booted kernel:  3.10.0-693.11.6.el7.x86_64
    GRUB default:   3.10.0-693.11.6.el7.x86_64
    Build version:
      Linux version 3.10.0-693.11.6.el7.x86_64 (mockbuild@x86-041.build.eng.bos.redhat.com) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC) ) #1 SMP Thu Dec 28
      14:23:39 EST 2017
    Booted kernel cmdline:
      root=UUID=3e11801e-5277-4d87-be4c-0a9a61fbc3da ro console=ttyS0,115200n8 console=tty0 net.ifnames=0 crashkernel=auto LANG=en_US.UTF-8
    GRUB default kernel cmdline:
      ro root=UUID=3e11801e-5277-4d87-be4c-0a9a61fbc3da console=hvc0 LANG=en_US.UTF-8
    Taint-check: 0  (kernel untainted)
    - - - - - - - - - - - - - - - - - - -
  Sys time:  Mon Jan  8 18:13:30 UTC 2018
  Boot time: Mon Jan  8 18:05:57 UTC 2018  (epoch: 1515434757)
  Uptime:    7 min,  1 user
  LoadAvg:   [1 CPU] 0.00 (0%), 0.01 (1%), 0.01 (1%)
  /proc/stat:
    procs_running: 2   procs_blocked: 0    processes [Since boot]: 1132
    cpu [Utilization since boot]:
      us 1%, ni 0%, sys 2%, idle 94%, iowait 0%, irq 0%, sftirq 0%, steal 3%

It shows system info like hostname, distro details, kernel details, arch details, yum config, date & time, and load information.

Now there are different switches you can use with xsos command and get the required details. Frequently used switches given below –

 -a     show everything
 -b     show info from dmidecode
 -o     show hostname, distro, SELinux, kernel info, uptime, etc
 -k     inspect kdump configuration
 -c     show info from /proc/cpuinfo
 -m     show info from /proc/meminfo
 -d     show info from /proc/partitions
 -t     show info from dm-multipath
 -i     show info from ip addr

Above is a snippet from help. Full list of switches can be obtained by running help using xsos -h

Reading sosreport using xsos

To read sosreport using xsos tool, you need to first extract sosreport tarball and use the extracted directory path as a source for the xsos tool. The command format is –

xsos –<switch> <sosreport_dir_path>

For example, lets see CPU information read from sosreport.

root@kerneltalks # xsos -c /var/tmp/sosreport-kerneltalks-20180108180100
CPU
  1 logical processors
  1 Intel Xeon CPU E5-2676 v3 @ 2.40GHz (flags: aes,constant_tsc,ht,lm,nx,pae,rdrand)

Here, -c instructs xsos command to read CPU information from sosreport which is saved in /var/tmp/sosreport-kerneltalks-20180108180100 directory.

Another example below which reads IP information from sosreport.

root@kerneltalks # xsos -i /var/tmp/sosreport-kerneltalks-20180108180100
IP4
  Interface  Master IF  MAC Address        MTU     State  IPv4 Address
  =========  =========  =================  ======  =====  ==================
  lo         -          -                  65536   up     127.0.0.1/8
  eth0       -          02:e5:4c:f8:86:0e  9001    up     172.31.29.189/20

IP6
  Interface  Master IF  MAC Address        MTU     State  IPv6 Address                                 Scope
  =========  =========  =================  ======  =====  ===========================================  =====
  lo         -          -                  65536   up     ::1/128                                      host
  eth0       -          02:e5:4c:f8:86:0e  9001    up     fe80::e5:4cff:fef8:860e/64                   link

you can see IP information fetched from stored sosreport and displayed for your understanding.

You can use different switches to fetch different information as per your requirement from the sosreport. This way you need not go through each and every logfile or log directory extracted in the sosreport directory to get the information. Just use a relevant switch with xsos utility and it will scan the sosreport directory and present your data!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.