Qpsmtpd:loadcheck

From SME Server
Jump to navigationJump to search

Qpsmtpd#Plugins

NAME

loadcheck

DESCRIPTION

Only takes email transactions if the system load is at or below a specified level.

If this is running on a system that provides /kern/loadavg or /proc/loadavg it will be used instead of the 'uptime' command.

Once a load value is determined, it is cached for a period of time. See the cache_time below.

Since fork/exec is expensive in perl, if using the 'uptime' method, use cache_time to avoid increasing your load on every connection.

CONFIG

max_load

  This is the 1 minute system load where we won't take transactions
if our load is higher than this value.  (Default: 7)

cache_time

  A recently determined load value will be cached and used for the
assigned number of seconds.  (Default: 10)

uptime

  The path to the command 'uptime' if different than the default.
(Default: /usr/bin/uptime)

Example:

loadcheck cache_time 30

loadcheck max_load 7 uptime /usr/bin/uptime

SEE ALSO

Original version: http://www.nntp.perl.org/group/perl.qpsmtpd/2006/01/msg4422.html

Variant with caching: http://www.nntp.perl.org/group/perl.qpsmtpd/2006/03/msg4710.html

Steve Kemp's announcement of an alternate load limiter: http://www.nntp.perl.org/group/perl.qpsmtpd/2008/03/msg7814.html

AUTHOR

Written by Peter Eisch <peter@boku.net>.

CHANGES

v0.03 - msimerson - 2014-03-21

    * refactored "find the way to get load avg" out of loadcheck (every
      connection) into get_load_method which is run in register. If we can't
      get the load average, don't register the hook.

    * added BSD::getloadavg method (tested on FreeBSD)

v0.02 - github@rsiddall - resurrected from list archives