From d16f1cb060727f8305e365dad8cc7be978cd170a Mon Sep 17 00:00:00 2001 From: s3lph Date: Sat, 6 Nov 2021 06:17:14 +0100 Subject: [PATCH] Re-add host-specific alerts --- .../prometheus/templates/etc/prometheus/alert_rules.yml.j2 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/roles/prometheus/templates/etc/prometheus/alert_rules.yml.j2 b/roles/prometheus/templates/etc/prometheus/alert_rules.yml.j2 index f2838ba..7083610 100644 --- a/roles/prometheus/templates/etc/prometheus/alert_rules.yml.j2 +++ b/roles/prometheus/templates/etc/prometheus/alert_rules.yml.j2 @@ -11,7 +11,13 @@ groups: {% if job.group | default(prometheus_default_alert_group_name) == group %} {{ job.alerts | to_nice_yaml(indent=2) | indent(2, first=true) }} +{% endif %} +{% endfor %} +{% for host in hostvars.keys() %} +{% if 'prometheus_host_specific_alerts' in hostvars[host] and host.prometheus_host_specific_alert_group | default(prometheus_default_alert_group_name) == group %} + +{{ hostvars[host].prometheus_host_specific_alerts | to_nice_yaml(indent=2) | indent(2, first=true) }} {% endif %} {% endfor %}