설치는
# yum install sysstat
Last metadata expiration check: 3:19:02 ago on Mon 24 Apr 2023 08:11:08 AM KST.
Dependencies resolved.
==============================================================================================================================
Package Architecture Version Repository Size
==============================================================================================================================
Installing:
sysstat x86_64 11.7.3-9.el8 AppStream 426 k
Transaction Summary
==============================================================================================================================
Install 1 Package
Total download size: 426 k
Installed size: 1.4 M
Is this ok [y/N]: y
Downloading Packages:
sysstat-11.7.3-9.el8.x86_64.rpm 60 kB/s | 426 kB 00:07
------------------------------------------------------------------------------------------------------------------------------
Total 60 kB/s | 426 kB 00:07
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : sysstat-11.7.3-9.el8.x86_64 1/1
Running scriptlet: sysstat-11.7.3-9.el8.x86_64 1/1
Verifying : sysstat-11.7.3-9.el8.x86_64 1/1
Installed:
sysstat-11.7.3-9.el8.x86_64
Complete!
설치 가능하다.
명령어는 sar 인데
# sar
Cannot open /var/log/sa/sa24: No such file or directory
Please check if data collecting is enabled
위와 같이 에러 뜬다면 서비스를 시작 안해서 그렇다.
# service sysstat restart
해주면 된다.
CPU 사용률은
# sar
Linux 4.18.0-358.el8.x86_64 (new_tools) 04/24/2023 _x86_64_ (8 CPU)
13:30:29 LINUX RESTART (8 CPU)
01:40:05 PM CPU %user %nice %system %iowait %steal %idle
01:50:05 PM all 0.13 0.00 0.85 99.01 0.00 0.01
02:00:05 PM all 0.08 0.00 1.24 98.68 0.00 0.00
Average: all 0.10 0.00 1.05 98.84 0.00 0.00
날짜별은
# sar -f /var/log/sa/sa24
Linux 4.18.0-358.el8.x86_64 (new_tools) 04/24/2023 _x86_64_ (8 CPU)
13:30:29 LINUX RESTART (8 CPU)
01:40:05 PM CPU %user %nice %system %iowait %steal %idle
01:50:05 PM all 0.13 0.00 0.85 99.01 0.00 0.01
02:00:05 PM all 0.08 0.00 1.24 98.68 0.00 0.00
02:10:05 PM all 0.06 0.00 1.60 98.34 0.00 0.00
02:20:05 PM all 0.07 0.00 0.76 99.18 0.00 0.00
02:30:05 PM all 0.20 0.00 0.83 98.97 0.00 0.00
02:40:05 PM all 0.10 0.00 1.02 98.88 0.00 0.00
02:50:07 PM all 0.23 0.00 0.83 98.93 0.00 0.00
03:00:05 PM all 0.10 0.00 0.41 99.49 0.00 0.00
03:10:05 PM all 0.13 0.00 0.53 99.34 0.00 0.00
03:20:06 PM all 0.20 0.00 0.67 99.14 0.00 0.00
Average: all 0.13 0.00 0.88 98.99 0.00 0.00
메모리 사용률은
# sar -r
Linux 4.18.0-358.el8.x86_64 (new_tools) 04/24/2023 _x86_64_ (8 CPU)
13:30:29 LINUX RESTART (8 CPU)
01:40:05 PM kbmemfree kbavail kbmemused %memused kbbuffers kbcached kbcommit %commit kbactive kbinact kbdirty
01:50:05 PM 1279720 21129424 31329464 96.08 3432 17990148 8279796 12.51 6409504 13286912 2868252
02:00:05 PM 1061236 21038156 31547948 96.75 3432 18112852 8337656 12.60 6622872 13297216 3365188
02:10:05 PM 1088252 21336896 31520932 96.66 3432 18651140 8278736 12.51 6096096 14261648 5883336
02:20:05 PM 1024832 21279020 31584352 96.86 3432 18399712 8304444 12.55 5612440 14493424 5742976
02:30:05 PM 994376 21299912 31614808 96.95 3432 18400604 8295452 12.54 5460972 14645684 5728728
02:40:05 PM 1054528 21170564 31554656 96.77 3432 18308488 8274432 12.51 5609972 14404828 5077188
02:50:07 PM 996792 21362128 31612392 96.94 3432 18402680 8275388 12.51 6101700 14007460 5211220
03:00:05 PM 857320 21306732 31751864 97.37 3432 18369528 8283256 12.52 6172688 13902904 4578156
03:10:05 PM 1040640 21167164 31568544 96.81 3432 17932216 8320004 12.57 6719260 12919820 3970180
03:20:06 PM 1012180 21241452 31597004 96.90 3432 18271124 8303228 12.55 7883872 12093352 4558744
03:30:05 PM 972572 21196168 31636612 97.02 3432 18306772 8297420 12.54 8074432 11938720 4055780
03:40:05 PM 1107396 21253048 31501788 96.60 3432 18312688 8289172 12.53 7738852 12279452 4421520
날짜별
# sar -r -f /var/log/sa/sa24
Linux 4.18.0-358.el8.x86_64 (new_tools) 04/24/2023 _x86_64_ (8 CPU)
13:30:29 LINUX RESTART (8 CPU)
01:40:05 PM kbmemfree kbavail kbmemused %memused kbbuffers kbcached kbcommit %commit kbactive kbinact kbdirty
01:50:05 PM 1279720 21129424 31329464 96.08 3432 17990148 8279796 12.51 6409504 13286912 2868252
02:00:05 PM 1061236 21038156 31547948 96.75 3432 18112852 8337656 12.60 6622872 13297216 3365188
02:10:05 PM 1088252 21336896 31520932 96.66 3432 18651140 8278736 12.51 6096096 14261648 5883336
02:20:05 PM 1024832 21279020 31584352 96.86 3432 18399712 8304444 12.55 5612440 14493424 5742976
02:30:05 PM 994376 21299912 31614808 96.95 3432 18400604 8295452 12.54 5460972 14645684 5728728
02:40:05 PM 1054528 21170564 31554656 96.77 3432 18308488 8274432 12.51 5609972 14404828 5077188
02:50:07 PM 996792 21362128 31612392 96.94 3432 18402680 8275388 12.51 6101700 14007460 5211220
03:00:05 PM 857320 21306732 31751864 97.37 3432 18369528 8283256 12.52 6172688 13902904 4578156
03:10:05 PM 1040640 21167164 31568544 96.81 3432 17932216 8320004 12.57 6719260 12919820 3970180
03:20:06 PM 1012180 21241452 31597004 96.90 3432 18271124 8303228 12.55 7883872 12093352 4558744
03:30:05 PM 972572 21196168 31636612 97.02 3432 18306772 8297420 12.54 8074432 11938720 4055780
03:40:05 PM 1107396 21253048 31501788 96.60 3432 18312688 8289172 12.53 7738852 12279452 4421520
03:50:06 PM 847724 21169236 31761460 97.40 3432 18524012 8252956 12.47 7210940 13018512 4852508
하면 된다.