added default alerts for nodes

This commit is contained in:
nd 2020-06-02 17:34:03 +02:00
parent 2c33fcc9cf
commit 7997ebfb59
No known key found for this signature in database
GPG key ID: 21B5CD4DEE3670E9
3 changed files with 208 additions and 2 deletions

10
templates/node-alerts.j2 Normal file
View file

@ -0,0 +1,10 @@
groups:
{% for groupname, alerts in prometheus_agent.alerts|dict2items|groupby("value.group") %}
- name: "{{inventory_hostname}}: {{ groupname }}"
rules:
{% for alertdict in alerts if alertdict.value.enabled %}
- alert: {{ alertdict.value.alert|d(alertdict.key) }}
{% set alert=alertdict.value|dict2items|rejectattr('key', 'in', ["enabled", "group", "alert"])|list|items2dict %}
{{ alert|to_nice_yaml(indent=2, width=9999)|indent(width=4, first=True) }}
{% endfor %}
{% endfor %}