🇺🇳 Что такое sosreport🇺🇳 И как он помогает устранить проблемы в Linux

by itisgood

Что такое sosreport ?

Команда sosreport – это инструмент, который собирает множество сведений о конфигурации, системной информации и диагностической информации из работающей системы (особенно системы RHEL & OEL).

Это помогает инженеру технической поддержки анализировать систему во многих аспектах.

Эти отчеты содержат набор информации о системе, такой как информация о загрузке, файловая система, память, имя хоста, установленные rpms, IP-адрес системы, сведения о сети, версия ОС, установленное ядро, загруженные модули ядра, список открытых файлов, список устройств PCI, монтирование точка и ее детали, информация о запущенном процессе, вывод дерева процессов, системная маршрутизация, все файлы конфигурации, которые находятся в папке /etc, и все файлы журналов, которые находятся в папке /var.

Создание отчета займет некоторое время, и это зависит от установки и конфигурации вашей системы.

После завершения sosreport создаст сжатый архивный файл в каталоге /tmp.

Мы должны предоставить sosreport инженеру технической поддержки RHEL (Red Hat Enterprise Linux) и OEL (Oracle Enterprise Linux) всякий раз, когда мы обсуждаем что-то с ними для первоначального анализа.

Это помогает инженеру службы поддержки проверить, что не так в системе.

Как установить sosreport

Установка sosreport не составит большого труда, просто запустите следующую команду, чтобы установить ее.

Для RHEL / CentOS используйте команду YUM для установки sosreport.

# yum install sos

Для Debian / Ubuntu используйте команду APT-GET или APT, чтобы установить sosreport.

# apt-get install sosreport

Как сформировать sosreport

Кроме того, генерация sosreport’а также не составит большого труда, поэтому просто запустите команду sosreport без каких-либо опций.

По умолчанию она не отображает много информации при генерации sosreport, а отображает только количество сгенерированных отчетов.

Если вы хотите увидеть подробную информацию, просто добавьте опцию -v при генерации sosreport.

Вам будет предложено ввести ваше имя и информацию о поддержке.

# sosreport

sosreport (version 3.2)

This command will collect diagnostic and configuration information from this Oracle Linux system and installed applications.

An archive containing the collected information will be generated in /tmp/sos.3pt1yJ and may be provided to a Oracle USA support representative.

Any information provided to Oracle USA will be treated in accordance with the published support policies at:

  http://linux.oracle.com/

The generated archive may contain data considered sensitive and its content should be reviewed by the originating organization before being passed to any third party.

No changes will be made to system configuration.

Press ENTER to continue, or CTRL-C to quit.

Please enter your first initial and last name [oracle.2daygeek.com]: 2daygeek
Please enter the case id that you are generating this report for []: 3-16619296812

Setting up archive ...
Setting up plugins ...
dbname must be supplied to dump a database.
Running plugins. Please wait ...

  Running 86/86: yum...
[plugin:kvm] could not unmount /sys/kernel/debug
Creating compressed archive...

Your sosreport has been generated and saved in:

  /tmp/sosreport-2daygeek.3-16619296812-20180307124921.tar.xz
  
The checksum is: 4e80226ae175bm185c0o2d7u2yoac52o

Please send this file to your support representative.

Какие данные содержатся в архиве

Мне просто любопытно, какие подробности есть в архивном файле.

Чтобы понять это, я собираюсь извлечь архивный файл в моей системе.

Запустите следующую команду, чтобы извлечь файл архива.

# tar -xf /tmp/sosreport-2daygeek.3-16619296812-20180307124921.tar.xz

Чтобы увидеть, какую информацию захватывает sosreport, перейдите в каталог извлеченных файлов.

# ls -lh sosreport-2daygeek.3-16619296812-20180307124921

