MEDIUM: mailers: warn about deprecated legacy mailers
As mentioned in 2.8 announce on the mailing list [1] and on the wiki [2], use of legacy mailers is now deprecated and will not be supported anymore starting with version 3.3. Use of Lua script (AKA Lua mailers) is now encouraged (and fully supported since 2.8) for this purpose, as it offers more flexibility (e.g: alerts can be customized) and is more future-proof. Configurations relying on legacy mailers will now raise a warning. Users willing to keep their existing mailers config in a working state should simply add the following line to their global section: # mailers.lua file as provided in the git repository # adjust path as needed lua-load examples/lua/mailers.lua [1]: https://www.mail-archive.com/haproxy@formilux.org/msg43600.html [2]: https://github.com/haproxy/wiki/wiki/Breaking-changes
This commit is contained in:
parent
cdaa749ba0
commit
d622f9d5b6
@ -4600,7 +4600,8 @@ table <tablename> type {ip | integer | string [len <length>] | binary [len <leng
|
||||
------------
|
||||
It is possible to send email alerts when the state of servers changes.
|
||||
If configured email alerts are sent to each mailer that is configured
|
||||
in a mailers section. Email is sent to mailers using SMTP.
|
||||
in a mailers section. Email is sent to mailers through Lua (see
|
||||
examples/lua/mailers.lua).
|
||||
|
||||
mailers <mailersect>
|
||||
Creates a new mailer list with the name <mailersect>. It is an
|
||||
@ -4610,6 +4611,11 @@ mailer <mailername> <ip>:<port>
|
||||
Defines a mailer inside a mailers section.
|
||||
|
||||
Example:
|
||||
global
|
||||
# mailers.lua file as provided in the git repository
|
||||
# adjust path as needed
|
||||
lua-load examples/lua/mailers.lua
|
||||
|
||||
mailers mymailers
|
||||
mailer smtp1 192.168.0.1:587
|
||||
mailer smtp2 192.168.0.2:587
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include <haproxy/list.h>
|
||||
#include <haproxy/mailers.h>
|
||||
#include <haproxy/pool.h>
|
||||
#include <haproxy/proxy-t.h>
|
||||
#include <haproxy/proxy.h>
|
||||
#include <haproxy/server-t.h>
|
||||
#include <haproxy/task.h>
|
||||
#include <haproxy/tcpcheck.h>
|
||||
@ -113,6 +113,10 @@ int init_email_alert(struct mailers *mls, struct proxy *p, char **err)
|
||||
const char *err_str;
|
||||
int i = 0;
|
||||
|
||||
if (!send_email_disabled)
|
||||
ha_warning("Legacy mailers used by %s '%s' will not be supported anymore in version 3.3. You should use Lua to send email-alerts, see 'examples/lua/mailers.lua' file.\n",
|
||||
proxy_type_str(p), p->id);
|
||||
|
||||
if ((queues = calloc(mls->count, sizeof(*queues))) == NULL) {
|
||||
memprintf(err, "out of memory while allocating mailer alerts queues");
|
||||
goto fail_no_queue;
|
||||
|
Loading…
x
Reference in New Issue
Block a user