cloudflare/pint
Publicmirrored from https://github.com/cloudflare/pintAvailable
docs/checks/alerts/template.md
71lines · modecode
| 1 | --- |
| 2 | layout: default |
| 3 | parent: Checks |
| 4 | grand_parent: Documentation |
| 5 | --- |
| 6 | |
| 7 | # alerts/template |
| 8 | |
| 9 | This check validates templates used in annotations and labels for alerting rules. |
| 10 | See [Prometheus docs](https://prometheus.io/docs/prometheus/latest/configuration/template_reference/) |
| 11 | for details of supported template syntax. |
| 12 | |
| 13 | This check will also inspect all alert rules and warn if any of them |
| 14 | uses query return values inside alert labels. |
| 15 | Two alerts are identical if they have identical labels, so using |
| 16 | query value will generate a new unique alert every time it changes. |
| 17 | If alerting rule is using `for` it might prevent it from ever firing |
| 18 | if the value keeps changing before `for` is satisfied, because |
| 19 | Prometheus will consider it to be a new alert and start `for` tracking |
| 20 | from zero. |
| 21 | |
| 22 | If you want to include query value in the alert then use annotations |
| 23 | for that. Annotations are not used to compare alerts identity and so |
| 24 | the value of any annotation can change between alert evaluations. |
| 25 | |
| 26 | See [this blog post](https://www.robustperception.io/dont-put-the-value-in-alert-labels) |
| 27 | for more details. |
| 28 | |
| 29 | ## Configuration |
| 30 | |
| 31 | This check doesn't have any configuration options. |
| 32 | |
| 33 | ## How to enable it |
| 34 | |
| 35 | This check is enabled by default. |
| 36 | |
| 37 | ## How to disable it |
| 38 | |
| 39 | You can disable this check globally by adding this config block: |
| 40 | |
| 41 | ```js |
| 42 | checks { |
| 43 | disabled = ["alerts/template"] |
| 44 | } |
| 45 | ``` |
| 46 | |
| 47 | You can also disable it for all rules inside given file by adding |
| 48 | a comment anywhere in that file. Example: |
| 49 | |
| 50 | ```yaml |
| 51 | # pint file/disable alerts/template |
| 52 | ``` |
| 53 | |
| 54 | Or you can disable it per rule by adding a comment to it. Example: |
| 55 | |
| 56 | ```yaml |
| 57 | # pint disable alerts/template |
| 58 | ``` |
| 59 | |
| 60 | ## How to snooze it |
| 61 | |
| 62 | You can disable this check until given time by adding a comment to it. Example: |
| 63 | |
| 64 | ```yaml |
| 65 | # pint snooze $TIMESTAMP alerts/template |
| 66 | ``` |
| 67 | |
| 68 | Where `$TIMESTAMP` is either use [RFC3339](https://www.rfc-editor.org/rfc/rfc3339) |
| 69 | formatted or `YYYY-MM-DD`. |
| 70 | Adding this comment will disable `alerts/template` *until* `$TIMESTAMP`, after that |
| 71 | check will be re-enabled. |
| 72 | |