cloudflare/pint
Publicmirrored fromhttps://github.com/cloudflare/pintAvailable
docs/examples/templates.hcl
25lines · modecode
| 1 | # Examples of rules using templates. |
| 2 | |
| 3 | # Any alert using non-zero `for` field must also |
| 4 | # have a label named `alert_for` with the value |
| 5 | # equal to the `for` value. |
| 6 | # Alert defined as follows: |
| 7 | # - alert: service_down |
| 8 | # expr: up == 0 |
| 9 | # for: 5m |
| 10 | # would fail this check, but this version wouldn't: |
| 11 | # - alert: service_down |
| 12 | # expr: up == 0 |
| 13 | # for: 5m |
| 14 | # labels: |
| 15 | # alert_for: 5m |
| 16 | rule { |
| 17 | match { |
| 18 | for = "> 0" |
| 19 | } |
| 20 | |
| 21 | label "alert_for" { |
| 22 | required = true |
| 23 | value = "{{ $for }}" |
| 24 | } |
| 25 | } |
| 26 | |