The sadc data collection utility periodically collects data on system activity and saves the data in a file in binary format, one file for each 24-hour period. You can set up the sadc command to run periodically (usually once each hour), and whenever the system boots to multi-user mode. The data files are placed in the /var/adm/sa directory. Each file is named sadd, where dd is the current date. The format of the command is as follows:
/usr/lib/sa/sadc [t n] [ofile]
The command samples n times with an interval of t seconds, which should be greater than five seconds between samples. This command then writes to the binary ofile file, or to standard output.
The sadc command should be run at system boot time to record the statistics from when the counters are reset to zero. To make sure that the sadc command is run at boot time, the svcadm enable system/sar:default command writes a record to the daily data file.
/usr/bin/su sys -c "/usr/lib/sa/sadc /var/adm/sa/sa`date +%d`"
# 0 * * * 0-6 /usr/lib/sa/sa1 # 20,40 8-17 * * 1-5 /usr/lib/sa/sa1 # 5 18 * * 1-5 /usr/lib/sa/sa2 -s 8:00 -e 18:01 -i 1200 -A
The default sys crontab entries perform the following functions:
The first two crontab entries cause a record to be written to the /var/adm/sa/sadd file every 20 minutes from 8 am to 5 pm, Monday through Friday, and every hour on the hour otherwise.
The third entry writes a record to the /var/adm/sa/sardd file hourly, Monday through Friday, and includes all sar options.
You can change these defaults to meet your needs.
The sar command has the following syntax:
sar [-aAbcdgkmpqruvwy] [-o file] t [n]
sar [-aAbcdgkmpqruvwy] [-s time] [-e time] [-i sec] [-f file]
The first format samples cumulative activity counters in the operating system every t seconds, n times. The t should be five seconds or greater. Otherwise, the command itself might affect the sample. You must specify a time interval in which to take the samples. Otherwise, the command operates according to the second format. The default value of n is 1.
The following example, using the second format, takes two samples separated by 10 seconds. If the –o option is specified, samples are saved in a binary format.
$ sar -u 10 2
The sar command with the second format, with no sampling interval or number of samples specified, extracts data from a previously recorded file. This file is either the file specified by the –f option or, by default, the standard daily activity file, /var/adm/sa/sadd, for the most recent day.
The –s and –e options define the starting time and the ending time for the report. Starting and ending times are of the form hh[:mm[:ss]], where hh, mm, and ss represent hours, minutes, and seconds.
The –i option specifies, in seconds, the intervals between record selection. If the –i option is not included, all intervals that are found in the daily activity file are reported.
Checks file access operations
Checks buffer activity
Checks system calls
Checks activity for each block device
Checks page-out and memory freeing
Checks kernel memory allocation
Checks interprocess communication
Checks system table status
Checks swap and dispatch activity
Checks queue activity
Checks unused memory
Checks CPU utilization
Checks swapping and switching volume
Checks terminal activity
Reports overall system performance, which is the same as entering all options
This version of the sadc command writes a special record that marks the time when the counters are reset to zero (boot time).
# crontab -e sys
0 * * * 0-6 /usr/lib/sa/sa1 20,40 8-17 * * 1-5 /usr/lib/sa/sa1 5 18 * * 1-5 /usr/lib/sa/sa2 -s 8:00 -e 18:01 -i 1200 -A
For more information, see the crontab(1) man page.