sosreport 를 이용한 Linux 시스템 분석

sosreport 를 이용한 Linux 시스템 분석
sosreport는 시스템 정보 및 하드웨어, 패키지 정보, 설정파일 등을 수집해 주는 명령어이다.
방화벽으로 접근이 불가능한 시스템이나, root 권한을 주지 않고 시스템에 대한 점검을 다른 사람에게 의뢰할 경우 유용하다.
그리고 주기적으로 sosreport를 수집해서 시스템 설정사항에 대한 백업 용도로도 사용이 가능하다.


1. 패키지 설치 확인

  [root@localhost ~]# rpm -qa | grep sos
  sos-3.2-54.el6.centos.noarch

  [root@localhost ~]# which sosreport
  /usr/sbin/sosreport

  [root@localhost ~]# rpm -qf /usr/sbin/sosreport 
  sos-3.2-54.el6.centos.noarch


2. sosreport 실행

  단순히 sosreport 명령만 실행하고, Enter 키를 계속 입력하기만 하면 된다. 
  필요에 따라 "-o" 옵션을 사용하여 원하는 정보만을 수집 할 수도 있다. 
  실행이 완료되면 /tmp/ 디렉토리에 결과 파일이 생성된다. 

  [root@localhost ~]# sosreport

  sosreport (version 3.2)

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

  An archive containing the collected information will be generated in
  /tmp/sos.s02_NE and may be provided to a Red Hat support representative.

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

    https://access.redhat.com/support/

  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.      <-- Enter 입력

  Please enter your first initial and last name [localhost.localdomain]:   <-- Enter 입력
  Please enter the case id that you are generating this report for []:     <-- Enter 입력

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

  Running 74/74: yum...
  Creating compressed archive...

  Your sosreport has been generated and saved in:
  /tmp/sosreport-localhost.localdomain-20180404044123.tar.xz

  The checksum is: 9b96b6f9745e7daada210326e81c4080

  Please send this file to your support representative.

  [root@localhost ~]#

2.1 "-o" 옵션으로 원하는 정보만 수집

  [root@localhost ~]# sosreport -o hardware -o kernel -o networking -o udev -o system -o rpm

  sosreport (version 3.2)

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

  An archive containing the collected information will be generated in
  /tmp/sos.cflGsP and may be provided to a Red Hat support representative.

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

    https://access.redhat.com/support/

  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.        <-- Enter 입력

  Please enter your first initial and last name [localhost.localdomain]:     <-- Enter 입력
  Please enter the case id that you are generating this report for []:       <-- Enter 입력

   Setting up archive ...
   Setting up plugins ...
   Running plugins. Please wait ...

   Running 1/6: hardware...
   Running 2/6: kernel...
   Running 3/6: networking...
   Running 4/6: rpm...
   Running 5/6: system...
   Running 6/6: udev...

  Creating compressed archive...

  Your sosreport has been generated and saved in:
  /tmp/sosreport-localhost.localdomain-20180404044554.tar.xz

  The checksum is: 79e21e961518aa458f4ccb57b4c955f9

  Please send this file to your support representative.

  [root@localhost ~]#

