System Administration Guide: Resource Management and Network Services

Using Extended Accounting Functionality

How to Activate Extended Accounting for Processes and Tasks

To activate the extended accounting facility for tasks and processes, use the acctadm(1M) command. The optional final parameter to acctadm indicates whether the command should act on the process or the system task accounting components of the extended account facility.

  1. Become superuser.

  2. Activate extended accounting for processes.


    # acctadm -e extended -f /var/adm/exacct/proc process 
    
  3. Activate extended accounting for tasks.


    # acctadm -e extended,mstate -f /var/adm/exacct/task task
    

How to Activate Extended Accounting With a Startup Script

Activate extended accounting on an ongoing basis by linking the /etc/init.d/acctadm script into /etc/rc2.d.


# ln -s /etc/init.d/acctadm /etc/rc2.d/Snacctadm
# ln -s /etc/init.d/acctadm /etc/rc2.d/Knacctadm

The n variable is replaced by a number.

See Extended Accounting Configuration for information on accounting configuration.

How to Display Extended Accounting Status

Type acctadm without arguments to display the current status of the extended accounting facility.


# acctadm
                 Task accounting: active
            Task accounting file: /var/adm/exacct/task
          Tracked task resources: extended,mstate
        Untracked task resources: host
              Process accounting: active
         Process accounting file: /var/adm/exacct/proc
       Tracked process resources: extended
     Untracked process resources: host,mstate

In the previous example, system task accounting is active in extended mode and mstate mode. Process accounting is active in extended mode.


Note –

In the context of extended accounting, microstate (mstate) refers to the extended data, associated with microstate process transitions, that is available in the process usage file (see proc(4)). This data provides much more detail about the activities of the process than basic or extended records.


How to View Available Accounting Resources

Available resources can vary from system to system, and from platform to platform. Use the -r option to view the available accounting resources on the system.


# acctadm -r
process:
extended pid,uid,gid,cpu,time,command,tty,projid,taskid,ancpid,wait-status,flag
basic    pid,uid,gid,cpu,time,command,tty,flag
task:
extended taskid,projid,cpu,time,host,mstate,anctaskid
basic    taskid,projid,cpu,time

How to Deactivate Process and Task Accounting

To deactivate process and task accounting, turn off each of them individually.

  1. Become superuser.

  2. Turn off process accounting.


    # acctadm -x process 
    
  3. Turn off task accounting.


    # acctadm -x task
    
  4. Verify that task accounting and process accounting have been turned off.


    # acctadm
                     Task accounting: inactive
                Task accounting file: none
              Tracked task resources: extended,mstate
            Untracked task resources: host
                  Process accounting: inactive
             Process accounting file: none
           Tracked process resources: extended
         Untracked process resources: host,mstate