home *** CD-ROM | disk | FTP | other *** search
/ BURKS 2 / BURKS_AUG97.ISO / BURKS / LINUX / HOWTO / mini / procacc.txt < prev    next >
Text File  |  1997-07-07  |  5KB  |  141 lines

  1.  
  2. How To Enable Process Accounting on Linux
  3.  
  4. Last updated: Mon Jul 29 23:04:02 PDT 1996
  5.  
  6. Preamble: This document is copylefted by Albert M.C. Tam (bertie@scn.org).
  7. Permission to use, copy, distribute this document for non-commerical
  8. purposes is hereby granted, provided that the author's / editor's name and
  9. this notice appear in all copies and/or supporting documents; that this
  10. document is not modified. This document is distributed in hope that it will
  11. be useful, but WITHOUT ANY WARRANTY, either expressed or implied. While
  12. every effort has been taken to ensure the accuracy of the information
  13. documented herein, the author / editor / maintainer assumes NO
  14. RESPONSIBILITY for errors, or for damages results for the use of the
  15. information documented herein.
  16.  
  17. This document describes how to enable system process accounting on a Linux
  18. host, and the usage of various process accounting commands. It is intended
  19. for users running kernel version greater than or equal to 1.3.73 (tested on
  20. kernel 2.0.7). Kernels older than 1.3.73 will need a patch in order to use
  21. the process accounting feature.
  22.  
  23. Feel free to send any feedback or comments to bertie@scn.org if you find an
  24. error, or if any information is missing. I appreciate it!
  25.  
  26. ----------------------------------------------------------------------------
  27.  
  28. What is Process Accounting?
  29.  
  30. Process accounting is the method of recording and summarizing commands
  31. executed on Linux. The modern Linux kernel is capable of keeping process
  32. accounting records for the commands being run, the user who executed the
  33. command, the CPU time, and much more.
  34.  
  35. Process accounting enables you to keep detailed accounting information for
  36. the system resources used, their allocation among users, and system
  37. monitoring.
  38.  
  39. Current Status of Process Accounting under Linux
  40.  
  41. Process accounting support has been integrated into the new kernels (version
  42. >= 1.3.73). If you are running an older kernel, you'll need to get some
  43. patch files. The patches are available from
  44.  
  45.      ftp://iguana.hut.fi/pub/linux/Kernel/process_accounting
  46.  
  47. Requirements for Process Accounting on Linux
  48.  
  49. Kernel
  50.  
  51. Linux Kernel version greater than or equal to version 1.3.73, I recommended
  52. 2.x. The kernel source is available from
  53.  
  54.      ftp://tsx-11.mit.edu/pub/linux/sources/system/
  55.  
  56. Process accounting software
  57.  
  58. Depending on the Linux distribution you have, you may, or may not have the
  59. accounting softwares installed on your system. The quota software source is
  60. available from
  61.  
  62.      ftp://alpha.gnu.ai.mit.edu/gnu/acct-6.2.tar.gz
  63.  
  64. ----------------------------------------------------------------------------
  65.  
  66. Process Accounting Setup on Linux
  67.  
  68. 1. Compile and install process accounting softwares
  69.  
  70. You may, or may not have the process accounting softwares, depending on the
  71. Linux distribution you have. The process accounting software source is
  72. available from
  73.  
  74. ftp://alpha.gnu.ai.mit.edu/gnu/acct-6.2.tar.gz
  75.  
  76. 2. Modify your system init script to turn on process accounting at boot time
  77.  
  78. Here's an example:
  79.  
  80.         # Turn process accounting on.
  81.         if [ -x /sbin/accton ]
  82.         then
  83.                 /sbin/accton /var/account/pacct
  84.                 echo "Process accounting turned on."
  85.         fi
  86.  
  87. 3. Create accounting record file "pacct"
  88.  
  89. Your process accounting softwares will print out all commands executed to
  90. the file /var/account/pacct by default. To create the accounting directory:
  91.  
  92.         mkdir /var/account
  93.  
  94. To create the accounting record file:
  95.  
  96.         touch /var/account/pacct
  97.  
  98. This record file should be owned by root, has read-write permission for
  99. root, and read permission for anybody else:
  100.  
  101.         chown root /var/account/pacct
  102.         chmod 0644 /var/account/pacct
  103.  
  104. 4. Reboot
  105.  
  106. Now reboot your system for changes you made to take effect.
  107.  
  108. ----------------------------------------------------------------------------
  109.  
  110. Miscellaneous Process Accounting Commands
  111.  
  112. ac
  113.  
  114. ac prints out statistics about users' connect time in hours, based on the
  115. logins and logouts in the current /var/log/wtmp file. ac is also capable of
  116. printing out time totals for each day (-d option), and for each user (-p
  117. option).
  118.  
  119. accton
  120.  
  121. accton is used to turn on or turn off process accounting. The file is
  122. normally executed at system bootup or shutdown via system init scripts.
  123.  
  124. last
  125.  
  126. last goes through the /var/log/wtmp file and prints out information about
  127. connection times of users.
  128.  
  129. sa
  130.  
  131. sa summarizes accounting information from previously executed commands,
  132. software I/O operation times, CPU times, as recorded in the accounting
  133. record file /var/account/pacct.
  134.  
  135. lastcomm
  136.  
  137. lastcomm prints out the information about all previously executed commands,
  138. recorded in /var/account/pacct.
  139.  
  140.  
  141.