Skip to content

Commit

Permalink
Merge pull request #42 from VictoriaMetrics/feat/vmalert-rules-config…
Browse files Browse the repository at this point in the history
…uration

vmalert: allow to configure alert groups and rules via ansible variables
  • Loading branch information
zekker6 authored Mar 6, 2023
2 parents 22942e8 + f1d1931 commit 45b4e95
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
18 changes: 10 additions & 8 deletions roles/vmalert/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ vic_vm_alert_max_open_files: 2097152

# Great examples of alerts - https://awesome-prometheus-alerts.grep.to/rules.html
vic_vm_alert_rules:
- alert: HostOutOfMemory
expr: node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes * 100 < 10
for: 2m
labels:
severity: warning
annotations:
summary: '{% raw %}Host out of memory (instance {{ $labels.instance }}){% endraw %}'
description: '{% raw %}"Node memory is filling up (< 10% left)\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"{% endraw %}'
- name: ansible managed alert rules
rules:
- alert: HostOutOfMemory
expr: node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes * 100 < 10
for: 2m
labels:
severity: warning
annotations:
summary: '{% raw %}Host out of memory (instance {{ $labels.instance }}){% endraw %}'
description: '{% raw %}"Node memory is filling up (< 10% left)\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"{% endraw %}'
2 changes: 0 additions & 2 deletions roles/vmalert/templates/alerts.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@
# Great examples of alerts - https://awesome-prometheus-alerts.grep.to/rules.html

groups:
- name: ansible managed alert rules
rules:
{{ vic_vm_alert_rules | to_nice_yaml(indent=2, sort_keys=False) | indent(2, False) }}

0 comments on commit 45b4e95

Please sign in to comment.