Hi Willy, Hi All, the purpose of this email is to solicit feedback on an implementation of email alerts for haproxy the design of which is based on a discussion in this forum some months ago.
This patchset allows configuration of mailers. These are like the existing haproxy concept of peers. But for sending email alerts. It also allows proxies to configure sending email alerts to mailers. An example haproxy.cf snippet is as follows: listen VIP_Name ... server RIP_Name ... email-alert mailers some_mailers email-alert from te...@horms.org email-alert to te...@horms.org mailers some_mailers mailer us 127.0.0.1:25 mailer them 192.168.0.1:587 And an example email alert is as follows: ---- start ---- Date: Wed, 28 Jan 2015 17:23:21 +0900 (JST) From: te...@horms.org To: te...@horms.org Subject: [HAproxy Alert] Server VIP_Name/RIP_Name is DOWN. Server VIP_Name/RIP_Name is DOWN. ---- end ---- Internally the code makes use of a dummy check using the tcpcheck code to set up a simple sequence of expect/send rules. This, along with the notion of mailers, is my interpretation of the earlier discussion in this forum. The current code has only been lightly tested and has a number of limitations including: * No options to control sending email alerts based on the event that has occurred. That is, its probably way to noisy for most people's tastes. * No options to configure the format of the email alerts * No options to configure delays associated with the checks used to send alerts. * No Documentation * No support for STLS. This one will be a little tricky. Again the purpose is to solicit feedback on the code so far, in particular the design, before delving into further implementation details. For reference this patchset is available in git https://github.com/horms/haproxy devel/email-alert This patchset is based on the current mainline master branch: the 1.6 development branch. The current head commit there is 32602d2 ("BUG/MINOR: checks: prevent http keep-alive with http-check expect"). Simon Horman (8): MEDIUM: Remove connect_chk MEDIUM: Refactor init_check and move to checks.c MEDIUM: Add free_check() helper MEDIUM: Move proto and addr fields struct check MEDIUM: Attach tcpcheck_rules to check MEDIUM: Add parsing of mailers section MEDIUM: Allow configuration of email alerts MEDIUM: Support sending email alerts Makefile | 2 +- include/proto/checks.h | 5 + include/types/checks.h | 3 + include/types/mailers.h | 65 ++++++++ include/types/proxy.h | 24 +++ include/types/server.h | 5 - src/cfgparse.c | 290 ++++++++++++++++++++++++++++++++ src/checks.c | 427 ++++++++++++++++++++++++++++++++++++++++++------ src/mailers.c | 17 ++ src/server.c | 60 ++----- 10 files changed, 803 insertions(+), 95 deletions(-) create mode 100644 include/types/mailers.h create mode 100644 src/mailers.c -- 2.1.4