{{ lang._("%sMap Files:%s A map allows to map a data in input to an other one on output. For example, this makes it possible to map a large number of domains to backend pools without using the GUI. Map files need to be used in %sRules%s, otherwise they are ignored.") | format('', '', '', '') }}
{{ lang._("%sCPU Affinity Rules:%s This feature makes it possible to bind HAProxy's processes/threads to a specific CPU (or a CPU set). Furthermore it is possible to select CPU Affinity Rules in %sPublic Services%s to restrict them to a certain set of processes/threads/CPUs.") | format('', '', '', '') }}
{{ lang._("%sResolvers:%s This feature allows in-depth configuration of how HAProxy handles name resolution and interacts with name resolvers (DNS). Each resolver configuration can be used in %sBackend Pools%s to apply individual name resolution configurations.") | format('', '', '', '') }}
+
{{ lang._("%sE-Mail Alerts:%s It is possible to send email alerts when the state of servers changes. Each configuration can be used in %sBackend Pools%s to send e-mail alerts to the configured recipient.") | format('', '', '', '') }}
{{ lang._("For more details visit HAProxy's official documentation regarding the %sError Messages%s, %sLua Script%s and the %sMap Files%s features. More information on HAProxy's CPU Affinity is also available %shere%s, %shere%s and %shere%s. A detailed explanation of the resolvers feature can be found %shere%s.") | format('', '', '', '', '', '' ,'', '' ,'', '' ,'', '','', '') }}
@@ -1149,6 +1164,40 @@ POSSIBILITY OF SUCH DAMAGE.
+
+
+
+
+
{{ lang._('Mailer ID') }}
+
{{ lang._('Enabled') }}
+
{{ lang._('Name') }}
+
{{ lang._('Sender') }}
+
{{ lang._('Recipient') }}
+
{{ lang._('Commands') }}
+
{{ lang._('ID') }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1242,3 +1291,4 @@ POSSIBILITY OF SUCH DAMAGE.
{{ partial("layout_partials/base_dialog",['fields':formDialogMapfile,'id':'DialogMapfile','label':lang._('Edit Map File')])}}
{{ partial("layout_partials/base_dialog",['fields':formDialogCpu,'id':'DialogCpu','label':lang._('Edit CPU Affinity Rule')])}}
{{ partial("layout_partials/base_dialog",['fields':formDialogResolver,'id':'DialogResolver','label':lang._('Edit Resolver')])}}
+{{ partial("layout_partials/base_dialog",['fields':formDialogMailer,'id':'DialogMailer','label':lang._('Edit E-Mail Alert')])}}
diff --git a/net/haproxy/src/opnsense/service/templates/OPNsense/HAProxy/haproxy.conf b/net/haproxy/src/opnsense/service/templates/OPNsense/HAProxy/haproxy.conf
index 8f3ce54f1..64f07b7cb 100644
--- a/net/haproxy/src/opnsense/service/templates/OPNsense/HAProxy/haproxy.conf
+++ b/net/haproxy/src/opnsense/service/templates/OPNsense/HAProxy/haproxy.conf
@@ -1049,6 +1049,29 @@ resolvers {{resolver.id}}
{% endfor %}
{%- endif -%}
+{# ############################### #}
+{# MAILERS #}
+{# ############################### #}
+
+{% if helpers.exists('OPNsense.HAProxy.mailers') %}
+{% for mailer in helpers.toList('OPNsense.HAProxy.mailers.mailer') %}
+{% if mailer.enabled == '1' %}
+# Mailer: {{mailer.name}}
+mailers {{mailer.id}}
+ timeout mail {{mailer.timeout}}s
+{% if mailer.mailservers|default("") != "" %}
+{% for mailserver in mailer.mailservers.split(",") %}
+ mailer {{mailserver}} {{mailserver}}
+{% endfor %}
+{% endif %}
+
+{% else %}
+# Mailer (DISABLED): {{mailer.name}}
+
+{% endif %}
+{% endfor %}
+{%- endif -%}
+
{# ############################### #}
{# FRONTENDS #}
{# ############################### #}
@@ -1353,6 +1376,23 @@ backend {{backend.name}}
# health checking is DISABLED
{% set healthcheck_enabled = '0' %}
{% endif %}
+{# # mailer #}
+{% if backend.linkedMailer|default("") != "" %}
+{% set mailer_data = helpers.getUUID(backend.linkedMailer) %}
+{% if mailer_data == {} %}
+# ERROR: mailer data not found ({{backend.linkedMailer}})
+{% elif mailer_data.enabled == '0' %}
+# NOTE: specified mailer is disabled ({{mailer_data.name}})
+{% else %}
+ email-alert mailers {{mailer_data.id}}
+ email-alert from {{mailer_data.sender}}
+ email-alert to {{mailer_data.recipient}}
+ email-alert level {{mailer_data.loglevel}}
+{% if mailer_data.hostname|default("") != "" %}
+ email-alert myhostname {{mailer_data.hostname}}
+{% endif %}
+{% endif %}
+{% endif %}
{# # NOTE: Usually the frontend and the backend are in the same mode, #}
{# # but we have no way to know what frontend uses this backend. #}
{# # Hence we can't automatically set the mode and thus need a #}