mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-01-19 12:10:46 +00:00
haproxy public development tree
a92694800c
Legacy mailers implemented using tcpchecks may now be replaced using a pure lua implementation. Simply loading the file "mailers.lua" using lua-load directive is enough to disable the legacy mailer implementation and make the lua script subscribe to server events in order to generate messages and send email alerts to configured mailservers according to the mailers configuration specified by the user in the config file. lua-load-per-thread directive is supported, the script will automatically force itself on a single thread to prevent multiple mails from being sent for the same event. The email sending from lua in itself is handled with smtp_send_email() function from Thierry FOURNIER. (see: https://www.arpalert.org/how-to-send-email.html) The function was slightly adapted to send HELO instead of EHLO when beginning the SMTP handshake to make it more compatible with basic SMTP stacks and to comply with the legacy SMTP handshake performed in mailers.c. Authentication is not yet handled by smtp_send_email(), but it may be further improved to do so. Note that existing lua libraries may also support sending emails (even with authentication support maybe?), I did not do much researchs about this, so I'm not aware of existing solutions at the time of writing this script. The only restriction is that when using an external library, the library function calls must not be blocking, since haproxy relies on lua executions to be yieldable and rescheduled. As long as the script complies with this limitation, it may be customized or improved in many ways, including templating, making calls to APIs services.. (ie: triggering automation flows, sending SMS alerts... you name it) The purpose of this script is to provide a basic working replacement for legacy mailers implementation based on tcpchecks, which is planned for removal in the future. tcpcheck based mailers is kind of a hack which is not suitable as a long term solution. (hard to maintain and not customizable) Note: Email content for email alerts sent using this script might slightly differ from the legacy implementation (some optional info might be missing such as server's check dynamic description, or included statistics such as currently active servers may appear out of sync) due the email generation now being performed asynchronously. However the output format complies with the original one and essential informations are consistently reported. Current known script limitation: if multiple events are generated simultaneously it is possible that emails could be received out of order since emails are sent asynchronously using smtp_send_email() and there is no sending queue. Relying on the email "date" should help to know which email was generated first.. |
||
---|---|---|
.github | ||
addons | ||
admin | ||
dev | ||
doc | ||
examples | ||
include | ||
reg-tests | ||
scripts | ||
src | ||
tests | ||
.cirrus.yml | ||
.gitattributes | ||
.gitignore | ||
.mailmap | ||
.travis.yml | ||
BRANCHES | ||
CHANGELOG | ||
CONTRIBUTING | ||
INSTALL | ||
LICENSE | ||
MAINTAINERS | ||
Makefile | ||
README | ||
SUBVERS | ||
VERDATE | ||
VERSION |
The HAProxy documentation has been split into a number of different files for ease of use. Please refer to the following files depending on what you're looking for : - INSTALL for instructions on how to build and install HAProxy - BRANCHES to understand the project's life cycle and what version to use - LICENSE for the project's license - CONTRIBUTING for the process to follow to submit contributions The more detailed documentation is located into the doc/ directory : - doc/intro.txt for a quick introduction on HAProxy - doc/configuration.txt for the configuration's reference manual - doc/lua.txt for the Lua's reference manual - doc/SPOE.txt for how to use the SPOE engine - doc/network-namespaces.txt for how to use network namespaces under Linux - doc/management.txt for the management guide - doc/regression-testing.txt for how to use the regression testing suite - doc/peers.txt for the peers protocol reference - doc/coding-style.txt for how to adopt HAProxy's coding style - doc/internals for developer-specific documentation (not all up to date)