-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.tf
100 lines (90 loc) · 2.26 KB
/
main.tf
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
terraform {
required_providers {
grafana = {
source = "grafana/grafana"
version = ">= 1.28.2"
}
}
}
variable "o11y_datasource_uid" {
type = string
}
resource "grafana_folder" "folder" {
title = "Ogmios"
}
resource "grafana_rule_group" "instance_is_down" {
name = "Ogmios is down"
folder_uid = grafana_folder.folder.uid
interval_seconds = 60
org_id = 1
rule {
name = "Ogmios is down"
condition = "B"
for = "5m"
no_data_state = "OK"
exec_err_state = "OK"
annotations = {
description = "We are not receiving more metrics from a particular Ogmios instance.",
summary = "{{ range $k, $v := $values -}}\n{{ if (match \"A[0-9]+\" $k) -}}\nPod: {{ $v.Labels.pod }}\n{{ end }}\n{{ end }}"
}
data {
ref_id = "A"
datasource_uid = var.o11y_datasource_uid
relative_time_range {
from = 3600
to = 0
}
model = jsonencode({
editorMode = "code",
expr = "count(avg_over_time(ogmios_connected[10m] offset 1h)) by (pod) unless count(avg_over_time(ogmios_connected[10m])) by (pod)",
hide = false,
intervalMs = 1000,
legendFormat = "__auto",
maxDataPoints = 43200,
range = true,
refId = "A"
})
}
data {
ref_id = "B"
datasource_uid = "-100"
relative_time_range {
from = 3600
to = 0
}
model = jsonencode({
conditions = [
{
evaluator = {
params = [0]
type = "gt"
},
operator = {
type = "and"
},
query = {
params : [
"A"
]
},
reducer = {
params = [],
type = "count_non_null"
},
type = "query"
}
],
datasource = {
type = "__expr__",
uid = "-100"
},
expression = "A",
hide = false,
intervalMs = 1000,
maxDataPoints = 43200,
refId = "B",
type = "classic_conditions"
})
}
}
}