Skip to content

Commit 7cd6209

Browse files
authored
Merge pull request #3 from renvins/features/alerting
Add alerting provisioning with Discord webhook
2 parents afd81ab + b5a213c commit 7cd6209

File tree

4 files changed

+97
-1
lines changed

4 files changed

+97
-1
lines changed

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
group = "it.renvins"
2-
version = "0.1.2-SNAPSHOT"
2+
version = "0.1.3-SNAPSHOT"
33

44
repositories {
55
mavenCentral()
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
apiVersion: 1
2+
policies:
3+
- orgId: 1
4+
receiver: Discord contact point
5+
group_wait: 0s # Wait for 0 seconds before sending the first notification
6+
group_interval: 30s # Wait for 30 seconds before sending notifications about changes
7+
repeat_interval: 3m # Repeat same notifications about every 3 minutes
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: 1
2+
contactPoints:
3+
- orgId: 1
4+
name: Discord contact point
5+
receivers:
6+
- uid: deiz0m4w2afpcb
7+
type: discord
8+
settings:
9+
message: '{{ template "discord.default.message" . }}'
10+
title: '{{ template "default.title" . }}'
11+
url: https://discord.com/api/webhooks/1359937944529408100/nufab_o-rZpRj2RApWzRnpl5D_6w-cGu2w5gv3ksV0RcM2eVC2lvotJqNTGtDbNBDGsO # The Discord webhook URL
12+
use_discord_username: false
13+
disableResolveMessage: false
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
apiVersion: 1
2+
groups:
3+
- orgId: 1
4+
name: Metrics evaluation
5+
folder: Metrics alerts
6+
interval: 10s
7+
rules:
8+
- uid: ceiz0fk56qmtcd
9+
title: Low TPS
10+
condition: C
11+
data:
12+
- refId: A
13+
relativeTimeRange:
14+
from: 600
15+
to: 0
16+
datasourceUid: P5697886F9CA74929
17+
model:
18+
intervalMs: 1000
19+
maxDataPoints: 43200
20+
query: "from(bucket: \"metrics_db\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r._measurement == \"minecraft_stats\")\r\n |> filter(fn: (r) => r._field == \"tps_1m\")\r\n |> filter(fn: (r) => r.server == \"bed1\")\r\n |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\r\n |> yield(name: \"mean_tps_1m\")"
21+
refId: A
22+
- refId: B
23+
datasourceUid: __expr__
24+
model:
25+
conditions:
26+
- evaluator:
27+
params: []
28+
type: gt
29+
operator:
30+
type: and
31+
query:
32+
params:
33+
- B
34+
reducer:
35+
params: []
36+
type: last
37+
type: query
38+
datasource:
39+
type: __expr__
40+
uid: __expr__
41+
expression: A
42+
intervalMs: 1000
43+
maxDataPoints: 43200
44+
reducer: last
45+
refId: B
46+
type: reduce
47+
- refId: C
48+
datasourceUid: __expr__
49+
model:
50+
conditions:
51+
- evaluator:
52+
params:
53+
- 18
54+
type: lt
55+
operator:
56+
type: and
57+
query:
58+
params:
59+
- C
60+
reducer:
61+
params: []
62+
type: last
63+
type: query
64+
datasource:
65+
type: __expr__
66+
uid: __expr__
67+
expression: B
68+
intervalMs: 1000
69+
maxDataPoints: 43200
70+
refId: C
71+
type: threshold
72+
noDataState: NoData
73+
execErrState: Error
74+
isPaused: false
75+
notification_settings:
76+
receiver: Discord contact point

0 commit comments

Comments
 (0)