[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 Commands Reference, Volume 1

acctmerg Command

Purpose

Merges total accounting files into an intermediary file or a daily report.

Syntax

/usr/sbin/acct/acctmerg-a Specification ] ] [ -h Specification ] ] [ -i Specification ] ] [ -p Specification ] ] [ -q Filename ] [ -v Specification ] ] [ -t ] [ -u ] [ File ... ]

Description

The acctmerg command merges process, connect-time, fee, disk-usage, and queuing (printer) total accounting records (in tacct binary or tacct ASCII format) and then writes the results to standard output. (See the tacct structure in the acct File Format for a description of the total accounting format). The acctmerg command reads the total accounting records from standard input and from the additional files (up to nine) specified by the File parameter. The acctmerg command then merges the records by identical keys, usually a user ID and name. To facilitate storage, the acctmerg command writes the output in binary format unless you use either the -a, -v, or -p flag.

The acctmerg command is called by the runacct command to produce either an intermediate report when one of the input files is full, or to merge the intermediate reports into a cumulative total. The intermediate report is stored in the /var/adm/acct/nite/daytacct file. The cumulative report is stored in the /var/adm/acct/sum/tacct file. The cumulative total is the source from which the monacct command produces the ASCII-format monthly summary report. The monthly summary report is stored in the /var/adm/acct/fiscal file.

The Specification variable allows you to select input or output fields, as illustrated in Example 1 on page 1-3. A field specification is a comma-separated list of field numbers, in the order specified in the tacct structure in the acct File Format. Field ranges may be used, with array sizes taken into account, except for the ta_name characters. In the following example:

-h2-3,11,15-13,2

The -h flag causes column headings to display for the following types of data, in this order:

The default displays all fields, otherwise specified as 1-18 or 1-, and produces wide output lines containing all the available accounting data.

Queueing system, disk usage, or fee data can be converted into tacct records by using the acctmerg -i Specification command.

The tacct fields are:

No. Header Description
1 UID User ID number.
2 LOGIN NAME Login name of user.
3 CPU PRIME Cumulative CPU minutes during prime hours.
4 CPU NPRIME Cumulative during non-prime hours.
5 KCORE PRIME Cumulative minutes spent in the kernel during prime hours.
6 KCORE NPRIME Cumulative during non-prime hours.
7 BLKIO PRIME Cumulative blocks transferred during prime hours.
8 BLKIO NPRIME Cumulative during non-prime hours.
9 RW/WR PRIME Cumulative blocks read/written during prime hours.
10 RW/WR NPRIME Cumulative during non-prime hours.
11 CONNECT PRIME Cumulative connect time (minutes) during prime hours.
12 CONNECT NPRIME Cumulative during non-prime hours.
13 DISK BLOCKS Cumulative disk usage.
14 PRINT Queuing system charges. (pages)
15 FEES Fee for special services.
16 # OF PROCS Count of processes.
17 # OF SESS Count of login sessions.
18 # OF SAMPLES Count of count of disk samples.

Flags

-a[Specification] Produces output in the form of ASCII records.
-h[Specification] Displays column headings. This flag implies the -a flag, but is effective with -p or -v.
-i[Specification] Expects input files composed of ASCII records, which are converted to binary records.
-p[Specification] Displays input without processing. The output is in ASCII format.
-q Filename Reads the specified qacct file (accrec.h file format) and produces output records sorted by user ID and user name. These records contain the user ID, user name, and number of pages printed.
-t Produces a single record that contains the totals of all input.
-u Summarizes by user ID rather than by user name.
-v[Specification] Produces output in ASCII format, with more precise notation for floating-point numbers.

Security

Access Control: This command should grant execute (x) access only to members of the adm group.

Examples

  1. To merge disk accounting file dacct  with field specification -i1-2,13,18 into an existing total accounting file, tacct , enter:
    acctmerg -i1-2,13,18 <dacct | acctmerg tacct >output
    The acctmerg command reads the field specifications for the user ID, login name, number of blocks, and number of disk samples (i1-2,13,18 ) from the dacct file, merges this information with a tacct record, and writes the result to standard output.
  2. To make repairs to the tacct format file jan2.rpt , first enter:
    acctmerg -v <Jan.2.rpt >jan2.tmp
    Now edit the file jan2.tmp as desired. This command redirects the content of Jan2.rpt to Jan2.tmp , with the output in ASCII format.
  3. To redirect Jan2.tmp to Jan2.rpt , with the output in binary record format, enter the following command:
    acctmerg -i <jan2.tmp >jan2.rpt

Files

/usr/sbin/acct/acctmerg Contains the acctmerg command.
/usr/include/sys/acct.h Contains the acct and tacct file formats.
/var/adm/acct/nite/daytacct Contains an intermediate daily total accounting report in binary format.
/var/adm/acct/sum/tacct Contains the cumulative total accounting report for the month in binary format.
/var/adm/acct/fiscal Contains the monthly accounting summary report, produced from the records in the /var/adm/acct/sum/tacct file.

Related Information

The acctcms command, acctcom command, acctcon1 or acctcon2 command, acctdisk command, acctprc1, acctprc2, or accton command, fwtmp command, runacct command.

The acct file format, utmp, wtmp, failedlogin file format.

The acct subroutine.

Accounting Overview, Queuing System Overview for System Management in AIX Version 4.3 System Management Guide: Operating System and Devices.

Setting Up an Accounting System in AIX Version 4.3 System Management Guide: Operating System and Devices describes the steps you must take to establish an accounting system.


[ Previous | Next | Contents | Glossary | Home | Search ]