CentOS 6.7にsysstatのインストール、設定と基本操作コマンド

1.インストール
# cat /etc/redhat-release
CentOS release 6.7 (Final)
# yum install sysstat
Loaded plugins: fastestmirror, security
Setting up Install Process
Determining fastest mirrors
epel/metalink | 5.3 kB 00:00
* base: ftp.iij.ad.jp
* epel: ftp.jaist.ac.jp
* extras: ftp.iij.ad.jp
* updates: ftp.iij.ad.jp
base | 3.7 kB 00:00
epel | 4.3 kB 00:00
epel/primary_db | 5.9 MB 00:01
extras | 3.4 kB 00:00
nginx | 2.9 kB 00:00
nginx/primary_db | 19 kB 00:00
updates | 3.4 kB 00:00
updates/primary_db | 4.3 MB 00:00
Resolving Dependencies
–> Running transaction check
—> Package sysstat.x86_64 0:9.0.4-27.el6 will be updated
—> Package sysstat.x86_64 0:9.0.4-31.el6 will be an update
–> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================
Package Arch Version Repository Size
========================================================================================================================
Updating:
sysstat x86_64 9.0.4-31.el6 base 234 k

Transaction Summary
========================================================================================================================
Upgrade 1 Package(s)

Total download size: 234 k
Is this ok [y/N]: y
Downloading Packages:
sysstat-9.0.4-31.el6.x86_64.rpm | 234 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Updating : sysstat-9.0.4-31.el6.x86_64 1/2
Cleanup : sysstat-9.0.4-27.el6.x86_64 2/2
Verifying : sysstat-9.0.4-31.el6.x86_64 1/2
Verifying : sysstat-9.0.4-27.el6.x86_64 2/2

Updated:
sysstat.x86_64 0:9.0.4-31.el6

Complete!

2.設定
2.1 sysstat の Crontab 設定
#vi /etc/cron.d/sysstat

# Run system activity accounting tool every 10 minutes
*/10 * * * * root /usr/lib64/sa/sa1 1 1
# 0 * * * * root /usr/lib64/sa/sa1 600 6 &
# Generate a daily summary of process accounting at 23:53
53 23 * * * root /usr/lib64/sa/sa2 -A

箇所1
修正前
*/10 * * * * root /usr/lib64/sa/sa1 1 1
修正後
*/6 * * * * root /usr/lib64/sa/sa1 1 1

箇所2
修正前
53 23 * * * root /usr/lib64/sa/sa2 -A

修正後
59 23 * * * root /usr/lib64/sa/sa2 -A
2.2 リソース状態の保存期間の設定
#vi /etc/sysconfig/sysstat
# How long to keep log files (in days).
# If value is greater than 28, then log files are kept in
# multiple directories, one for each month.
HISTORY=28

修正前
HISTORY=28

修正後
HISTORY=7
3.ログ確認
# less /var/log/sa/sar06
0:00:01 CPU %usr %nice %sys %iowait %steal %irq %soft %guest %idle
00:10:01 all 3.22 0.00 0.15 0.22 0.06 0.00 0.00 0.00 96.36
00:10:01 0 2.44 0.00 0.10 0.50 0.09 0.00 0.00 0.00 96.88
4.CPU使用状況
#sar -u 1
09:46:11 CPU %user %nice %system %iowait %steal %idle
09:46:12 all 0.00 0.00 0.00 0.00 0.00 100.00

5.ロードアベレージ確認

#sar -q 1
09:47:21 runq-sz plist-sz ldavg-1 ldavg-5 ldavg-15
09:47:22 1 168 0.08 0.03 0.01
09:47:23 0 167 0.08 0.03 0.01
09:47:24 0 167 0.08 0.03 0.01

6.コンテキストスイッチ確認

#sar -w 1

09:48:04 proc/s cswch/s
09:48:05 0.00 87.00
09:48:06 0.00 145.00

7.メモリ確認
#sar -r 1
09:48:26 kbmemfree kbmemused %memused kbbuffers kbcached kbcommit %commit
09:48:27 96760 1825312 94.97 4036 106284 2583268 64.27
09:48:28 96760 1825312 94.97 4036 106284 2583268 64.27
09:48:29 96760 1825312 94.97 4036 106284 2583268 64.2
8.スワップ確認
#sar -S 1
09:49:07 kbswpfree kbswpused %swpused kbswpcad %swpcad
09:49:08 1762912 334236 15.94 15912 4.76
09:49:09 1762912 334236 15.94 15912 4.76
09:49:10 1762912 334236 15.94 15912 4.76

9.ディスク確認
# sar -p -d 1 1
09:49:48 DEV tps rd_sec/s wr_sec/s avgrq-sz avgqu-sz await svctm %util
09:49:49 vda 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00

Average: DEV tps rd_sec/s wr_sec/s avgrq-sz avgqu-sz await svctm %util
Average: vda 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00

Linux

Posted by arkgame