리눅스 기초 다지기 - 32. sar

 

sar

: System Activity Report 약어로 시스템의 CPU, 메모리, 입출력 사용량 정보를 수집하고 리포팅하는 명령어이다.

 

설치

[root@localhost logs]# yum -y install sysstat

 

옵션

# sar [옵션] [인터벌] [횟수]

 

-u

: CPU 사용률 정보

[root@localhost ~]# sar -u 1 1
Linux 5.14.0-162.6.1.el9_1.x86_64 (localhost.localdomain)       08/31/23        _x86_64_        (2 CPU)

10:51:31        CPU     %user     %nice   %system   %iowait    %steal     %idle
10:51:32        all      0.00      0.00      0.00      0.00      0.00    100.00
Average:        all      0.00      0.00      0.00      0.00      0.00    100.00

 

-q

: Load Average 확인

[root@localhost ~]# sar -q 1 1
Linux 5.14.0-162.6.1.el9_1.x86_64 (localhost.localdomain)       08/31/23        _x86_64_        (2 CPU)

10:51:46      runq-sz  plist-sz   ldavg-1   ldavg-5  ldavg-15   blocked
10:51:47            0       493      0.04      0.14      0.12         0
Average:            0       493      0.04      0.14      0.12         0

 

-W

: 스왑 메모리 정보 수집

[root@localhost ~]# sar -W 1 1
Linux 5.14.0-162.6.1.el9_1.x86_64 (localhost.localdomain)       08/31/23        _x86_64_        (2 CPU)

10:51:58     pswpin/s pswpout/s
10:51:59         0.00      0.00
Average:         0.00      0.00

 

-d

: 블록 디바이스에 대한 정보를 수집

[root@localhost ~]# sar -d 1 1
Linux 5.14.0-162.6.1.el9_1.x86_64 (localhost.localdomain)       08/31/23        _x86_64_        (2 CPU)

10:52:13          DEV       tps     rkB/s     wkB/s     dkB/s   areq-sz    aqu-sz     await     %util
10:52:14          sda      3.00      0.00      9.50      0.00      3.17      0.00      1.00      0.30
10:52:14          sr0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
10:52:14         dm-0      3.00      0.00      9.50      0.00      3.17      0.00      1.00      0.30
10:52:14         dm-1      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00

Average:          DEV       tps     rkB/s     wkB/s     dkB/s   areq-sz    aqu-sz     await     %util
Average:          sda      3.00      0.00      9.50      0.00      3.17      0.00      1.00      0.30
Average:          sr0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
Average:         dm-0      3.00      0.00      9.50      0.00      3.17      0.00      1.00      0.30
Average:         dm-1      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00

 

-n [키워드]

: 네트워크 사용 정보

[root@localhost ~]# sar -n DEV 1 1
Linux 5.14.0-162.6.1.el9_1.x86_64 (localhost.localdomain)       08/31/23        _x86_64_        (2 CPU)

10:52:58        IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s   %ifutil
10:52:59           lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
10:52:59       ens192      3.00      1.00      0.18      0.10      0.00      0.00      0.00      0.00
10:52:59    br-e266c19a3bdd      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
10:52:59      docker0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
10:52:59    veth4a39c9b      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
10:52:59    veth5de4e49      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
10:52:59    veth635826a      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00

Average:        IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s   %ifutil
Average:           lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
Average:       ens192      3.00      1.00      0.18      0.10      0.00      0.00      0.00      0.00
Average:    br-e266c19a3bdd      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
Average:      docker0      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
Average:    veth4a39c9b      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
Average:    veth5de4e49      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00
Average:    veth635826a      0.00      0.00      0.00      0.00      0.00      0.00      0.00      0.00