Описание тега sar
Usage:
sar [ -A ] [ -b ] [ -B ] [ -C ] [ -d ] [ -h ] [ -i interval ] [ -m ] [ -p ] [ -q ] [ -r ] [ -R ] [ -S ] [ -t ] [ -u [ ALL ] ] [ -v ] [ -V ] [ -w ] [ -W ] [ -y ] [ -n { keyword [,...] | ALL } ] [ -I { int [,...] | SUM | ALL | XALL } ] [ -P { cpu [,...] | ALL } ] [ -o [ filename ] | -f [ filename ] ] [ -s [ hh:mm:ss ] ] [ -e [ hh:mm:ss ] ] [ interval [ count ] ]
Description:
The sar
command writes to standard output the contents of selected cumulative activity counters in the operating system. The accounting system, based on the values in the count
and interval
parameters, writes information the specified number of times spaced at the specified intervals in seconds. If the interval
parameter is set to zero, the sar
command displays the average statistics for the time since the system was started. If the interval
parameter is specified without the count
parameter, then reports are generated continuously. The collected data can also be saved in the file specified by the -o filename
flag, in addition to being displayed onto the screen. If filename
is omitted, sar
uses the standard system activity daily data file, the /var/log/sa/sadd
file, where the dd
parameter indicates the current day. By default all the data available from the kernel are saved in the data file.
The sar
command extracts and writes to standard output records previously saved in a file. This file can be either the one specified by the -f
flag or, by default, the standard system activity daily data file.
Without the -P
flag, the sar
command reports system-wide (global among all processors) statistics, which are calculated as averages for values expressed as percentages, and as sums otherwise. If the -P
flag is given, the sar
command reports activity which relates to the specified processor or processors. If -P ALL
is given, the sar
command reports statistics for each individual processor and global statistics among all processors.
You can select information about specific system activities using flags. Not specifying any flags selects only CPU activity. Specifying the -A
flag is equivalent to specifying -bBdqrRSvwWy -I SUM -I XALL -n ALL -u ALL -P ALL
.
The default version of the sar
command (CPU utilization report) might be one of the first facilities the user runs to begin system activity investigation, because it monitors major system resources. If CPU utilization is near 100 percent (user + nice + system), the workload sampled is CPU-bound.
If multiple samples and multiple reports are desired, it is convenient to specify an output file for the sar
command. Run the sar
command as a background process. The syntax for this is:
sar -o datafile interval count >/dev/null 2>&1 &
All data is 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.
Note: The sar
command only reports on local activities.