![]() |
![]() |
| |||||||||||||||||||||||||||||||||||||||
Chapter 6Extended AccountingBy using the project and task facilities that are described in Chapter 5, Projects and Tasks to label and separate workloads, you can monitor resource consumption by each workload. You can use the extended accounting subsystem to capture a detailed set of resource consumption statistics on both running processes and tasks. The extended accounting subsystem labels the usage records with the project for which the work was done. You can also use extended accounting, in conjunction with the Internet Protocol Quality of Service (IPQoS) flow accounting module described in "Using Flow Accounting and Statistics Gathering (Tasks)" in IPQoS Administration Guide, to capture network flow information on a system. To begin using extended accounting, see How to Activate Extended Accounting for Processes, Tasks, and Flows. OverviewBefore you can apply resource management mechanisms, you must first be able to characterize the resource consumption demands that various workloads place on a system. The extended accounting facility in the Solaris operating environment provides a flexible way to record system and network resource consumption on a task or process basis, or on the basis of selectors provided by IPQoS (see ipqos(7IPP)). Unlike online monitoring tools, which measure system usage in real time, extended accounting enables you to examine historical usage. You can then make assessments of capacity requirements for future workloads. With extended accounting data available, you can develop or purchase software for resource chargeback, workload monitoring, or capacity planning. How Extended Accounting WorksThe extended accounting facility in the Solaris environment uses a versioned, extensible file format to contain accounting data. Files that use this data format can be accessed or be created by using the API provided in the included library, libexacct(3LIB). These files can then be analyzed on any platform with extended accounting enabled, and their data can be used for capacity planning and chargeback. If extended accounting is active, statistics are gathered that can be examined by the libexacct API. libexacct allows examination of the exacct files either forward or backward. The API supports third-party files that are generated by libexacct as well as those files that are created by the kernel.There is a Practical Extraction and Report Language (Perl) interface to libexacct that enables you to develop customized reporting and extraction scripts. See Perl Interface to libexacct. With extended accounting enabled, the task tracks the aggregate resource usage of its member processes. A task accounting record is written at task completion. Interim records can also be written. For more information on tasks, see Chapter 5, Projects and Tasks. Figure 6-1 Task Tracking With Extended Accounting Activated ![]() Extensible FormatThe extended accounting format is substantially more extensible than the SunOS legacy system accounting software format (see "What is System Accounting?" in System Administration Guide: Advanced Administration). Extended accounting permits accounting metrics to be added and removed from the system between releases, and even during system operation. Note - Both extended accounting and legacy system accounting software can be active on your system at the same time. exacct Records and FormatRoutines that allow exacct records to be created serve two purposes.
The format permits different forms of accounting records to be captured without requiring that every change be an explicit version change. Well-written applications that consume accounting data must ignore records they do not understand. The libexacct library converts and produces files in the exacct format. This library is the only supported interface to exacct format files. Note - The getacct, putacct, and wracct system calls do not apply to flows. The kernel creates flow records and writes them to the file when IPQoS flow accounting is configured. Extended Accounting ConfigurationThe /etc/acctadm.conf file contains the current extended accounting configuration. The file is edited through the acctadm interface, not by the user. The directory /var/adm/exacct is the standard location for placing extended accounting data. You can use the acctadm(1M) command to specify a different location for the process and task accounting-data files. Commands Used With Extended Accounting
For information on commands that are associated with tasks and projects, see Commands Used to Administer Projects and Tasks. For information on IPQoS flow accounting, see ipqosconf(1M). Perl Interface to libexacctThe Perl interface allows you to create Perl scripts that can read the accounting files produced by the exacct framework. You can also create Perl scripts that write exacct files. The interface is functionally equivalent to the underlying C API. When possible, the data obtained from the underlying C API is presented as Perl data types. This feature makes accessing the data easier and it removes the need for buffer pack and unpack operations. Moreover, all memory management is performed by the Perl library. The various project, task, and exacct-related functions are separated into groups. Each group of functions is located in a separate Perl module. Each module begins with the Sun standard Sun::Solaris:: Perl package prefix. All of the classes provided by the Perl exacct library are found under the Sun::Solaris::Exacct module. The underlying libexacct(3LIB) library provides operations on exacct format files, catalog tags, and exacct objects. exacct objects are subdivided into two types:
The following table summarizes each of the modules.
For examples that show how to use the modules described in the previous table, see Using the Perl Interface to libexacct. Using Extended Accounting Functionality
|
# acctadm -e extended -f /var/adm/exacct/proc process |
Activate extended accounting for tasks.
# acctadm -e extended,mstate -f /var/adm/exacct/task task |
Activate extended accounting for flows.
# acctadm -e extended -f /var/adm/exacct/flow flow |
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.
Previous Contents Index Next ![]() |