2.2 시간이 많이 걸리는 rpm패키지 정보를 제외하고 시스템 정보 수집

  [root@localhost ~]# sosreport -k rpm.rpmva=off

  sosreport (version 3.2)

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

  An archive containing the collected information will be generated in
  /tmp/sos.h1HzmV and may be provided to a Red Hat support representative.

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

    https://access.redhat.com/support/

  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.      <-- Enter 입력

  Please enter your first initial and last name [localhost.localdomain]:      <-- Enter 입력
  Please enter the case id that you are generating this report for []:        <-- Enter 입력

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

   Running 1/74: abrt...
   Running 2/74: acpid... 
   Running 3/74: anaconda...
   Running 4/74: anacron...
   Running 5/74: ata...
   Running 6/74: auditd...
   Running 7/74: block...
   Running 8/74: boot...
   Running 9/74: cgroups...
   Running 10/74: cron...
   Running 11/74: cups...
   Running 12/74: dbus...
   Running 13/74: devicemapper...
   Running 14/74: dmraid...
   Running 15/74: filesys...
   Running 16/74: gdm...
   Running 17/74: gener al...
   Running 18/74: grub...
   Running 19/74: hardware...
   Running 20/74: hardwaretestsuite...
   Running 21/74: i18n...
   Running 22/74: java...
   Running 23/74: kdump...
   Running 24/74: kernel...
   Running 25/74: keyutils...
   Running 26/74: krb5...
   Running 27/74: ldap...
   Running 28/74: libraries...
   Running 29/74: libvirt...
   Running 30/74: logrotate...
   Running 31/74: logs...
   Running 32/74: lsbrelease...
   Running 33/74: lvm2...
   Running 34/74: md...
   Running 35/74: megacli...
   Running 36/74: memory...
   Running 37/74: mrggrid...
   Running 38/74: mrgmessg...
   Running 39/74: multipath...
   Running 40/74: networking...
   Running 41/74: nfs...
   Running 42/74: nis...
   Running 43/74: ntp...
   Running 44/74: numa...
   Running 45/74: openhpi...
   Running 46/74: openshift...
   Running 47/74: openssl...
   Running 48/74: pam...
   Running 49/74: pci...
   Running 50/74: postgresql...
   Running 51/74: process...
   Running 52/74: processor...
   Running 53/74: psacct...
   Running 54/74: puppet...
   Running 55/74: python...
   Running 56/74: rpm...
   Running 57/74: sar...
   Running 58/74: scsi...
   Running 59/74: selinux...
   Running 60/74: soundcard...
   Running 61/74: ssh...
   Running 62/74: startup...
   Running 63/74: system...
   Running 64/74: systemtap...
   Running 65/74: sysvipc...
   Running 66/74: udev...
   Running 67/74: upstart...
   Running 68/74: usb...
   Running 69/74: vhostmd...
   Running 70/74: vsftpd...
   Running 71/74: x11...
   Running 72/74: xfs...
   Running 73/74: xinetd...
   Running 74/74: yum... 

  Creating compressed archive...

  Your sosreport has been generated and saved in:
   /tmp/sosreport-localhost.localdomain-20180404044836.tar.xz

  The checksum is: c9ee057a11c2b7ec835d2f186d2a0e7a

  Please send this file to your support representative.

  [root@localhost ~]#


3. 수집된 sosreport 파일 확인

  - sosreport 수집이 완료되면 /tmp 디렉토리에 아래와 같이 sosreport-호스트명-xxx 의 이름으로 파일이 생성된다.
    생성된 sosreport 파일을 usb나 email 등으로 외부 PC로 이동하여 시스템에 대한 점검을 진행 할 수 있다.

  [root@localhost ~]# cd /tmp/
  [root@localhost tmp]# ls -l
  total 7648
  drwxr-x---. 2 root root    4096 Feb  2 02:01 hsperfdata_root
  -rw-------. 1 root root 7821428 Apr  4 04:48 sosreport-localhost.localdomain-20180404044836.tar.xz
  -rw-r--r--. 1 root root      33 Apr  4 04:49 sosreport-localhost.localdomain-20180404044836.tar.xz.md5
  [root@localhost tmp]# tar xvfp sosreport-localhost.localdomain-20180404044836.tar.xz
  [root@localhost tmp]# cd sosreport-localhost.localdomain-20180404044836
  [root@localhost sosreport-localhost.localdomain-20180404044836]# ls -l
  total 56
  dr-xr-xr-x.  3 root root 4096 Jan  3 07:25 boot
  lrwxrwxrwx.  1 root root   37 Apr  4 04:50 chkconfig -> sos_commands/startup/chkconfig_--list
  lrwxrwxrwx.  1 root root   25 Apr  4 04:50 date -> sos_commands/general/date
  lrwxrwxrwx.  1 root root   27 Apr  4 04:50 df -> sos_commands/filesys/df_-al
  lrwxrwxrwx.  1 root root   31 Apr  4 04:50 dmidecode -> sos_commands/hardware/dmidecode
  drwxr-xr-x. 35 root root 4096 Apr  2 03:39 etc
  lrwxrwxrwx.  1 root root   24 Apr  4 04:50 free -> sos_commands/memory/free
  lrwxrwxrwx.  1 root root   29 Apr  4 04:50 hostname -> sos_commands/general/hostname
  lrwxrwxrwx.  1 root root  130 Apr  4 04:50 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 Apr  4 04:50 ip_addr -> sos_commands/networking/ip_-o_addr
  lrwxrwxrwx.  1 root root   45 Apr  4 04:50 java -> sos_commands/java/alternatives_--display_java
  dr-xr-xr-x.  4 root root 4096 Jan  4 03:45 lib
  lrwxrwxrwx.  1 root root   25 Apr  4 04:50 lsmod -> sos_commands/kernel/lsmod
  lrwxrwxrwx.  1 root root   36 Apr  4 04:50 lsof -> sos_commands/process/lsof_-b_M_-n_-l
  lrwxrwxrwx.  1 root root   22 Apr  4 04:50 lspci -> sos_commands/pci/lspci
  lrwxrwxrwx.  1 root root   29 Apr  4 04:50 mount -> sos_commands/filesys/mount_-l
  lrwxrwxrwx.  1 root root   38 Apr  4 04:50 netstat -> sos_commands/networking/netstat_-neopa
  dr-xr-xr-x. 10 root root 4096 Jan  4 16:04 proc
  lrwxrwxrwx.  1 root root   30 Apr  4 04:50 ps -> sos_commands/process/ps_auxwww
  lrwxrwxrwx.  1 root root   27 Apr  4 04:50 pstree -> sos_commands/process/pstree
  dr-xr-x---.  2 root root 4096 Apr  4 04:41 root
  lrwxrwxrwx.  1 root root   32 Apr  4 04:50 route -> sos_commands/networking/route_-n
  dr-xr-xr-x.  2 root root 4096 Feb 17 03:37 sbin
  drwx------. 42 root root 4096 Apr  4 04:48 sos_commands
  drwx------.  2 root root 4096 Apr  4 04:48 sos_logs
  drwx------.  2 root root 4096 Apr  4 04:48 sos_reports
  drwxr-xr-x.  6 root root 4096 Jan  4 16:04 sys
  lrwxrwxrwx.  1 root root   28 Apr  4 04:50 uname -> sos_commands/kernel/uname_-a
  lrwxrwxrwx.  1 root root   27 Apr  4 04:50 uptime -> sos_commands/general/uptime
  drwxr-xr-x.  5 root root 4096 Jan  3 07:24 var 
  -rw-r--r--.  1 root root 1488 Apr  4 04:48 version.txt
  lrwxrwxrwx.  1 root root   62 Apr  4 04:50 vgdisplay -> sos_commands/lvm2/vgdisplay_-vv_--config_global_locking_type_0

  [root@localhost sosreport-localhost.localdomain-20180404044836]#
 

3개의 댓글이 있습니다.

6년 이하 전

감사합니다~

Reply

댓글 남기기

댓글을 남기기 위해서는 로그인이 필요합니다.

로그인 회원가입

6년 이하 전

감사합니다.

Reply

댓글 남기기

댓글을 남기기 위해서는 로그인이 필요합니다.

로그인 회원가입

1st 5stars

6년 이하 전

centOS는 따로 설치하지 않았는데도 기본적으로 설치되어 있는 것 같네요~
Debian 계열에서는 apt-get install sosreport 명령으로 따로 설치해 주면 되는 것 같고...
참고할께요~ ^^

Reply

댓글 남기기

댓글을 남기기 위해서는 로그인이 필요합니다.

로그인 회원가입

댓글 남기기

댓글을 남기기 위해서는 로그인이 필요합니다.

로그인 회원가입