본문으로 건너뛰기

[L] sosreport를 사용하여 시스템 점검하기

💡 요약 정리

  • sosreport는 Red Hat 계열 시스템의 설정 정보를 수집하는 진단 도구입니다
  • 방화벽으로 막힌 시스템이나 원격 접속이 어려운 환경에서 유용합니다
  • /tmp 디렉토리에 압축 파일(.tar.bz2)로 결과가 저장됩니다
  • -o 옵션으로 특정 정보만 수집하거나, -k 옵션으로 항목을 제외할 수 있습니다

sosreport는 시스템 설정 정보를 수집해 주는 명령어입니다.

방화벽으로 접근이 불가능한 시스템이나, root 권한을 주지 않고 시스템에 대한 점검을 다른 사람에게 의뢰할 경우 유용합니다.

또한 주기적으로 sosreport를 수집해서 시스템 설정사항에 대한 백업 용도로도 사용이 가능합니다.

설치 환경:

  • CentOS 5.x / Red Hat Enterprise Linux
  • sos 패키지 필요

1. 패키지 설치 확인

sosreport 명령을 사용하려면 sos 패키지가 설치되어 있어야 합니다.

① 패키지 설치 확인

[root@localhost tmp]# rpm -qa | grep sos
sos-1.7-9.62.el5

② 명령 위치 확인

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

③ 패키지 정보 확인

[root@localhost tmp]# rpm -qf /usr/sbin/sosreport
sos-1.7-9.62.el5

2. sosreport 실행

① 기본 실행

단순히 sosreport 명령만 실행하고, Enter 키를 계속 입력하기만 하면 됩니다.

[root@localhost tmp]# sosreport

sosreport (version 1.7)

This utility will collect some detailed  information about the
hardware and  setup of your  Red Hat Enterprise Linux  system.
The information is collected and an archive is  packaged under
/tmp, which you can send to a support representative.
Red Hat will use this information for diagnostic purposes ONLY
and it will be considered confidential information.

This process may take a while to complete.
No changes will be made to your system.

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

② 사용자 정보 입력

could not execute diagnose method for plugin gfs2
<type 'instance'>: ('list index out of range',)
Please enter your first initial and last name [localhost]:              # Enter 입력
Please enter the case number that you are generating this report for:  # Enter 입력

could not setup plugin hardware
<type 'instance'>: ('list index out of range',)
 plugin yum finished ...
 Completed.

참고:

  • 일부 플러그인에서 에러가 발생할 수 있으나, 정보 수집 자체에는 문제가 없습니다
  • 이름과 케이스 번호는 선택사항입니다 (Enter로 건너뛰기 가능)

③ 압축 파일 생성

Creating compressed archive...

Your sosreport has been generated and saved in:
  /tmp/sosreport-localhost-284715-aeaf3a.tar.bz2

The md5sum is: e4085642bf2b5546bc64b4124baeaf3a

Please send this file to your support representative.

[root@localhost tmp]#

3. 옵션 사용

-o 옵션: 원하는 정보만 수집

특정 카테고리의 정보만 수집하려면 -o 옵션을 사용합니다.

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

sosreport (version 1.7)

This utility will collect some detailed  information about the
hardware and  setup of your  Red Hat Enterprise Linux  system.
The information is collected and an archive is  packaged under
/tmp, which you can send to a support representative.
Red Hat will use this information for diagnostic purposes ONLY
and it will be considered confidential information.

This process may take a while to complete.
No changes will be made to your system.

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

사용 가능한 주요 옵션:

  • hardware: 하드웨어 정보
  • kernel: 커널 정보
  • networking: 네트워크 설정
  • udev: 장치 관리 정보
  • system: 시스템 설정
  • rpm: 설치된 패키지 정보

-k 옵션: 특정 항목 제외

시간이 많이 걸리는 항목을 제외하려면 -k 옵션을 사용합니다.

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

sosreport (version 1.7)

