12.07.2015 Views

download

download

download

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

System Configuration—System ManagementProcess AccountingProcess accounting is a method to control the systems's resource allocation as well astracking users' commands and system monitoring.Once you enable process accounting functionality in FreeBSD, all the informationabout the processes launched by different users will be logged into an accountingfile. The log database can be used later for statistical and administrative reasons.To enable security accounting, you need to add the following variable to the/etc/rc.conf file:accounting_enable = "yes"After the system reboots, it creates a log file called /var/account/acct (if it doesnot already exist) and updates the log file on every process executed. The processaccounting functionality will be enabled after the system reboots.If you do not want to reboot the system, you can create the log file and enable theprocess accounting manually as follows:# touch /var/account/acct# accton /var/account/acctThe accton(8) utility is used to enable or disable the process accounting. Theaccton(8) accepts only one argument and that is the log file that you want to recordthe accounting information. If no parameter is given, the process accounting willbe disabled.As soon as the system starts to record the process accounting information, you canuse the lastcomm(1) or sa(8) utilities to examine the accounting records.The lastcomm(1) displays the list of recently executed processes in the reverseorder. In addition to the process name, it also displays the name of the user whoexecuted the process, the amount of CPU time used, and when the time process hasstarted and exited.The sa(8) utility is used to manipulate the process accounting log file. Using sa(8),you can extract a summary of the executed commands, the number of times theprocess was called, CPU time taken in minutes, average number of I/O operations,and other statistics:# sa132 16.11re 0.01cp 0avio 6882k3 0.01re 0.01cp 0avio 2155k perl5.8.82 0.05re 0.00cp 0avio 8987k php[ 72 ]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!