Sar

한국 데비안 사용자 모임
둘러보기로 가기 검색하러 가기
작성일자: 2015년 10월 23일
작성자: westporch

본 문서에서는 SAR (System Activity Report) 설치 및 사용법을 설명합니다.

설치

sysstat 패키지는 sar, mpstat 명령어를 포함하고 있습니다. sar를 사용하기 위해서는 sysstat 패키지를 설치해야합니다. 아래 명령어로 sysstat 패키지를 설치합니다.

root@localhost:/home/westporch# apt-get install sysstat

설정

/etc/default/sysstat에서 ENABLED= 항목을 true로 변경합니다.

root@localhost:/home/westporch# vi /etc/default/sysstat
#                                                   
# Default settings for /etc/init.d/sysstat, /etc/cron.d/sysstat
# and /etc/cron.daily/sysstat files
#

# Should sadc collect system activity informations? Valid values
# are "true" and "false". Please do not put other values, they
# will be overwritten by debconf!
ENABLED="true"

sar 실행

sar -V 명령어로 sysstat의 버전을 확인해보세요.

root@localhost:/etc/default# sar -V
sysstat version 11.0.1
(C) Sebastien Godard (sysstat <at> orange.fr)
root@localhost:/etc/default#

sar -u 1 5 명령어를 입력해보세요. 1초 간격으로 5번 CPU의 성능을 측정합니다.

root@localhost:/home/westporch# sar -u 1 5
Linux 3.16.0-4-686-pae (localhost)      2015년 10월 23일        _i686_  (4 CPU)

                CPU     %user     %nice   %system   %iowait    %steal     %idle
                all      4.01      0.00      0.50      0.00      0.00     95.49
                all      2.26      0.00      0.50      0.00      0.00     97.24
                all      2.01      0.00      1.00      0.00      0.00     96.99
                all      3.53      0.00      0.50      0.00      0.00     95.97
                all      3.76      0.00      0.50      0.00      0.00     95.74
Average:        all      3.11      0.00      0.60      0.00      0.00     96.29
root@localhost:/home/westporch#

위 결과의 각 필드에 대한 설명은 다음과 같습니다.

%user 
Percentage of CPU utilization that occurred while executing at the user level (application). Note that this field includes time spent running virtual processors.

%system 
Percentage of CPU utilization that occurred while executing at the system level (kernel). Note that this field includes time spent ser‐ vicing hardware and software interrupts.

%iowait 
Percentage of time that the CPU or CPUs were idle during which the system had an outstanding disk I/O request.

%steal 
Percentage of time spent in involuntary wait by the virtual CPU or CPUs while the hypervisor was servicing another virtual processor.

%idle 
Percentage of time that the CPU or CPUs were idle and the system did not have an outstanding disk I/O request.

설치 환경

커널 정보

root@localhost:/home/westporch# uname -a
Linux localhost 3.16.0-4-686-pae #1 SMP Debian 3.16.7-ckt11-1+deb8u3 (2015-08-04) i686 GNU/Linux
root@localhost:/home/westporch# 

CPU 정보

root@localhost:/home/westporch# dmidecode -t processor
# dmidecode 2.12
SMBIOS 2.7 present.

Handle 0x0004, DMI type 4, 42 bytes
Processor Information
        Socket Designation: CPU Socket - U3E1
        Type: Central Processor
        Family: Core i5
        Manufacturer: Intel(R) Corporation
        ID: A9 06 03 00 FF FB EB BF
        Signature: Type 0, Family 6, Model 58, Stepping 9
        Flags:
                FPU (Floating-point unit on-chip)
                VME (Virtual mode extension)
                DE (Debugging extension)
                PSE (Page size extension)
                TSC (Time stamp counter)
                MSR (Model specific registers)
                PAE (Physical address extension)
                MCE (Machine check exception)
                CX8 (CMPXCHG8 instruction supported)
                APIC (On-chip APIC hardware supported)
                SEP (Fast system call)
                MTRR (Memory type range registers)
                PGE (Page global enable)
                MCA (Machine check architecture)
                CMOV (Conditional move instruction supported)
                PAT (Page attribute table)
                PSE-36 (36-bit page size extension)
                CLFSH (CLFLUSH instruction supported)
                DS (Debug store)
                ACPI (ACPI supported)
                MMX (MMX technology supported)
                FXSR (FXSAVE and FXSTOR instructions supported)
                SSE (Streaming SIMD extensions)
                SSE2 (Streaming SIMD extensions 2)
                SS (Self-snoop)
                HTT (Multi-threading)
                TM (Thermal monitor supported)
                PBE (Pending break enabled)
        Version: Intel(R) Core(TM) i5-3317U CPU @ 1.70GHz
        Voltage: 0.8 V
        External Clock: 100 MHz
        Max Speed: 1700 MHz
        Current Speed: 1700 MHz
        Status: Populated, Enabled
        Upgrade: Socket rPGA988B
        L1 Cache Handle: 0x0002
        L2 Cache Handle: 0x0003
        L3 Cache Handle: 0x0004
        Serial Number: To Be Filled By O.E.M.
        Asset Tag: To Be Filled By O.E.M.
        Part Number: To Be Filled By O.E.M.
        Core Count: 2
        Core Enabled: 2
        Thread Count: 4
        Characteristics:
                64-bit capable

