acctctl Command

Purpose

Controls advanced accounting.

Syntax

acctctl fadd file size

acctctl frm file

acctctl freset file

acctctl fquery [file]

acctctl fswitch [file]

acctctl isystem {time|off}

acctctl iprocess {time|off}

acctctl agproc {on|off}

acctctl agke {on|off}

acctctl agarm {on|off}

acctctl trquery [trid] [-@ [wpar]]

acctctl tron trid [-@ wpar]

acctctl troff trid [-@ wpar]

acctctl email {on|off|addr}

acctctl on [-@ [wpar]]

acctctl off [-@ [wpar]]

acctctl [-@ [wpar]]

acctctl turacct {on|off}

Description

The administration of Advanced Accounting (AACCT) is organized around the following high level tasks, which are mostly performed by the acctctl command.
  • Manage Accounting Data Files.
  • Manage Project Definitions and Assignments.
  • Manage Transactions.
  • Manage Advanced Accounting Subsystem.

The -@ option is not supported when executed within a workload partition.

Managing Accounting Data Files

The first task is centered around file management. Files are pre-allocated and registered with the AACCT subsystem, so that it can continuously stream accounting data to these files. When an accounting file is filled, AACCT automatically switches to the next available registered file. If there is no such file, then incoming data might be lost, unless the administrator or the billing application quickly reacts to the problem.

Messages are sent alerting the administrator to the status of files, so that he can avoid these types of problems before they occur. The best approach is to allocate sufficient file space up front. Messages are sent, when a file approaches the full state, and when the system automatically switches to another file. Messages are sent by way of the syslog facility and email. These subsystems have to be correctly configured in order to receive messages.

When the system runs out of accounting files, it internally buffers accounting data, so data is not immediately lost. If the administrator does not respond in time and data is lost, then the system internally maintains some statistics about the outage, which it logs to the accounting subsystem, after the condition has been corrected.

Before starting AACCT, the system administrator should create the accounting files that will be needed on the system. The number and size of these files is workload dependent, so the administrator should choose values that are appropriate for the specific installation. The only recommendation is that at least two files be created, so that AACCT can remain active at all times.

The following commands are provided for managing files:
Item Description
acctctl fadd file size Allocates and defines an accounting file with specified filename and size. The size is in megabytes.
acctctl frm file Removes the specified accounting file from the accounting subsystem. This will not remove the file from the file system.
acctctl freset file Indicates that the specified file can now be reused by the accounting subsystem.
acctctl fquery [file] Queries the state and current utilization of the specified file, if supplied, or all accounting files otherwise.
acctctl fswitch [file] Forces accounting to switch to a new accounting file. The new file can be optionally specified.

All files must be fully qualified path names. When creating a file, ensure that the file system has enough space.

Managing Project Definitions and Assignments

The second task, Manage Project Definitions and Assignments, is supported through the projctl command. Projects are optional. For a description of this capability, see the projctl command in Commands Reference, Volume 4.

Managing Transactions

The third task, Manage Transactions, is designed to control the type of accounting data that is produced, which is configuration dependent, because applications and middleware can provide transactions. The following types of accounting are supported on all systems:
  • Process
  • Disk
  • Network interfaces
  • File systems
  • System (provides global CPU and memory use)

Administrative control over these sources of accounting data is provided by enabling or disabling the accounting records that they produce. Each accounting record is assigned a unique identifier, so that report and analysis commands can apply the appropriate templates when processing the accounting file. These identifiers also serve to name the different types of accounting that is supported and are specified as parameters to the transaction specific commands. Identifiers are listed in the sys file.

The following commands are provided for managing transactions:
Item Description
acctctl trquery [trid] [-@ [wpar]] Queries the state and name of the specified trid, if supplied, or of all trids, otherwise. If you specify the -@ option without the wpar parameter, query trids in all active workload partitions. If you specify the -@ option with the wpar parameter, query trids for the specified workload partition only.
acctctl tron trid [-@ wpar] Enables the specified transaction. If you specify the -@ option with the wpar parameter, enable the transaction in the specified workload partition only.
acctctl troff trid [-@ wpar] Disables the specified transaction. If you specify the -@ option with the wpar parameter, disable the transaction in the specified workload partition only.

By default, all transactions identifiers are enabled.

