Sysops Notepad

[Linux] 시스템 상태 체크 sar 명령어 사용법 및 설명 본문

업무/etc

[Linux] 시스템 상태 체크 sar 명령어 사용법 및 설명

sysops 2019. 5. 15. 13:58
728x90

# sar -u 1 5  // CPU 사용률 확인​
12:17:02 AM     CPU     %user     %nice   %system   %iowait    %steal     %idle
12:17:03 AM     all      0.38      0.00      0.38      1.50      0.00     97.75
12:17:04 AM     all      8.73     0.00      0.62      2.12      0.00     88.53
12:17:05 AM     all      2.25      0.00      0.75      2.50      0.00     94.49
Average:        all      3.79      0.00      0.58      2.04      0.00     93.59 

* user :사용자모드에서 CPU가 소비된 시간의 비율
* nice: nice로 스케줄링의 우선도를 변경한 프로세스가 사용자 모드에서 CPU를 소비한 시간의 비율
* system: 시스템 모드에서 CPU가 소비된 시간의 비율
* iowait: CPU가 디스크 I/O 대기를 위해 Idle상태로 소비한 시간의 비율
* steal: Xen등 OS의 가상화를 이용하고 있을 경우 ㅡ 다른 가상 CPU의 계산으로 대기된 시간의 비율
* idle: CPU가 디스크I/O 대기등으로 대기되지 않고, Idle상태로 소비한 시간의 비율


# sar -q 1 5  // Load Average 확인
12:22:42 AM   runq-sz  plist-sz   ldavg-1   ldavg-5  ldavg-15
12:22:43 AM         0       204      1.38      1.13      1.10
12:22:44 AM         0       201      1.38      1.13      1.10
12:22:45 AM         0       201      1.38      1.13      1.10
Average:            0       202      1.38      1.13      1.10

* runq-sz​: 실행큐에 쌓여 있는 프로세스 수
* plist-sz: 시스템상의 프로세스 사이즈
​* ldavg-1,5,15: 1분,5분,15분 시간 흐름에 다른 Load Average 값의 추이​

 
# sar -r 1 5   // 메모리 사용현황 확인
12:28:11 AM kbmemfree kbmemused  %memused kbbuffers  kbcached  kbcommit   %commit
12:28:12 AM    235960   5741468           96.05        1224         154580      8837360     73.10
12:28:13 AM    235984   5741444           96.05        1224         155104      8837360     73.10
12:28:14 AM    234836   5742592           96.07        1224         155492      8837360     73.10
Average:       235593   5741835            96.06        1224         155059      8837360     73.10

* ​kbmemfree: 물리 메모리의 남은 용량
* ​kbmemused: 사용중인 물리 메모리량
* ​memused: 물리 메모리 사용률
* ​kbbuffers: 커널 내의 버퍼로 사용되고 있는 물리 메모리의 용량
* ​kbcached: 커널내에서 캐시용 메모리로 사용되고 있는 물리 메모리의 용량
​* kbswapfree: 스왑영역의 남은 용량
* kbswpued: 사용중인 스왑의 용량

 
# sar -W 1 5  // 스왑 발생상황 확인
12:52:00 AM  pswpin/s pswpout/s
12:52:01 AM     80.00      0.00
12:52:02 AM     62.00      0.00
12:52:03 AM     26.00      0.00
12:52:04 AM     14.85      0.00
12:52:05 AM     17.00      0.00
Average:        39.92      0.00
  -> 스왑이 발생하면 서버의 전송량은 급격히 떨어짐.

* pswpin/s: 1초 동안에 swap-In 되고 있는 페이지 수
* ​pswpout/s​: 1초 동안에 swap-Out 되고 있는 페이지 수​

 

 

참고:

https://jkt0620.blog.me/220084649760

728x90
Comments