mod_rusage
The mod_rusage
module "monitors" system resource usage by
a session process by periodically calling the getrusage(2)
system call, and comparing the obtained values against configured thresholds.
Installation instructions are discussed here.
The most current version of mod_rusage
can be found at:
http://www.castaglia.org/proftpd/
Please contact TJ Saunders <tj at castaglia.org> with any questions, concerns, or suggestions regarding this module.
<VirtualHost>
, <Global>
The RUsageEngine
directive enables or disables the
mod_rusage
module.
<VirtualHost>
, <Global>
The RUsageInterval
directives configures the interval at
which mod_rusage
will check the process resource usage and
handle the configured
RUsageThreshold
s.
The seconds parameter must be a positive number.
<VirtualHost>
, <Global>
The RUsageLog
directive configures a file used for logging
by mod_rusage
. The configured file must be an absolute
path.
<VirtualHost>
, <Global>
The RUsageThreshold
directive configures the thresholds of the
different types of system resources to check, and the action to take when
those thresholds are reached. Note that at least one
RUsageThreshold
needs to be configured for mod_rusage
to perform any resource usage checks. Multiple RUsageThreshold
directives can be configured, so that different resources have different
limits.
The action parameter specifies the type of action to take when the threshold is reached. The supported actions are:
log[:level]
Logs that the threshold has been reached via syslog logging. The default log level is WARN; the optional level value can be used to change this log level.
The log message will include the following information about the session process which reached the threshold:
terminate
Terminates the session process, after logging at the WARN level via syslog logging.
The currently supported threshold-types are:
UserTime
Total amount of time spent in "user mode". The threshold value is the number of seconds.
SystemTime
Total amount of time spent in the kernel on behalf of the process. The threshold value is the number of seconds.
Example mod_rusage
configuration:
<IfModule mod_rusage.c> RUsageEngine on RUsageLog /path/to/rusage.log RUsageInterval 10 # If the session uses more than 15 seconds of "user time", log it # at the CRIT syslog level RUsageThreshold log:crit UserTime 15 </IfModule>
mod_rusage
, go to the third-party module area in
the proftpd source code and unpack the mod_rusage
source tarball:
cd proftpd-dir/contrib/ tar zxvf /path/to/mod_rusage-version.tar.gzafter unpacking the latest proftpd-1.3.x source code. For including
mod_rusage
as a staticly linked module:
./configure --with-modules=mod_rusage ...Alternatively,
mod_rusage
can be built as a DSO module:
./configure --enable-dso --with-shared=mod_rusage ...Then follow the usual steps:
make make install