Reports I/O and transfer statistics for all devices
-d
Reports disk I/O statistics for each block device
-n
Reports network statistics
-q
Reports queue length and load averages
-r
Reports memory utilization statistics
-o
Save the readings in the file in binary form
-f
Extract records from filename (created by the -o filename flag)
-p
Pretty-print device names. Use this option in conjunction with option -d.
-q 选项输出列说明
列名
说明
runq-sz
Run queue length (number of tasks waiting for run time)
plist-sz
Number of tasks in the task list
ldavg-1
System load average for the last minute. The load average is calculated as the average number of runnable or running tasks (R state), and the number of tasks in uninterruptible sleep (D state) over the specified interval
ldavg-5
System load average for the past 5 minutes
ldavg-15
System load average for the past 15 minutes
blocked
Number of tasks currently blocked, waiting for I/O to complete
示例
以2秒为间隔报告3次,并将结果保存至文件中
从文件读取信息
使用 - 采集日志
收集一段时间日志,并写入文件保存
非交互式使用(写入定时任务)
The sa1 script invokes /usr/lib64/sa/sadc that collects data for a single one second measuring interval.
By default, the cron command runs the sa1 script every 10 minutes, and the sa2 script writes a daily report to the /var/log/sa/ saDD or the /var/log/ sa/saYYYMMDD file, where DD is the current day, MM is the current month, and YYYY is the current year.
vim /etc/cron.d/sysstat
# Run system activity accounting tool everv 10 minutes
*/10 * * * * root /usr/lib64/sa/sa1 1 1
# Generate a dailv summary of process accounting at 23:53
53 23 * * * root /usr/lib64/sa/sa2 -A