mirror of https://github.com/tLDP/LDP
new; converetd to SGML from HTML
This commit is contained in:
parent
e67defae5c
commit
d31c9082c9
|
@ -0,0 +1,182 @@
|
|||
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook V4.1//EN">
|
||||
<article ID="ProcessAccounting">
|
||||
<articleinfo>
|
||||
<title>Enabling Process Accounting on Linux HOWTO</title>
|
||||
<author>
|
||||
<firstname>Albert M.C.</firstname>
|
||||
<surname>Tam</surname>
|
||||
<affiliation>
|
||||
<address><email>bertie@scn.org</email></address>
|
||||
</affiliation>
|
||||
</author>
|
||||
<abstract>
|
||||
<para>Describes the basics of enabling process accounting on
|
||||
Linux.</para>
|
||||
</abstract>
|
||||
<pubdate>2001-02-09</pubdate>
|
||||
<revhistory>
|
||||
<revision>
|
||||
<revnumber>1.1</revnumber>
|
||||
<date>2001-02-09</date>
|
||||
<authorinitials>KET</authorinitials>
|
||||
</revision>
|
||||
<revision>
|
||||
<revnumber>1.0</revnumber>
|
||||
<date>1997-08-08</date>
|
||||
<authorinitials>AMCT</authorinitials>
|
||||
</revision>
|
||||
</revhistory>
|
||||
<othercredit ROLE="converter">
|
||||
<firstname>Kristin</firstname>
|
||||
<surname>Thomas</surname>
|
||||
<contrib>Converted document from HTML to DocBook v4.1 (SGML)</contrib>
|
||||
</othercredit>
|
||||
</articleinfo>
|
||||
<sect1 ID="Preamble">
|
||||
<title>Preamble</title>
|
||||
<para>This document is copylefted by Albert M.C. Tam
|
||||
(<ulink URL="mailto:bertie@scn.org">bertie@scn.org</ulink>). Permission to use, copy, distribute this
|
||||
document for non-commerical purposes is hereby granted, provided that the
|
||||
author's/editor's name and this notice appear in all copies and/or supporting
|
||||
documents and provided that this document is not modified. This document is distributed in
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY, either expressed or
|
||||
implied. While every effort has been taken to ensure the accuracy of the
|
||||
information documented herein, the author/editor/maintainer assumes NO
|
||||
RESPONSIBILITY for errors, or for damages resulting for the use of the
|
||||
information documented herein. </para>
|
||||
</sect1>
|
||||
<sect1 ID="Introduction">
|
||||
<title>Introduction</title>
|
||||
<para>This document describes how to enable system process accounting on
|
||||
a Linux host and the usage of various process accounting commands. It is
|
||||
intended for users running kernel versions greater than or equal to 1.3.73
|
||||
(tested on RedHat&trade 4.1 kernel 2.0.27). Kernels older than 1.3.73 may
|
||||
need a patch in order to use the process accounting feature. </para>
|
||||
<para>Feel free to send any feedback or comments to <ulink URL="bertie@scn.org">bertie@scn.org</ulink>
|
||||
if you find an error, or if any information is missing. I appreciate it. </para>
|
||||
</sect1>
|
||||
<sect1 ID="PA">
|
||||
<title>What is process accounting?</title>
|
||||
<para>Process accounting is the method of recording and summarizing
|
||||
commands executed on Linux. The modern Linux kernel is capable of keeping
|
||||
process accounting records for the commands being run, the user who executed
|
||||
the command, the CPU time, and much more. </para>
|
||||
<para>Process accounting enables you to keep detailed accounting
|
||||
information for the system resources used, their allocation among users, and
|
||||
system monitoring. </para>
|
||||
</sect1>
|
||||
<sect1 ID="CurrentStatus">
|
||||
<title>Current Status of Process Accounting under Linux</title>
|
||||
<para>Process accounting support has been integrated into the newer
|
||||
kernels (version >= 1.3.73). If you are running an older kernel, you may
|
||||
need some patch files. The patches are available from
|
||||
<ulink
|
||||
URL="ftp://iguana.hut.fi/pub/linux/Kernel/process_accounting">ftp://iguana.hut.fi/pub/linux/Kernel/process_accounting</ulink>
|
||||
</para>
|
||||
</sect1>
|
||||
<sect1 ID="Requirements">
|
||||
<title>Requirements for Process Accounting on Linux</title>
|
||||
<sect2 ID="Kernel">
|
||||
<title>Kernel</title>
|
||||
<para>A Linux kernel version greater than or equal to version 1.3.73 is required, and I
|
||||
recommended 2.x. The kernel source is available from
|
||||
<ulink
|
||||
URL="http://sunsite.unc.edu/pub/Linux/kernel/v2.0">http://sunsite.unc.edu/pub/Linux/kernel/v2.0</ulink>
|
||||
</para>
|
||||
</sect2>
|
||||
<sect2 ID="PAsoftware">
|
||||
<title>Process Accounting Software</title>
|
||||
<para>Depending on the Linux distribution you have, you may
|
||||
not have the process accounting software package installed on your system. If
|
||||
you don't have it, try downloading the package from
|
||||
<ulink
|
||||
URL="http://sunsite.unc.edu/pub/Linux/system/admin/quota-acct-modified.tgz">http://sunsite.unc.edu/pub/Linux/system/admin/quota-acct-modified.tgz</ulink>
|
||||
</para>
|
||||
</sect2>
|
||||
</sect1>
|
||||
<sect1 ID="PASetup">
|
||||
<title>Process Accounting Setup on Linux</title>
|
||||
<orderedlist>
|
||||
<listitem>
|
||||
<para>Compile and install process accounting software.</para>
|
||||
<para>The process accounting software package is available from
|
||||
<ulink
|
||||
URL="http://sunsite.unc.edu/pub/Linux/system/admin/quota-acct-modified.tgz">http://sunsite.unc.edu/pub/Linux/system/admin/quota-acct-modified.tgz</ulink>
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Modify your system init script and turn on process accounting
|
||||
at boot time.</para>
|
||||
<para>Here's an example:</para>
|
||||
<screen># Turn process accounting on.
|
||||
if [ -x /sbin/accton ]
|
||||
then
|
||||
/sbin/accton /var/log/pacct
|
||||
echo "Process accounting turned on."
|
||||
fi
|
||||
</screen>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Create accounting record file <filename>"pacct."</filename> </para>
|
||||
<para>Your process accounting software will print out all commands
|
||||
executed to the file <filename>/var/log/pacct</filename> by default. </para>
|
||||
<para>To create the accounting record file:
|
||||
<screen>touch /var/log/pacct</screen> </para>
|
||||
<para>This record file should be owned by root, and it has read-write
|
||||
permission for root and read permission for anybody else: </para>
|
||||
<screen>chown root /var/log/pacct
|
||||
chmod 0644 /var/log/pacct</screen>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>Reboot.</para>
|
||||
<para>Now reboot your system for changes you made to take effect.
|
||||
</para>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
</sect1>
|
||||
<sect1 ID="MiscCommands">
|
||||
<title>Miscellaneous Process Accounting Commands</title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><command>ac</command></term>
|
||||
<listitem>
|
||||
<para><command>ac</command> prints out statistics about users' connection times in
|
||||
hours based on the logins and logouts in the current <filename> /var/log/wtmp</filename> file. <command>ac</command> is
|
||||
also capable of printing out time totals for each day (-d option), and for each
|
||||
user (-p option). </para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><command>accton</command></term>
|
||||
<listitem>
|
||||
<para><command>accton</command> is used to turn on or turn off process accounting.
|
||||
The file is normally executed at system bootup or shutdown via system init
|
||||
scripts. </para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><command>last</command></term>
|
||||
<listitem>
|
||||
<para><command>last</command> goes through the <filename>/var/log/wtmp</filename> file and prints out
|
||||
information about users' connection times. </para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><command>sa</command></term>
|
||||
<listitem>
|
||||
<para><command>sa</command> summarizes accounting information from previously
|
||||
executed commands, software I/O operation times, and CPU times, as recorded in the
|
||||
accounting record file <filename> /var/account/pacct</filename>. </para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><command>lastcomm</command></term>
|
||||
<listitem>
|
||||
<para><command>lastcomm</command> prints out the information about all previously
|
||||
executed commands, recorded in <filename>/var/account/pacct</filename>. </para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</sect1>
|
||||
</article>
|
||||
|
Loading…
Reference in New Issue