formula-prometheus/prometheus/files/alertmanager.yml
Bartosz Kupidura 953510a4d8 Render alertmanager config without yaml filter
Change-Id: Ie86bb95ab7bf37291347ca4533fe20bbd95484e1
2017-05-12 13:52:48 +02:00

48 lines
1.4 KiB
YAML

{% from "prometheus/map.jinja" import alertmanager with context %}
global:
{%- if alertmanager.config.global is defined %}
{%- if alertmanager.config.global.resolve_timeout is defined %}
resolve_timeout: {{ alertmanager.config.global.resolve_timeout }}
{%- endif %}
{%- endif %}
route:
{%- if alertmanager.config.route is defined %}
{{ alertmanager.config.route | yaml(False) | indent(2, true) }}
{%- endif %}
inhibit_rules:
{%- for name, rule in alertmanager.config.get('inhibit_rule', {}).iteritems() %}
{%- if rule.get('enabled', True) %}
# {{ name }}
- source_match:
{%- for key, value in rule.source_match.iteritems() %}
{{ key }}: {{ value }}
{%- endfor %}
target_match:
{%- for key, value in rule.target_match.iteritems() %}
{{ key }}: {{ value }}
{%- endfor %}
equal:
{%- for key in rule.equal %}
- {{ key }}
{%- endfor %}
{%- endif %}
{%- endfor %}
receivers:
{%- for name, config in alertmanager.config.get('receiver', {}).iteritems() %}
{%- if config.get('enabled', True) %}
- name: '{{ name }}'
{%- if config.webhook_configs is defined %}
webhook_configs:
{%- for name, webhook in config.webhook_configs.iteritems() %}
# {{ name }}
- url: {{ webhook.url }}
{%- if webhook.send_resolved is defined %}
send_resolved: {{ webhook.send_resolved | lower }}
{%- endif %}
{%- endfor %}
{%- endif %}
{%- endif %}
{%- endfor %}