forked from jenkins-infra/datadog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
datadog-monitors.tf
234 lines (185 loc) · 7.73 KB
/
datadog-monitors.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
resource "datadog_monitor" "account_app_slow" {
name = "Account app is slow"
type = "query alert"
message = "@pagerduty Account App is slow"
query = "avg(last_5m):avg:network.http.response_time{url:https://accounts.jenkins.io} > 1"
notify_no_data = true
renotify_interval = 0
no_data_timeframe = 10
notify_audit = false
timeout_h = 0
require_full_window = true
monitor_thresholds {
critical = 1
}
tags = ["terraformed:true", "service:account-app"]
}
resource "datadog_monitor" "disk_space" {
name = "Disk space is above {{ value }}% used for {{host.name}}"
type = "query alert"
message = "{{^is_warning}}@pagerduty{{/is_warning}}"
query = "avg(last_5m):exclude_null(avg:system.disk.in_use{!device:tmpfs,!device:cgroup,!device:udev,!device:shm,!device:cgmfs,!label:UEFI,!label:uefi,!device:/dev/loop*} by {host,device}) * 100 > 90"
include_tags = false
notify_no_data = false
notify_audit = false
timeout_h = 0
renotify_interval = 0
new_group_delay = 300
require_full_window = true
monitor_thresholds {
critical = 90
warning = 80
}
tags = ["terraformed:true", "*"]
}
resource "datadog_monitor" "disk_inodes" {
name = "Disk inodes is above {{ value }}% used for {{host.name}}"
type = "query alert"
message = "{{^is_warning}}@pagerduty{{/is_warning}}"
query = "avg(last_5m):exclude_null(avg:system.fs.inodes.in_use{!device:tmpfs,!device:cgroup,!device:udev,!device:shm,!device:cgmfs,!label:UEFI,!label:uefi,!device:/dev/loop*} by {host,device}) * 100 > 90"
include_tags = false
notify_no_data = false
notify_audit = false
timeout_h = 0
renotify_interval = 0
new_group_delay = 300
require_full_window = true
monitor_thresholds {
critical = 90
warning = 80
}
tags = ["terraformed:true", "*"]
}
resource "datadog_monitor" "volume_space" {
name = "Available space is below {{ value }}% for the {{ persistentvolumeclaim.name }} PVC on {{ cluster_name.name }} cluster"
type = "query alert"
message = "{{^is_warning}}@pagerduty{{/is_warning}}"
query = "avg(last_5m):exclude_null(avg:kubernetes.kubelet.volume.stats.available_bytes{*} by {cluster_name,persistentvolumeclaim}) / exclude_null(avg:kubernetes.kubelet.volume.stats.capacity_bytes{*} by {cluster_name,persistentvolumeclaim}) * 100 < 10"
include_tags = false
notify_no_data = false
notify_audit = false
timeout_h = 0
renotify_interval = 0
new_group_delay = 300
require_full_window = true
monitor_thresholds {
critical = 10
warning = 20
}
tags = ["terraformed:true", "*"]
}
resource "datadog_monitor" "volume_inodes" {
name = "Available inodes is below {{ value }}% for the {{ persistentvolumeclaim.name }} PVC on {{ cluster_name.name }} cluster"
type = "query alert"
message = "{{^is_warning}}@pagerduty{{/is_warning}}"
query = "avg(last_5m):exclude_null(avg:kubernetes.kubelet.volume.stats.inodes_free{*} by {cluster_name,persistentvolumeclaim}) / exclude_null(avg:kubernetes.kubelet.volume.stats.inodes{*} by {cluster_name,persistentvolumeclaim}) * 100 < 10"
include_tags = false
notify_no_data = false
notify_audit = false
timeout_h = 0
renotify_interval = 0
new_group_delay = 300
require_full_window = true
monitor_thresholds {
critical = 10
warning = 20
}
tags = ["terraformed:true", "*"]
}
resource "datadog_monitor" "azurefileshare_space" {
name = "Volume usage is above {{ value }}% for the {{ name }} Azure File Share"
type = "query alert"
message = "{{^is_warning}}@pagerduty{{/is_warning}}"
query = "avg(last_5m):(avg:azure.storage_storageaccounts_fileservices.file_capacity{*} by {name} / avg:azure.storage_storageaccounts_fileservices.file_share_capacity_quota{*} by {name}) * 100 > 90"
include_tags = false
notify_no_data = false
notify_audit = false
timeout_h = 0
renotify_interval = 0
new_group_delay = 300
require_full_window = true
monitor_thresholds {
critical = 90
warning = 80
}
tags = ["terraformed:true", "*"]
}
resource "datadog_monitor" "ssl_certificate_expiration" {
name = "SSL certificate expiring soon for {{url}}"
type = "metric alert"
message = <<EOT
SSL certificate expiring soon for {{url}}, you should take a looksee. {{^is_warning}}@pagerduty{{/is_warning}}
EOT
query = "max(last_15m):min:http.ssl.days_left{production} by {url} <= 5"
notify_audit = false
timeout_h = 0
include_tags = false
notify_no_data = true
no_data_timeframe = 10
renotify_interval = 0
new_group_delay = 300
require_full_window = true
monitor_thresholds {
critical = 5
warning = 10
}
tags = ["terraformed:true", "*"]
}
resource "datadog_monitor" "weird_response_time" {
name = "Weird Response time {{url}} from {{ cluster_name.name }} cluster"
type = "metric alert"
message = <<EOT
{{#is_alert}}{{url.name}} response time is bigger than {{threshold}} seconds from {{ cluster_name.name }} cluster{{/is_alert}}
{{#is_alert_to_warning}}{{url.name}} response time is bigger than {{warn_threshold}} seconds from {{ cluster_name.name }} cluster{{/is_alert_to_warning}}
{{#is_alert_recovery}}{{url.name}} response time from {{ cluster_name.name }} cluster is back to normal{{/is_alert_recovery}}
{{#is_no_data}}{{url.name}} does not response from {{ cluster_name.name }} cluster{{/is_no_data}}
{{^is_warning}}@pagerduty{{/is_warning}}
EOT
query = "avg(last_5m):exclude_null(max:network.http.response_time{cluster_name:publick8s,!url:https://rating.jenkins.io,production} by {url,cluster_name}) > 5"
notify_audit = false
timeout_h = 0
include_tags = false
notify_no_data = true
no_data_timeframe = 10
renotify_interval = 720
new_group_delay = 300
require_full_window = true
monitor_thresholds {
critical = 5
warning = 3
}
tags = ["terraformed:true", "*"]
}
resource "datadog_monitor" "jenkins_buildqueue_size" {
name = "Huge Job Queue on {{host.name}}"
type = "metric alert"
message = "{{#is_alert}} Please forward the alert in #jenkins-infra regardless if you can('t) address this issue.\n\nTo fix look a the following steps:\n\n1. Is there any disk space issues on {{ host.name }}\n2. Does your linux or windows virtual machines correctly provisioned?\n3. Does your aci containers instances correctly provisioned?\n\nDon't hesitate to ask help to someone [here](https://github.com/jenkins-infra/runbooks#contact)\n\n{{/is_alert}}\n\n{{#is_recovery}} Job Queue size is back to normal {{/is_recovery}}\n {{^is_warning}}@pagerduty{{/is_warning}}"
query = "avg(last_5m):max:jenkins.queue.size{*} > 150"
notify_audit = false
timeout_h = 0
include_tags = false
notify_no_data = false
renotify_interval = 5
require_full_window = true
monitor_thresholds {
critical = 150
warning = 100
}
tags = ["terraformed:true", "*"]
}
resource "datadog_monitor" "ldap_process_stopped" {
name = "LDAP process stopped"
type = "process alert"
message = "Checked that the LDAP container is running correctly on {{ cluster_name.name }} by running \n```\nkubectl get pods -n ldap\n```\nAnd restart if necessary by running \n```\nkubectl delete pods -n ldap ldap-0\n``` @pagerduty"
query = "processes('ldap').over('command:slapd').rollup('count').last('5m') < 1"
notify_audit = false
timeout_h = 0
include_tags = true
notify_no_data = false
renotify_interval = 0
require_full_window = false
monitor_thresholds {
critical = 1
}
tags = ["terraformed:true", "*"]
}