cloudflare/pint

Public

mirrored from https://github.com/cloudflare/pintAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v0.44.0

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

docs/checks/alerts/count.md

133lines · modecode

1---
2layout: default
3parent: Checks
4grand_parent: Documentation
5---
6
7# alerts/count
8
9This check is used to estimate how many times given alert would fire.
10It will run `expr` query from every alert rule against selected Prometheus
11servers and report how many unique alerts it would generate.
12If `for` is set on alerts it will be used to adjust results.
13
14## Configuration
15
16Syntax:
17
18```js
19alerts {
20 range = "1h"
21 step = "1m"
22 resolve = "5m"
23 minCount = 0
24 severity = "bug|warning|info"
25}
26```
27
28- `range` - query range, how far to look back, `1h` would mean that pint will
29 query last 1h of metrics.
30 Defaults to `1d`.
31- `step` - query resolution, for most accurate result use step equal
32 to `scrape_interval`, try to reduce it if that would load too many samples.
33 Defaults to `1m`.
34- `resolve` - duration after which stale alerts are resolved. Defaults to `5m`.
35- `minCount` - minimal number of alerts for this check to report it. Default to `0`.
36 Set this to a no-zero value if you want this check to report only if the estimated
37 number of alerts is high enough.
38- `severity` - set custom severity for reported issues, defaults to `info`.
39 This can be only set when `minCount` is set to a non-zero value.
40
41## How to enable it
42
43This check is not enabled by default as it requires explicit configuration
44to work.
45To enable it add one or more `prometheus {...}` blocks and a `rule {...}` block
46with this checks config.
47
48Example:
49
50```js
51prometheus "prod" {
52 uri = "https://prometheus-prod.example.com"
53 timeout = "60s"
54}
55
56rule {
57 alerts {
58 range = "1d"
59 step = "1m"
60 resolve = "5m"
61 }
62}
63```
64
65Report an error if there would be too many (>=50) alerts firing:
66
67```js
68prometheus "prod" {
69 uri = "https://prometheus-prod.example.com"
70 timeout = "60s"
71}
72
73rule {
74 alerts {
75 range = "1d"
76 step = "1m"
77 resolve = "5m"
78 minCount = 50
79 severity = "bug"
80 }
81}
82```
83
84## How to disable it
85
86You can disable this check globally by adding this config block:
87
88```js
89checks {
90 disabled = ["alerts/count"]
91}
92```
93
94You can also disable it for all rules inside given file by adding
95a comment anywhere in that file. Example:
96
97```yaml
98# pint file/disable alerts/count
99```
100
101Or you can disable it per rule by adding a comment to it. Example:
102
103```yaml
104# pint disable alerts/count
105```
106
107If you want to disable only individual instances of this check
108you can add a more specific comment.
109
110```yaml
111# pint disable alerts/count($prometheus)
112```
113
114Where `$prometheus` is the name of Prometheus server to disable.
115
116Example:
117
118```yaml
119# pint disable alerts/count(prod)
120```
121
122## How to snooze it
123
124You can disable this check until given time by adding a comment to it. Example:
125
126```yaml
127# pint snooze $TIMESTAMP alerts/count
128```
129
130Where `$TIMESTAMP` is either use [RFC3339](https://www.rfc-editor.org/rfc/rfc3339)
131formatted or `YYYY-MM-DD`.
132Adding this comment will disable `alerts/count` *until* `$TIMESTAMP`, after that
133check will be re-enabled.
134