Skip to content

Commit

Permalink
Add templated rules example
Browse files Browse the repository at this point in the history
  • Loading branch information
prymitive committed Jul 7, 2022
1 parent 487f515 commit e83a17d
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions docs/examples/templates.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Examples of rules using templates.

# Any alert using non-zero `for` field must also
# have a label named `alert_for` with the value
# equal to the `for` value.
# Alert defined as follows:
# - alert: service_down
# expr: up == 0
# for: 5m
# would fail this check, but this version wouldn't:
# - alert: service_down
# expr: up == 0
# for: 5m
# labels:
# alert_for: 5m
rule {
match {
for = "> 0"
}

label "alert_for" {
required = true
value = "{{ $for }}"
}
}

0 comments on commit e83a17d

Please sign in to comment.