SGI
Open Source
CSA FAQ

What is CSA?
How is CSA different from other Linux accounting packages?
What is a job?
How do I write a daily or periodic report user exit?
How do I change the daily or periodic report content?
How do I try out the different report formats?


What is CSA? CSA is a set of C programs and shell scripts that provide methods for collecting per-process resource usage data, monitoring disk usage, and charging fees to specific login accounts. CSA takes this per-process accounting information and combines it by job identifier (jid) within system boot uptime periods.

How is CSA different from other Linux accounting packages? Linux has a form of process accounting which is similar to SysV/BSD basic process accounting. The set of Linux accounting commands provide similar functionality but have different names and options.

The Linux kernel itself monitors the size of the accounting records file (pacct). CSA monitoring of file size takes place outside of the kernel.

Currently, Linux has process accounting which provides the following per process resource usage information. However, the characters read/written and blocks read/written are hardcoded to zero.

. cpu user time
. cpu system time
. memory integral
. i/o characters transferred
. blocks read and written
. minor pagefaults
. major pagefaults
. swaps
. exit status

CSA adds the following additional per process resource usage kernel counters:

. characters read and written
. blocks read and written
. number of read and write system calls
. block i/o wait time

CSA provides the following features which are not available with other Linux accounting packages:

1) Per-job accounting
2) Daemon accounting
3) User job accounting (ja command)
4) Flexible accounting periods (not just daily and monthly periods)
5) Flexible system billing units (SBUs)
6) Offline archiving of accounting data
7) User exits for site specific customization of reports
8) Configurable parameters

What is a job? A job is a grouping of processes that the system treats as a single entity and is identified by a unique job identifier (job ID). CSA organizes accounting data by jobs and boot times outside of the kernel.

For non-workload management jobs, a job consists of all accounting data for a given job ID during a single boot period (i.e. accounting data for all processes within a login session).

For a workload management job, a job consists of the accounting data for all job IDs associated with the workload management identifier. For example, the job output may be returned by workload management daemons with separate job IDs. CSA uses the workload management identifier to combine the accounting records from those daemons with the accounting records of the actual executing job.

How do I write a daily or periodic report user exit? The csarun and csaperiod scripts have some comments about this. The shell variables used in these two scripts are available for use within a user exit script. For example, the sorted pacct file is deleted after a successful daily accounting run. If I want to save that file, I could use any of the user exits that are executed after the sorted pacct file is created (see csarun). Here is a simple user exit script to do that:

#! /bin/sh
echo "Copying spacct file to /tmp/spacct"
cp ${SPACCT} /tmp/spacct

How do I change the daily or periodic report content? The /etc/csa.conf file has configuration variables for the commands used to create the report sections within the daily and periodic reports. The options for the csabuild, csacrep, csadrep and csarecy commands can be changed in /etc/csa.conf. These changes are picked up by csarun and csaperiod. Changing the csacrep command options affects the information that is reported in the "CONSOLIDATED INFORMATION REPORT" of the daily report and the first section in the periodic report. Changing the csadrep command options affects the information that is reported in the "DAEMON USAGE REPORT" of the daily report.

If you want to keep the default report formats but want additional reports, user exits can be used to generate the additional reports.

How do I try out the different report formats? The input data needed varies by command. The man pages describe the input and output data files. Typically, a sorted pacct file is needed, followed by binary data generated from that sorted pacct file. For example, if I want another report format for the consolidated information, here's what I could do:

1) Write a user exit as described earlier to save a sorted pacct file

2) Manually run the daily accounting reports as root to create a sorted pacct file:
/usr/local/sbin/csarun 2> /var/csa/nite/fd2log

3) Csarun executes user exit scripts, so there is now a sorted pacct (spacct) file saved

4) Use the csacon command to consolidate information by job id and user id:
/usr/local/sbin/csacon -ju -s /tmp/spacct > /tmp/cacct

5) Use the csacrep command to create a consolidated report sorted by job id and user id with just i/o resource usage information:
/usr/local/sbin/csacrep -huxJ < /tmp/cacct

NOTE: It is important to match up the consolidation options when creating the consolidated binary data with the options to be used when writing a report. The csacrep consolidated binary data created with the default daily report run can't be used to generate a report sorted by job id and user id. That is not how the data was combined together into the consolidated records.

Once a saved sorted pacct file is available, other CSA commands with varying options, such as the csajrep command, can be used to find the mix of report information that meets your needs.