DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Managing system performance

Collecting system activity data automatically

The sadc(1M) command can automatically sample system data. The format of this command is:

   /usr/lib/sa/sadc [t n] [ofile]
The command samples n times with an interval of t seconds (t should be greater than 5 seconds) between samples. It then writes, in binary format, to the file ofile, or to standard output. If t and n are omitted, a default interval is used.

When the Advanced Commands Package is installed, several files are automatically created or appended that cause system activity commands to run automatically.

The file /etc/init.d/perf, which is linked to /etc/dinit.d/S85perf, causes the sadc command to reset the counters to zero and then count usage. The output of sadc is put in the file sadd which acts as the daily system activity record. The command entry in the /etc/init.d/perf file that does this is:

   su sys -c "/usr/lib/sa/sadc /var/adm/sa/sa`date +%d`"
Once the performance package is installed, the cron file /var/spool/cron/crontabs/sys contains commands that enable the automatic collection of system activity data. The commands in the cron file are sa1 and sa2. The shell script sa1 has the following format:
   /usr/lib/sa/sa1 [t n]
The arguments t and n cause records to be written n times at an interval of t seconds. If these arguments are omitted, the records are written only once. The records are written to the binary file /var/adm/sa/sadd, where dd is the current date. The sa1 command is performed automatically by cron using the following two entries found in /var/spool/cron/crontab/sys:
   0 * * * 0-6 /usr/lib/sa/sa1
   20,40 8-17 * * 1-5 /usr/lib/sa/sa1
The first entry causes a record to be written to /var/adm/sa/sadd on the hour, every hour, seven days a week. The second entry causes a record to be written to /var/adm/sa/sadd 20 minutes and 40 minutes after each hour from 8:00 A.M. to 5:00 P.M., Monday through Friday. Thus, these two crontab entries cause a record to be written to /var/adm/sa/sadd every 20 minutes from 8:00 A.M. to 5:00 P.M., Monday through Friday, and every hour on the hour otherwise. These defaults can easily be changed to meet your daily needs.

The shell script sa2 has the following format:

/usr/lib/sa/sa2 [-ubdycwaqvtmpgrkAR] [-s time] [-e time] [-i sec]

The sa2 command invokes the sar command with the arguments specified and writes the ASCII output to the file /var/adm/sa/sardd, where dd is the current date. The report starts at -s time, ends at -e time, and is taken as close to -i sec intervals as possible. See the description of the sar command in ``Collecting system activity data on demand'' for an explanation of the remaining options.

When installed, the performance package includes the following entry in the /var/spool/cron/crontabs/sys file:

   5 18 * * 1-5 /usr/lib/sa/sa2 -s 8:00 -e 18:01 -i 1200 -A
This generates a sar report for all data from /var/adm/sa/sadd. The report covers 20 minute intervals from 8:00 A.M. to 6:01 P.M., Monday through Friday. Because /var/adm/sa/sadd does not have data for 5:20 and 5:40 if the above sa1 cron entries are used, the sar report will not have data for those times either.
Next topic: Collecting system activity data on demand
Previous topic: System activity reporting

© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 22 April 2004