root@localhost:/home/westporch#

메모리 정보

root@localhost:/home/westporch# dmidecode -t memory
# dmidecode 2.12
SMBIOS 2.7 present.

Handle 0x0036, DMI type 16, 23 bytes
Physical Memory Array
        Location: System Board Or Motherboard
        Use: System Memory
        Error Correction Type: None
        Maximum Capacity: 32 GB
        Error Information Handle: Not Provided
        Number Of Devices: 4

Handle 0x0037, DMI type 17, 34 bytes
Memory Device
        Array Handle: 0x0036
        Error Information Handle: Not Provided
        Total Width: 64 bits
        Data Width: 64 bits
        Size: 4096 MB
        Form Factor: SODIMM
        Set: None
        Locator: ChannelA-DIMM0
        Bank Locator: BANK 0
        Type: DDR3
        Type Detail: Synchronous
        Speed: 1600 MHz
        Manufacturer: Samsung
        Serial Number: 6667E824
        Asset Tag: 9876543210
        Part Number: M471B5273DH0-CK0  
        Rank: Unknown
        Configured Clock Speed: 1600 MHz

Handle 0x0038, DMI type 17, 34 bytes
Memory Device
        Array Handle: 0x0036
        Error Information Handle: Not Provided
        Total Width: Unknown
        Data Width: Unknown
        Size: No Module Installed
        Form Factor: DIMM
        Set: None
        Locator: ChannelA-DIMM1
        Bank Locator: BANK 1
        Type: Unknown
        Type Detail: None
        Speed: Unknown
        Manufacturer: Not Specified
        Serial Number: Not Specified
        Asset Tag: 9876543210
        Part Number: Not Specified
        Rank: Unknown
        Configured Clock Speed: Unknown

Handle 0x0039, DMI type 17, 34 bytes
Memory Device
        Array Handle: 0x0036
        Error Information Handle: Not Provided
        Total Width: 64 bits
        Data Width: 64 bits
        Size: 4096 MB
        Form Factor: SODIMM
        Set: None
        Locator: ChannelB-DIMM0
        Bank Locator: BANK 2
        Type: DDR3
        Type Detail: Synchronous
        Speed: 1600 MHz
        Manufacturer: Samsung
        Serial Number: 6667E830
        Asset Tag: 9876543210
        Part Number: M471B5273DH0-CK0  
        Rank: Unknown
        Configured Clock Speed: 1600 MHz

Handle 0x003A, DMI type 17, 34 bytes
Memory Device
        Array Handle: 0x0036
        Error Information Handle: Not Provided
        Total Width: Unknown
        Data Width: Unknown
        Size: No Module Installed
        Form Factor: DIMM
        Set: None
        Locator: ChannelB-DIMM1
        Bank Locator: BANK 3
        Type: Unknown
        Type Detail: None
        Speed: Unknown
        Manufacturer: Not Specified
        Serial Number: Not Specified
        Asset Tag: 9876543210
        Part Number: Not Specified
        Rank: Unknown
        Configured Clock Speed: Unknown

root@localhost:/home/westporch#

메인보드 정보

root@localhost:/home/westporch# dmidecode -t baseboard
# dmidecode 2.12
SMBIOS 2.7 present.

Handle 0x0002, DMI type 2, 15 bytes
Base Board Information
        Manufacturer: SAMSUNG ELECTRONICS CO., LTD.
        Product Name: SAMSUNG_NP1234567890
        Version: FAB1
        Serial Number: 123490EN400015
        Asset Tag: Base Board Asset Tag
        Features:
                Board is a hosting board
                Board is replaceable
        Location In Chassis: Part Component
        Chassis Handle: 0x0000
        Type: Motherboard
        Contained Object Handles: 0

Handle 0x0029, DMI type 10, 6 bytes
On Board Device Information
        Type: Video
        Status: Enabled
        Description: Intel(R) Extreme Graphics 3 Controller

Handle 0x002A, DMI type 10, 6 bytes
On Board Device Information
        Type: Sound
        Status: Enabled
        Description: Intel(R) Azalia Audio Device

root@localhost:/home/westporch#