Not all transaction identifiers can be disabled, because some of them are derived types and are dependent on other transactions. For example, the process aggregation record is dependent on the process record, so it can't be disabled by itself. Aggregation can be enabled or disabled, and process accounting can be enabled or disabled, but the transaction identifier that corresponds to the aggregated process record can't be disabled. Aggregation is a convenience in the sense that it sums up data internally, so that fewer records are produced. In some cases, data aggregation is provided to simplify data management.

Managing the Advanced Accounting Subsystem

The fourth task, Manage Advanced Accounting Subsystem, is concerned with controlling the execution environment of the subsystem itself. Sub-tasks are oriented towards configuring, running, stopping, and querying AACCT.

The following commands are provided for managing the subsystem:
Item Description
acctctl email {on|off|addr} Sets up e-mail notifications. If given the on subcommand, the last used e-mail address will be used. The e-mail address is limited to 80 characters. Mail must be configured for e-mail notification to function.
acctctl iprocess {time|off} Enables process interval accounting every time minutes or disables process interval accounting entirely.
acctctl isystem {time|off} Enables system interval accounting every time minutes or disables system interval accounting entirely.
acctctl agproc {on|off} Enables or disables system-wide aggregation for processes.
acctctl agke {on|off} Enables or disables system-wide aggregation for third party kernel extensions.
acctctl agarm {on|off} Enables or disables system-wide aggregation for ARM transactions.
acctctl dump pid Writes the accounting record for the named process into the accounting file.
acctctl on [-@ [wpar]] Starts Advanced Accounting. If you specify the -@ option without the wpar parameter, start Advanced Accounting for all active workload partitions. If you specify the -@ option with the wpar parameter, start Advanced Accounting for the specified workload partition only.
acctctl off [-@ [wpar]] Stops Advanced Accounting. If you specify the -@ option without the wpar parameter, stop Advanced Accounting for all active workload partitions. If you specify the -@ option with the wpar parameter, stop Advanced Accounting for the specified workload partition only.
acctctl [-@ [wpar]] Queries overall accounting state. If you specify the -@ option without the wpar parameter, query the Advanced Accounting state for all active workload partitions. If you specify the -@ option with the wpar parameter, query the Advanced Accounting state of the specified workload partition only.
acctctl turacct {on|off} Enables or disables the accounting based on Scaled Performance Utilization Resources Register (SPURR) in turbo mode.

Exit Status

This command returns the following exit values:

Item Description
0 The command executed successfully.
>0 An error occurred.

Security

Root authority is required to use this command.

Data files are created by this command. These files are owned by root, but are readable by members of the adm group.

Attention RBAC users and Trusted AIX® users: This command can perform privileged operations. Only privileged users can run privileged operations. For more information about authorizations and privileges, see Privileged Command Database in Security. For a list of privileges and the authorizations associated with this command, see the lssecattr command or the getcmdattr subcommand.

Examples

  1. To display status, type:
    acctctl
    Output similar to the following is displayed:
    Advanced Accounting is not running.
    Email notification is off.
    The current email address to be used is not set.   
    Process Interval Accounting is off.
    System Interval Accounting is off.
    System-wide aggregation of process data is off.
    System-wide aggregation of third party kernel extension data is off.
    System-wide aggregation of ARM transactions is off.
    Files: 0 defined, 0 available.
  2. To turn on accounting, type:
    acctctl on
  3. To add a 200 MB data file, type:
    acctctl fadd /var/aacct/acctdata1 200
  4. To enable the process interval so that it collects data every 2 hours, type:
    acctctl iprocess 120
  5. To set process aggregation, type:
    acctctl agproc on
  6. To enable e-mail notification, type:
    acctctl email on
  7. To specify an e-mail address for notification, type:
    acctctl email user@company.com
  8. To turn on accounting for WPARs on system, use the following command:
    acctctl on -@
  9. To list trids specific to a WPAR that is named wpar1, use the following command:
    acctctl trquery -@ wpar1
    A similar result will be displayed as follows:
    NUMBER       	STATE           NAME
    	33           disabled       wpar-proc
    	34           disabled       wpar-agg_proc
    	35           disabled       wpar-agg_app
    	36           enabled        wpar-system
    	38           enabled        wpar-file
    	39           enabled        wpar-netif
    	44           disabled       wpar-agg_KE

Location

/usr/bin/acctctl

Files

Item Description
/var/aacct Default directory for accounting data files.
/var/aacct/acctdata Default accounting data file.

Data files can be created in other locations by the system administrator.