22 November 2007

Linux: Process Accounting (PA) tool


* To find out exactly what programs you use and for how long.
* Linux kernel has a built-in process accounting(PA) facility.
* It allows system administrators to collect detailed information in a log file each time a program is executed on a Linux
system.

Uses of PA

* To calculate the CPU time absorbed by users.
* Data collected from the PA facilities to monitor which programs are most accessed by users, and then optimize the system configuration for these types of programs.
Ex: Part of the data collected by the PA facilities includes the number of bytes that are input and output by the program and the CPU usage. A system that runs a high percentage of I/O-intensive applications may need to be optimized in ways that a system running a high percentage of CPU-bound applications not.

To query the login status,the last command parses the binary log file /var/log/wtmp.

A special user is created for this log file named reboot.So running last reboot prints the history of system reboot recorded to /var/log/wtmp

SETUP AND MAINTAINING PA

rpm file: psacct-6.3.2-41.1.i386.rpm

1.To turn process accounting on

$accton /var/account/pacct

Without arguments to psacct will turn PA off
2. ac reads /var/log/wtmp and prints users' connect times.

$ac -p : displays individual totals for each user
$ac -d : displays totals for each day
$ac --complain : lists ttys that do not have records

3.lastcomm examines /var/account/pacct for information on all previously entered commands.Information about the command's I/O operation times and CPU times

3.sa summarizes information in /var/account/pacct.The information is normally displayed to standard output,but with the -s option,summary information is written to:

* /var/account/savacct summarizes accounting information on previously executed commands
* /var/account/usracct summarizes accounting information by user

No comments: