sun.com docs.sun.com My Sun Worldwide Sites

Previous Previous     Contents     Index     Next Next

Chapter 5

Administering Extended Accounting (Tasks)

This chapter describes how to administer the extended accounting subsystem.

For an overview of the extending accounting subsystem, see Chapter 4, Extended Accounting (Overview).

Administering the Extended Accounting Facility (Task Map)

Task

Description

For Instructions

Activate the extended accounting facility.

Use extended accounting to monitor resource consumption by each project running on your system. You can use the extended accounting subsystem to capture historical data for tasks, processes, and flows.

How to Activate Extended Accounting for Processes, Tasks, and Flows, How to Activate Extended Accounting With a Startup Script

Display extended accounting status.

Determine the status of the extended accounting facility.

How to Display Extended Accounting Status 

View available accounting resources.

View the accounting resources available on your system.

How to View Available Accounting Resources 

Deactivate the process, task, and flow accounting facility.

Turn off the extended accounting functionality.

How to Deactivate Process, Task, and Flow Accounting 

Use the Perl interface to the extended accounting facility.

Use the Perl interface to develop customized reporting and extraction scripts.

Using the Perl Interface to libexacct 

Using Extended Accounting Functionality

ProcedureHow to Activate Extended Accounting for Processes, Tasks, and Flows

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

  1. Become superuser or assume an equivalent role.

    Roles contain authorizations and privileged commands. For more information about roles, see "Using the Solaris Management Tools With RBAC (Task Map)" in System Administration Guide: Basic Administration.

  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

  4. Activate extended accounting for flows.

    # acctadm -e extended -f /var/adm/exacct/flow flow

See Also

See acctadm(1M) for more information.

ProcedureHow to Activate Extended Accounting With a Startup Script

  1. Become superuser, or assume the Primary Administrator role.

    To create the role and assign the role to a user, see "Using the Solaris Management Tools With RBAC (Task Map)" in System Administration Guide: Basic Administration.

  2. 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.


    Tip - You must manually activate extended accounting at least once to set up the configuration.


See Also

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.

machine% acctadm
                 Task accounting: active
            Task accounting file: /var/adm/exacct/task
          Tracked task resources: extended
        Untracked task resources: none
              Process accounting: active
         Process accounting file: /var/adm/exacct/proc
       Tracked process resources: extended
     Untracked process resources: host
                 Flow accounting: active
            Flow accounting file: /var/adm/exacct/flow
          Tracked flow resources: extended
        Untracked flow resources: none

In the previous example, system task accounting is active in extended mode and mstate mode. Process and flow accounting are 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 substantially 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 acctadm command with the -r option to view the accounting resources available on your system.

machine% acctadm -r
process:
extended pid,uid,gid,cpu,time,command,tty,projid,taskid,ancpid,wait-status,zone,flag,
memory,mstatedisplays as one line
basic    pid,uid,gid,cpu,time,command,tty,flag
task:
extended taskid,projid,cpu,time,host,mstate,anctaskid,zone
basic    taskid,projid,cpu,time
flow:
extended 
saddr,daddr,sport,dport,proto,dsfield,nbytes,npkts,action,ctime,lseen,projid,uid
basic    saddr,daddr,sport,dport,proto,nbytes,npkts,action

ProcedureHow to Deactivate Process, Task, and Flow Accounting

To deactivate process, task, and flow accounting, turn off each of them individually by using the acctadm command with the -x option.

  1. Become superuser or assume an equivalent role.

    Roles contain authorizations and privileged commands. For more information about roles, see "Using the Solaris Management Tools With RBAC (Task Map)" in System Administration Guide: Basic Administration.

  2. Turn off process accounting.

    # acctadm -x process 

  3. Turn off task accounting.

    # acctadm -x task

  4. Turn off flow accounting.

    # acctadm -x flow

  5. Verify that task accounting, process accounting, and flow accounting have been turned off.

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

Previous Previous     Contents     Index     Next Next
Company Info Contact Terms of Use Privacy Copyright 1994-2007 Sun Microsystems, Inc.