当您使用sadf
从数据文件制作报告时sysstat
,将显示以下几行:
ncm 3 2015-05-11 03:57:15 UTC all %%user 0.08
ncm 3 2015-05-11 03:57:15 UTC all %%nice 0.00
ncm 3 2015-05-11 03:57:15 UTC all %%system 0.08
ncm 3 2015-05-11 03:57:15 UTC all %%iowait 0.00
ncm 3 2015-05-11 03:57:15 UTC all %%steal 0.00
ncm 3 2015-05-11 03:57:15 UTC all %%idle 99.84
这个输出的第二个字段是什么意思?
答案1
这第二列(3
)显示测量间隔很快。
% sar -u -o datafile 3 2
Linux 3.19.0-16-generic (mysecret) 11.05.2015 _x86_64_ (2 CPU)
12:01:20 CPU %user %nice %system %iowait %steal %idle
12:01:23 all 0,68 0,00 0,34 1,01 0,00 97,97
12:01:26 all 4,57 0,00 2,20 0,00 0,00 93,23
Average: all 2,62 0,00 1,27 0,51 0,00 95,60
输出结果如下sadf
:
% sadf datafile
mysecret 3 2015-05-11 10:01:23 UTC all %%user 0,68
mysecret 3 2015-05-11 10:01:23 UTC all %%nice 0,00
mysecret 3 2015-05-11 10:01:23 UTC all %%system 0,34
mysecret 3 2015-05-11 10:01:23 UTC all %%iowait 1,01
mysecret 3 2015-05-11 10:01:23 UTC all %%steal 0,00
mysecret 3 2015-05-11 10:01:23 UTC all %%idle 97,97
mysecret 3 2015-05-11 10:01:26 UTC all %%user 4,57
mysecret 3 2015-05-11 10:01:26 UTC all %%nice 0,00
mysecret 3 2015-05-11 10:01:26 UTC all %%system 2,20
mysecret 3 2015-05-11 10:01:26 UTC all %%iowait 0,00
mysecret 3 2015-05-11 10:01:26 UTC all %%steal 0,00
mysecret 3 2015-05-11 10:01:26 UTC all %%idle 93,23
从man sar
:
sar -o datafile interval count
All data are captured in binary form and saved to a file (datafile).
The data can then be selectively displayed with the sar command using the -f option. Set the interval and count parameters to select count records at interval second intervals.
If the count parameter is not set, all the records saved in the file will be selected.
Collection of data in this manner is useful to characterize system usage over a period of time and determine peak usage hours.