From 91ed93a6fb112928bdce45c5bfb608c6ff26a611 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Fri, 11 Mar 2022 21:29:32 +0100 Subject: alerta: less hardcoded stuff in configs --- roles/monitoring/alerta/templates/alertad.conf.j2.j2 | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'roles/monitoring/alerta/templates/alertad.conf.j2.j2') diff --git a/roles/monitoring/alerta/templates/alertad.conf.j2.j2 b/roles/monitoring/alerta/templates/alertad.conf.j2.j2 index 54089a76..b013f480 100644 --- a/roles/monitoring/alerta/templates/alertad.conf.j2.j2 +++ b/roles/monitoring/alerta/templates/alertad.conf.j2.j2 @@ -1,18 +1,17 @@ DEBUG = {{ '{{' }} 'True' if env.DEBUG else 'False' {{ '}}' }} SECRET = "{{ '{{' }} env.SECRET_KEY {{ '}}' }}" -ALERT_TIMEOUT = 86400 -HEARTBEAT_TIMEOUT = 7200 +ALERT_TIMEOUT = {{ alerta_alert_timeout }} +HEARTBEAT_TIMEOUT = {{ alerta_heartbeat_timeout }} +DEFAULT_ENVIRONMENT = '{{ alerta_default_environment }}' +ALLOWED_ENVIRONMENTS = ['{{ alerta_environments | join("', '") }}'] PLUGINS = ['{{ alerta_plugins | join("', '") }}'] -DEFAULT_ENVIRONMENT = 'unknown' -ALLOWED_ENVIRONMENTS = ['unknown', 'chaos-at-.*'] {% if 'heartbeat' in alerta_plugins %} -HEARTBEAT_EVENTS = ['PrometheusAlertmanagerE2eDeadManSwitch'] +HEARTBEAT_EVENTS = ['{{ alerta_plugin_heartbeat.events | join("', '") }}'] {% endif %} {% if 'prometheus' in alerta_plugins %} -ALERTMANAGER_USERNAME = 'alerta' -ALERTMANAGER_PASSWORD = 'alerta' -ALERTMANAGER_SILENCE_FROM_ACK = True -ALERTMANAGER_USE_EXTERNALURL_FOR_SILENCES = True +{% for opt, value in alerta_plugin_prometheus.items() %} +ALERTMANAGER_{{ opt | upper }} = {{ value }} +{% endfor %} {% endif %} {% if 'amqp' in alerta_plugins %} AMQP_URL = 'redis://localhost:6379/' -- cgit v1.2.3