Sar - RedHat/CentOS 內建的系統效能分析工具。
特點:
可分析的系統資訊包含如下:
官方連結:How to use SAR to Monitor System Performance in Red Hat Enterprise Linux (如無法存取連結,請見下方附檔區)
HISTORY
value greater than 28 is declared, SAR log files are automatically split up into separate directories.Sar Cron Jobs:
/etc/cron.d/sysstat
# run system activity accounting tool every 10 minutes */10 * * * * root /usr/lib/sa/sa1 1 1 # generate a daily summary of process accounting at 23:53 53 23 * * * root /usr/lib/sa/sa2 -A
If it is desired for SAR to collect data more frequently, simply change "*/10" to a new interval.
For example, if to make SAR to track every 5 minutes, simply change to "*/5".
NOTE: SAR does not add significant load to a server. It safely can be tuned down to 2 minute intervals without seeing a significant problem. SAR also does not grab individual block data.
RedHat 5/6/7
yum install sysstat
顯示今日 CPU 狀態
// 每個處理器 sar -P ALL // 顯示 CPU sar -u
顯示最近月份 13 號的網路狀態
sar -n ALL -f /var/log/sa/sa13
顯示最近一個月份 7 號 時間 10:00 - 14:00 的記憶體使用狀況,並將結果導出一個檔案
sar -r -s 10:00:00 -e 14:00:00 -f /var/log/sa/sa07 -o /tmp/mem.txt
即時監看
CPU sar -u 1 sar -u 1 10 Memory sar -r 1 sar -r 1 10 Swap sar -S 1 sar -S 1 10 I/O sar -b 1 sar -b 1 10 sar -p -d 1 sar -p -d 1 10
RedHat 提供幾個透過線上的工具來分析
I/O 使用分析: https://access.redhat.com/labs/rhiou/
在系統內先執行 lsblk 將輸出內容導出一個檔案 lsblk.out,將此檔連同要分析的任一個 sarXX 檔上傳該網址,即可以圖形顯示系統 I/O 的使用狀態。
Memory 使用分析: https://access.redhat.com/labs/rhma/
文件 | 大小 | 日期 | 附件上傳者 | |||
---|---|---|---|---|---|---|
How_to_use_SAR_to_MonitorSystem__.pdf How to use SAR to Monitor System Performance in Red Hat Enterprise Linux | 99.77 KB | 09:46, 8 Feb 2017 | alang | 動作 |
Images 0 | ||
---|---|---|
No images to display in the gallery. |