SAR (System Activity Report) 사용법

설치 환경

커널 정보

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#

시스템 정보

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

Handle 0x0001, DMI type 1, 27 bytes
System Information
        Manufacturer: SAMSUNG ELECTRONICS CO., LTD.
        Product Name: 900X3C/900X3D/900X4C/900X4D
        Version: 0.1
        Serial Number: HRBF91GC800950
        UUID: 1711B9C0-1DD2-11B2-8000-F52C808C706C
        Wake-up Type: Power Switch
        SKU Number: System SKUNumber
        Family: ChiefRiver System

Handle 0x002C, DMI type 12, 5 bytes
System Configuration Options
        Option 1: DSN:HDD_SERIAL
        Option 2: DSN:MEM_SERIAL
        Option 3: DSN:NO_BATTERY
        Option 4: SMI:00B2E004

Handle 0x002F, DMI type 32, 11 bytes
System Boot Information
        Status: No errors detected

Handle 0x0032, DMI type 23, 13 bytes
System Reset
        Status: Disabled
        Watchdog Timer: Present
        Boot Option: Do Not Reboot
        Boot Option On Limit: Do Not Reboot
        Reset Count: Unknown
        Reset Limit: Unknown
        Timer Interval: Unknown
        Timeout: Unknown

Handle 0x003E, DMI type 15, 81 bytes
System Event Log
        Area Length: 18 bytes
        Header Start Offset: 0x0000
        Header Length: 16 bytes
        Data Start Offset: 0x0010
        Access Method: General-purpose non-volatile data functions
        Access Address: 0x00F0
        Status: Valid, Not Full
        Change Token: 0x00000000
        Header Format: Type 1
        Supported Log Type Descriptors: 29
        Descriptor 1: Single-bit ECC memory error
        Data Format 1: Multiple-event handle
        Descriptor 2: Multi-bit ECC memory error
        Data Format 2: Multiple-event handle
        Descriptor 3: Parity memory error
        Data Format 3: None
        Descriptor 4: Bus timeout
        Data Format 4: None
        Descriptor 5: I/O channel block
        Data Format 5: None
        Descriptor 6: Software NMI
        Data Format 6: None
        Descriptor 7: POST memory resize
        Data Format 7: None
        Descriptor 8: POST error
        Data Format 8: POST results bitmap
        Descriptor 9: PCI parity error
        Data Format 9: None
        Descriptor 10: PCI system error
        Data Format 10: None
        Descriptor 11: CPU failure
        Data Format 11: None
        Descriptor 12: EISA failsafe timer timeout
        Data Format 12: None
        Descriptor 13: Correctable memory log disabled
        Data Format 13: None
        Descriptor 14: Logging disabled
        Data Format 14: None
        Descriptor 15: System limit exceeded
        Data Format 15: None
        Descriptor 16: Asynchronous hardware timer expired
        Data Format 16: None
        Descriptor 17: System configuration information
        Data Format 17: None
        Descriptor 18: Hard disk information
        Data Format 18: None
        Descriptor 19: System reconfigured
        Data Format 19: None
        Descriptor 20: Uncorrectable CPU-complex error
        Data Format 20: None
        Descriptor 21: Log area reset/cleared
        Data Format 21: None
        Descriptor 22: System boot
        Data Format 22: None
        Descriptor 23: OEM-specific
        Data Format 23: None
        Descriptor 24: OEM-specific
        Data Format 24: None
        Descriptor 25: OEM-specific
        Data Format 25: None
        Descriptor 26: OEM-specific
        Data Format 26: None
        Descriptor 27: OEM-specific
        Data Format 27: None
        Descriptor 28: OEM-specific
        Data Format 28: None
        Descriptor 29: OEM-specific
        Data Format 29: None

root@localhost:/home/westporch# 

설치

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.