-
Notifications
You must be signed in to change notification settings - Fork 162
/
alerts.libsonnet
46 lines (45 loc) · 1.42 KB
/
alerts.libsonnet
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
{
new(this): {
groups: [
{
name: 'helloworld-alerts-' + this.config.uid,
rules: [
{
alert: 'HelloWorldAlert1',
expr: |||
100 - (avg without (mode, core) (rate(metric1{%(filteringSelector)s}[5m])) * 100) > %(alertsThreshold1)s
||| % this.config,
'for': '5m',
labels: {
severity: 'warning',
},
annotations: {
summary: 'Something bad happened.',
description: |||
Something bad happened on {{ $labels.instance }} and now above %(alertsThreshold1)s%%. The current value is {{ $value | printf "%%.2f" }}.
||| % this.config,
},
},
{
alert: 'HelloWorldAlert2',
expr: |||
100 - ((metric2{%(filteringSelector)s}
/
metric3{%(filteringSelector)s}) * 100) > %(alertsThreshold2)s
||| % this.config,
'for': '5m',
labels: {
severity: 'critical',
},
annotations: {
summary: 'Something else detected.',
description: |||
Something else detected on {{ $labels.instance }}, is above %(alertsThreshold2)s%%. The current value is {{ $value | printf "%%.2f" }}.
||| % this.config,
},
},
],
},
],
},
}