formula-prometheus/prometheus/files/alerts.yml
Bartosz Kupidura 597b0678bf Better grain handling for telegraf
Replace '-' to '_' in prometheus config dir
Add possibility to add recording rules

Change-Id: Ifc85a95ae62cb0f1b810a3b4f718e8d92f9c6209
2017-03-29 13:54:26 +02:00

29 lines
880 B
YAML

{%- from "prometheus/map.jinja" import server with context %}
{%- if server.recording is defined %}
{%- for recording_rule in server.recording %}
{{ recording_rule.name }} = {{ recording_rule.query }}
{%- endfor %}
{%- endif %}
{%- if server.alert is defined %}
{%- for alertname, alert in server.alert.iteritems() %}
ALERT {{ alertname }}
IF {{ alert.if }}
{%- if alert.for is defined %}FOR {{ alert.for }}{%- endif %}
{%- if alert.labels is defined %}
LABELS {
{%- for name, value in alert.labels.iteritems() %}
{{ name }} = "{{ value }}"{%- if not loop.last %},{%- endif %}
{%- endfor %}
}
{%- endif %}
{%- if alert.annotations is defined %}
ANNOTATIONS {
{%- for name, value in alert.annotations.iteritems() %}
{{ name }} = "{{ value }}"{%- if not loop.last %},{%- endif %}
{%- endfor %}
}
{%- endif %}
{%- endfor %}
{%- endif %}