total 60K
dr-xr-xr-x  4 root root 4.0K Sep 30 10:56 boot
lrwxrwxrwx  1 root root   37 Oct 20 07:25 chkconfig -> sos_commands/startup/chkconfig_--list
lrwxrwxrwx  1 root root   25 Oct 20 07:25 date -> sos_commands/general/date
lrwxrwxrwx  1 root root   27 Oct 20 07:25 df -> sos_commands/filesys/df_-al
lrwxrwxrwx  1 root root   31 Oct 20 07:25 dmidecode -> sos_commands/hardware/dmidecode
drwxr-xr-x 43 root root 4.0K Oct 20 07:21 etc
lrwxrwxrwx  1 root root   24 Oct 20 07:25 free -> sos_commands/memory/free
lrwxrwxrwx  1 root root   29 Oct 20 07:25 hostname -> sos_commands/general/hostname
lrwxrwxrwx  1 root root  130 Oct 20 07:25 installed-rpms -> sos_commands/rpm/sh_-c_rpm_--nodigest_-qa_--qf_NAME_-_VERSION_-_RELEASE_._ARCH_INSTALLTIME_date_awk_-F_printf_-59s_s_n_1_2_sort_-f
lrwxrwxrwx  1 root root   34 Oct 20 07:25 ip_addr -> sos_commands/networking/ip_-o_addr
lrwxrwxrwx  1 root root   45 Oct 20 07:25 java -> sos_commands/java/alternatives_--display_java
drwxr-xr-x  4 root root 4.0K Sep 30 10:56 lib
lrwxrwxrwx  1 root root   35 Oct 20 07:25 lsb-release -> sos_commands/lsbrelease/lsb_release
lrwxrwxrwx  1 root root   25 Oct 20 07:25 lsmod -> sos_commands/kernel/lsmod
lrwxrwxrwx  1 root root   36 Oct 20 07:25 lsof -> sos_commands/process/lsof_-b_M_-n_-l
lrwxrwxrwx  1 root root   22 Oct 20 07:25 lspci -> sos_commands/pci/lspci
lrwxrwxrwx  1 root root   29 Oct 20 07:25 mount -> sos_commands/filesys/mount_-l
lrwxrwxrwx  1 root root   38 Oct 20 07:25 netstat -> sos_commands/networking/netstat_-neopa
drwxr-xr-x  3 root root 4.0K Oct 19 16:16 opt
dr-xr-xr-x 10 root root 4.0K Jun 23  2017 proc
lrwxrwxrwx  1 root root   30 Oct 20 07:25 ps -> sos_commands/process/ps_auxwww
lrwxrwxrwx  1 root root   27 Oct 20 07:25 pstree -> sos_commands/process/pstree
dr-xr-x---  2 root root 4.0K Oct 17 12:09 root
lrwxrwxrwx  1 root root   32 Oct 20 07:25 route -> sos_commands/networking/route_-n
dr-xr-xr-x  2 root root 4.0K Sep 30 10:55 sbin
drwx------ 54 root root 4.0K Oct 20 07:21 sos_commands
drwx------  2 root root 4.0K Oct 20 07:21 sos_logs
drwx------  2 root root 4.0K Oct 20 07:21 sos_reports
dr-xr-xr-x  6 root root 4.0K Jun 23  2017 sys
lrwxrwxrwx  1 root root   28 Oct 20 07:25 uname -> sos_commands/kernel/uname_-a
lrwxrwxrwx  1 root root   27 Oct 20 07:25 uptime -> sos_commands/general/uptime
drwxr-xr-x  6 root root 4.0K Sep 25  2014 var
-rw-------  1 root root 1.7K Oct 20 07:21 version.txt
lrwxrwxrwx  1 root root   62 Oct 20 07:25 vgdisplay -> sos_commands/lvm2/vgdisplay_-vv_--config_global_locking_type_0

Чтобы дважды подтвердить, что именно было записано в sosreport, я посмотрю выходной файл uname, который был захвачен sosreport.

# more uname_-a
Linux oracle.2daygeek.com 2.6.32-042stab127.2 #1 SMP Thu Jan 4 16:41:44 MSK 2018 x86_64 x86_64 x86_64 GNU/Linux

Дополнительные опции

Просмотрите информацию справки, чтобы просмотреть все доступные опции для sosreport.

# sosreport --help
Usage: sosreport [options]

Options:
  -h, --help            show this help message and exit
  -l, --list-plugins    list plugins and available plugin options
  -n NOPLUGINS, --skip-plugins=NOPLUGINS
                        disable these plugins
  -e ENABLEPLUGINS, --enable-plugins=ENABLEPLUGINS
                        enable these plugins
  -o ONLYPLUGINS, --only-plugins=ONLYPLUGINS
                        enable these plugins only
  -k PLUGOPTS, --plugin-option=PLUGOPTS
                        plugin options in plugname.option=value format (see
                        -l)
  --log-size=LOG_SIZE   set a limit on the size of collected logs
  -a, --alloptions      enable all options for loaded plugins
  --all-logs            collect all available logs regardless of size
  --batch               batch mode - do not prompt interactively
  --build               preserve the temporary directory and do not package
                        results
  -v, --verbose         increase verbosity
  --verify              perform data verification during collection
  --quiet               only print fatal errors
  --debug               enable interactive debugging using the python debugger
  --ticket-number=CASE_ID
                        specify ticket number
  --case-id=CASE_ID     specify case identifier
  -p PROFILES, --profile=PROFILES
                        enable plugins selected by the given profiles
  --list-profiles
  --name=CUSTOMER_NAME  specify report name
  --config-file=CONFIG_FILE
                        specify alternate configuration file
  --tmp-dir=TMP_DIR     specify alternate temporary directory
  --no-report           Disable HTML/XML reporting
  -z COMPRESSION_TYPE, --compression-type=COMPRESSION_TYPE
                        compression technology to use [auto, gzip, bzip2, xz]
                        (default=auto)

Some examples:

 enable cluster plugin only and collect dlm lockdumps:
   # sosreport -o cluster -k cluster.lockdump

 disable memory and samba plugins, turn off rpm -Va collection:
   # sosreport -n memory,samba -k rpm.rpmva=off

You may also like

Leave a Comment