cloudflare/pint
Publicmirrored from https://github.com/cloudflare/pintAvailable
docs/checks/alerts/absent.md
94lines · modecode
| 1 | --- |
| 2 | layout: default |
| 3 | parent: Checks |
| 4 | grand_parent: Documentation |
| 5 | --- |
| 6 | |
| 7 | # alerts/absent |
| 8 | |
| 9 | This check will warn you about alerting rules that are using `absent()` calls without having `for` option set |
| 10 | to at least 2x scrape interval. |
| 11 | Using `absent()` without `for` can cause false positive alerts when Prometheus is restarted and the rule |
| 12 | is evaluated before the metrics tested using `absent()` are scraped. Adding a `for` option with at least |
| 13 | 2x scrape interval is usually enough to prevent this from happening. |
| 14 | |
| 15 | ## Configuration |
| 16 | |
| 17 | This check doesn't have any configuration options. |
| 18 | |
| 19 | ## How to enable it |
| 20 | |
| 21 | This check is enabled by default for all configured Prometheus servers. |
| 22 | |
| 23 | Example: |
| 24 | |
| 25 | ```js |
| 26 | prometheus "prod" { |
| 27 | uri = "https://prometheus-prod.example.com" |
| 28 | timeout = "60s" |
| 29 | include = [ |
| 30 | "rules/prod/.*", |
| 31 | "rules/common/.*", |
| 32 | ] |
| 33 | } |
| 34 | |
| 35 | prometheus "dev" { |
| 36 | uri = "https://prometheus-dev.example.com" |
| 37 | timeout = "30s" |
| 38 | include = [ |
| 39 | "rules/dev/.*", |
| 40 | "rules/common/.*", |
| 41 | ] |
| 42 | } |
| 43 | ``` |
| 44 | |
| 45 | ## How to disable it |
| 46 | |
| 47 | You can disable this check globally by adding this config block: |
| 48 | |
| 49 | ```js |
| 50 | checks { |
| 51 | disabled = ["alerts/absent"] |
| 52 | } |
| 53 | ``` |
| 54 | |
| 55 | You can also disable it for all rules inside a given file by adding |
| 56 | a comment anywhere in that file. Example: |
| 57 | |
| 58 | ```yaml |
| 59 | # pint file/disable alerts/absent |
| 60 | ``` |
| 61 | |
| 62 | Or you can disable it per rule by adding a comment to it. Example: |
| 63 | |
| 64 | ```yaml |
| 65 | # pint disable alerts/absent |
| 66 | ``` |
| 67 | |
| 68 | If you want to disable only individual instances of this check |
| 69 | you can add a more specific comment. |
| 70 | |
| 71 | ```yaml |
| 72 | # pint disable alerts/absent($prometheus) |
| 73 | ``` |
| 74 | |
| 75 | Where `$prometheus` is the name of Prometheus server to disable. |
| 76 | |
| 77 | Example: |
| 78 | |
| 79 | ```yaml |
| 80 | # pint disable alerts/absent(prod) |
| 81 | ``` |
| 82 | |
| 83 | ## How to snooze it |
| 84 | |
| 85 | You can disable this check until a given time by adding a comment to it. Example: |
| 86 | |
| 87 | ```yaml |
| 88 | # pint snooze $TIMESTAMP alerts/absent |
| 89 | ``` |
| 90 | |
| 91 | Where `$TIMESTAMP` is either [RFC3339](https://www.rfc-editor.org/rfc/rfc3339) |
| 92 | formatted or `YYYY-MM-DD`. |
| 93 | Adding this comment will disable `alerts/absent` *until* `$TIMESTAMP`, after which |
| 94 | the check will be re-enabled. |
| 95 | |