Contained WithinFind More DocumentationFeatured Support Resources | Descargar este libro en PDF (3221 KB)
Chapter 4 Extended Accounting (Overview)By using the project and task facilities that are described in Chapter 2, Projects and Tasks (Overview) 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 processes and tasks. The following topics are covered in this chapter. To begin using extended accounting, skip to How to Activate Extended Accounting for Flows, Processes, Tasks, and Network Componentss. Introduction to Extended AccountingThe extended accounting subsystem labels 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 Chapter 31, Using Flow Accounting and Statistics Gathering (Tasks), in System Administration Guide: IP Services, to capture network flow information on a system. Before 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 System provides a flexible way to record system and network resource consumption for the following:.
Unlike online monitoring tools, which enable you to 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 Operating System 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 (see 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. For example, 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 on running processes and tasks can also be written. For more information on tasks, see Chapter 2, Projects and Tasks (Overview). Figure 4–1 Task Tracking With Extended Accounting Activated
Extensible FormatThe extended accounting format is substantially more extensible than the SunOSTM 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. Using Extended Accounting on a Solaris System with Zones InstalledThe extended accounting subsystem collects and reports information for the entire system (including non-global zones) when run in the global zone. The global administrator can also determine resource consumption on a per-zone basis. See Extended Accounting on a Solaris System With Zones Installed for more information. Extended Accounting ConfigurationThe directory /var/adm/exacct is the standard location for placing extended accounting data. You can use the acctadm command to specify a different location for the process and task accounting-data files. See acctadm(1M) for more information. Starting and Persistently Enabling Extended AccountingTthe acctadm command described in acctadm(1M) starts extended accounting through the Solaris service management facility (SMF) service described in smf(5). The extended accounting configuration is stored in the SMF repository. The configuration is restored at boot by a service instance, one for each accounting type. Each of the extended accounting types is represented by a separate instance of the SMF service:
Enabling extended accounting by using acctadm(1M) causes the corresponding service instance to be enabled if not currently enabled, so that the extended accounting configuration will be restored at the next boot. Similarly, if the configuration results in accounting being disabled for a service, the service instance will be disabled. The instances are enabled or disabled by acctadm as needed. To permanently activate extended accounting for a resource, run:
resource_list is a comma-separated list of resources or resource groups. RecordsThe acctadm command appends new records to an existing /var/adm/exacct file. Commands Used With Extended Accounting
For information on commands that are associated with tasks and projects, see Example Commands and Command Options. 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. |
|||||||||||||||||||||||||||||||||||||||