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

View file

@ -62,7 +62,7 @@
dest: "/etc/prometheus/targetcerts/{{ inventory_hostname }}.crt"
- set_fact:
labels_ansible_groups: '{ {% for g in group_names %}"ansible_group_{{g}}": True{% if not loop.last %}, {% endif %}{% endfor %} }'
labels_ansible_groups: '{ {% for g in group_names %}"ansible_group_{{g}}": 1{% if not loop.last %}, {% endif %}{% endfor %} }'
- set_fact:
merged_prometheus_labels: "{{ {}|combine((labels_ansible_groups if prometheus_agent.ansible_groups_as_labels else {}), prometheus_agent.labels) }}"
- name: setup scraper
@ -71,3 +71,9 @@
template:
src: node-scraper.j2
dest: /etc/prometheus/conf.d/scrape_configs/agent_{{ inventory_hostname }}.conf
- name: setup alerts
loop: "{{ prometheus_agent.scrapers.keys()|list }}"
delegate_to: "{{ item }}"
template:
src: node-alerts.j2
dest: /etc/prometheus/conf.d/rule_files/agent_{{ inventory_hostname }}.conf