home *** CD-ROM | disk | FTP | other *** search
/ Freelog Special Edition 1: Linux / CD1.iso / doc / HOWTO / mini / Process-Accounting < prev    next >
Text File  |  1998-10-14  |  5KB  |  179 lines

  1.  
  2.                    HOW TO ENABLE PROCESS ACCOUNTING ON LINUX
  3.                                        
  4.    
  5.    
  6.    _Last updated: Fri Aug 8 09:25:58 HKT 1997_
  7.    
  8.    
  9.         Preamble: This document is copylefted by Albert M.C. Tam
  10.         (bertie@scn.org). Permission to use, copy, distribute this document for
  11.         non-commerical purposes is hereby granted, provided that the author's /
  12.         editor's name and this notice appear in all copies and/or supporting
  13.         documents; that this document is not modified. This document is
  14.         distributed in hope that it will be useful, but WITHOUT ANY WARRANTY,
  15.         either expressed or implied. While every effort has been taken to
  16.         ensure the accuracy of the information documented herein, the author /
  17.         editor / maintainer assumes NO RESPONSIBILITY for errors, or for
  18.         damages results for the use of the information documented herein.
  19.         
  20.    
  21.    
  22.    
  23.    This document describes how to enable system process accounting on a
  24.    Linux host, and the usage of various process accounting commands. It
  25.    is intended for users running kernel version greater than or equal to
  26.    1.3.73 (recently tested on RedHat 4.1 kernel 2.0.27). Kernels older
  27.    than 1.3.73 may need a patch in order to use the process accounting
  28.    feature.
  29.    
  30.    Feel free to send any feedback or comments to bertie@scn.org if you
  31.    find an error, or if any information is missing. I appreciate it.
  32.    
  33.    
  34.      _________________________________________________________________
  35.    
  36.    
  37.    
  38. What is Process Accounting?
  39.  
  40.    
  41.    
  42.    Process accounting is the method of recording and summarizing commands
  43.    executed on Linux. The modern Linux kernel is capable of keeping
  44.    process accounting records for the commands being run, the user who
  45.    executed the command, the CPU time, and much more.
  46.    
  47.    Process accounting enables you to keep detailed accounting information
  48.    for the system resources used, their allocation among users, and
  49.    system monitoring.
  50.    
  51. Current Status of Process Accounting under Linux
  52.  
  53.    
  54.    
  55.    Process accounting support has been integrated into the newer kernels
  56.    (version >= 1.3.73). If you are running an older kernel, you may need
  57.    some patch files. The patches are available from
  58.    
  59.    ftp://iguana.hut.fi/pub/linux/Kernel/process_accounting 
  60.        
  61.    
  62.    
  63. Requirements for Process Accounting on Linux
  64.  
  65.    
  66.    
  67.    _Kernel_
  68.    
  69.    Linux Kernel version greater than or equal to version 1.3.73, I
  70.    recommended 2.x. The kernel source is available from
  71.    
  72.    http://sunsite.unc.edu/pub/Linux/kernel/v2.0 
  73.        
  74.    
  75.    
  76.    _Process accounting software_
  77.    
  78.    Depending on the Linux distribution you have, you may, or may not have
  79.    the process accounting software package installed on your system. If
  80.    you don't have it, try downloading the package from
  81.    
  82.    http://sunsite.unc.edu/pub/Linux/system/admin/quota-acct-modified.tgz 
  83.        
  84.    
  85.    
  86.    
  87.      _________________________________________________________________
  88.    
  89.    
  90.    
  91. Process Accounting Setup on Linux
  92.  
  93.    
  94.    
  95.    _1. Compile and install process accounting softwares_
  96.    
  97.    The process accounting software package is available from
  98.    
  99.    http://sunsite.unc.edu/pub/Linux/system/admin/quota-acct-modified.tgz 
  100.        
  101.    
  102.    
  103.    _2. Modify your system init script and turn on process accounting at
  104.    boot time _
  105.    
  106.    Here's an example:
  107.    
  108.  
  109.         # Turn process accounting on.
  110.         if [ -x /sbin/accton ]
  111.         then
  112.                 /sbin/accton /var/log/pacct
  113.                 echo "Process accounting turned on."
  114.         fi
  115.  
  116.    
  117.    
  118.    _3. Create accounting record file "pacct"_
  119.    
  120.    Your process accounting softwares will print out all commands executed
  121.    to the file /var/log/pacct by default.
  122.    
  123.    To create the accounting record file:
  124.    
  125.  
  126.         touch /var/log/pacct
  127.  
  128.    
  129.    
  130.    This record file should be owned by root, has read-write permission
  131.    for root, and read permission for anybody else:
  132.  
  133.         chown root /var/log/pacct
  134.         chmod 0644 /var/log/pacct
  135.  
  136.    
  137.    
  138.    _4. Reboot_
  139.    
  140.    Now reboot your system for changes you made to take effect.
  141.    
  142.    
  143.      _________________________________________________________________
  144.    
  145.    
  146.    
  147. Miscellaneous Process Accounting Commands
  148.  
  149.    
  150.    
  151.    _ac_
  152.    
  153.    ac prints out statistics about users' connection time in hours, based
  154.    on the logins and logouts in the current /var/log/wtmp file. ac is
  155.    also capable of printing out time totals for each day (-d option), and
  156.    for each user (-p option).
  157.    
  158.    _accton_
  159.    
  160.    accton is used to turn on or turn off process accounting. The file is
  161.    normally executed at system bootup or shutdown via system init
  162.    scripts.
  163.    
  164.    _last_
  165.    
  166.    last goes through the /var/log/wtmp file and prints out information
  167.    about connection times of users.
  168.    
  169.    _sa_
  170.    
  171.    sa summarizes accounting information from previously executed
  172.    commands, software I/O operation times, CPU times, as recorded in the
  173.    accounting record file /var/account/pacct.
  174.    
  175.    _lastcomm_
  176.    
  177.    lastcomm prints out the information about all previously executed
  178.    commands, recorded in /var/account/pacct.
  179.