This utility will collect some detailed  information about the
hardware and  setup of your  Red Hat Enterprise Linux  system.
The information is collected and an archive is  packaged under
/tmp, which you can send to a support representative.
Red Hat will use this information for diagnostic purposes ONLY
and it will be considered confidential information.

This process may take a while to complete.
No changes will be made to your system.

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

예시:

  • rpm.rpmva=off: RPM 패키지 검증 제외 (시간 단축)

4. 수집된 sosreport 파일 확인

sosreport 수집이 완료되면 /tmp 디렉토리에 파일이 생성됩니다.

① 파일 확인

[root@localhost tmp]# ls -l
total 1632
drwx------ 3 root root   4096 Apr  8 11:29 gconfd-root
-rw------- 1 root root      0 Apr 10 10:11 hsqldb.QKm15022
-rw------- 1 root root      0 Apr 10 10:21 hsqldb.mggV6108
drwx------ 2 root root   4096 Mar  8 12:06 keyring-CH9kxP
drwx------ 2 root root   4096 Mar  8 11:42 keyring-RLDiIx
srwxr-xr-x 1 root root      0 Mar  8 11:42 mapping-root
drwx------ 2 root root   4096 Apr  8 11:29 orbit-root
srw------- 1 root root      0 Mar  8 11:42 scim-helper-manager-socket-root
srw------- 1 root root      0 Mar  8 11:42 scim-panel-socket:0-root
srw------- 1 root root      0 Mar  8 12:06 scim-panel-socket:1-root
srw------- 1 root root      0 Mar  8 11:42 scim-socket-frontend-root
drwx------ 5 root root   4096 Apr 10 10:12 sos__jkV6Z
-rw------- 1 root root 1630059 Apr 10 10:22 sosreport-localhost-284715-aeaf3a.tar.bz2
-rw-r--r-- 1 root root     33 Apr 10 10:22 sosreport-localhost-284715-aeaf3a.tar.bz2.md5
drwx------ 2 root root   4096 Mar  8 12:06 ssh-AuVrjN3302
drwx------ 2 root root   4096 Mar  8 11:42 ssh-vfXqmJ2868
drwx------ 2 root root   4096 Apr 10 10:22 stapYjRfcy
[root@localhost tmp]#

② 파일 형식

생성된 파일 형식:

  • 압축 파일: sosreport-호스트명-숫자.tar.bz2
  • 체크섬 파일: sosreport-호스트명-숫자.tar.bz2.md5

③ 파일 전송

생성된 sosreport 파일을 다음 방법으로 외부로 전송할 수 있습니다:

  • USB 메모리
  • 이메일
  • SCP/SFTP
  • 웹 업로드

5. 활용 사례

① 원격 점검 의뢰

방화벽 정책으로 직접 접속이 불가능한 서버의 경우:

  1. 고객이 sosreport 실행
  2. 생성된 파일을 이메일로 전송
  3. 엔지니어가 파일을 분석하여 점검

② 시스템 백업

정기적으로 sosreport를 수집하여:

  • 시스템 설정 변경 이력 추적
  • 장애 발생 시 이전 설정과 비교
  • 시스템 변경 사항 문서화

③ 보안 점검

root 권한을 직접 제공하지 않고:

  • 시스템 보안 점검 의뢰
  • 취약점 분석 의뢰
  • 컴플라이언스 감사

6. 주의사항

① 민감 정보 포함

sosreport에는 시스템 설정 정보가 모두 포함되므로:

  • 신뢰할 수 있는 담당자에게만 전송
  • 파일 전송 시 암호화 권장
  • 불필요한 정보는 수동으로 제거 가능

② 디스크 공간

/tmp 디렉토리에 충분한 공간이 필요합니다:

  • 일반적으로 10-50MB 정도 사용
  • RPM 검증 포함 시 더 큰 용량 필요

③ 실행 시간

시스템 규모에 따라 실행 시간이 달라집니다:

  • 소규모 시스템: 1-3분
  • 대규모 시스템: 5-10분
  • RPM 검증 포함 시: 10-30분 이상

참고 자료