forked from SumoLogic/terraform-sumologic-sumo-logic-monitor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMariaDB.json
569 lines (569 loc) · 20.9 KB
/
MariaDB.json
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
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
{
"name": "MariaDB",
"description": "Folder for MySQL Monitors",
"type": "MonitorsLibraryFolderExport",
"children": [
{
"name": "MariaDB - No index used in the SQL statements",
"description": "This alert fires when there are 5 or more statements not using an index in the SQL query within a 5 minute time interval.",
"type": "MonitorsLibraryMonitorExport",
"monitorType": "Metrics",
"evaluationDelay": "0m",
"alertName": null,
"runAs": null,
"notificationGroupFields": [],
"queries": [
{
"rowId": "A",
"query": "db_system=mariadb metric=mysql_perf_schema_events_statements_no_index_used_total db_cluster=* server=* schema=* | sum by db_cluster, host, server, schema"
}
],
"triggers": [
{
"detectionMethod": "StaticCondition",
"triggerType": "Critical",
"timeRange": "-5m",
"threshold": 5,
"thresholdType": "GreaterThanOrEqual",
"field": null,
"occurrenceType": "Always",
"triggerSource": "AnyTimeSeries"
},
{
"detectionMethod": "StaticCondition",
"triggerType": "ResolvedCritical",
"timeRange": "-5m",
"threshold": 5,
"thresholdType": "LessThan",
"field": null,
"occurrenceType": "Always",
"triggerSource": "AnyTimeSeries"
}
],
"notifications": [],
"isDisabled": true,
"groupNotifications": true,
"playbook": ""
},
{
"name": "MariaDB - Large number of slow queries",
"description": "This alert fires when there are 5 or more slow queries within a 5 minute time interval.",
"type": "MonitorsLibraryMonitorExport",
"monitorType": "Metrics",
"evaluationDelay": "0m",
"alertName": null,
"runAs": null,
"notificationGroupFields": [],
"queries": [
{
"rowId": "A",
"query": "db_system=mariadb metric=mysql_slow_queries db_cluster=* server=* | sum by db_cluster, host, server"
}
],
"triggers": [
{
"detectionMethod": "StaticCondition",
"triggerType": "Critical",
"timeRange": "-5m",
"threshold": 5,
"thresholdType": "GreaterThanOrEqual",
"field": null,
"occurrenceType": "Always",
"triggerSource": "AnyTimeSeries"
},
{
"detectionMethod": "StaticCondition",
"triggerType": "ResolvedCritical",
"timeRange": "-5m",
"threshold": 5,
"thresholdType": "LessThan",
"field": null,
"occurrenceType": "Always",
"triggerSource": "AnyTimeSeries"
}
],
"notifications": [],
"isDisabled": true,
"groupNotifications": true,
"playbook": ""
},
{
"name": "MariaDB - Follower replication lag detected",
"description": "This alert fires when we detect that the average replication lag within a 5 minute time interval is greater than or equal to 900 seconds .",
"type": "MonitorsLibraryMonitorExport",
"monitorType": "Metrics",
"evaluationDelay": "0m",
"alertName": null,
"runAs": null,
"notificationGroupFields": [],
"queries": [
{
"rowId": "A",
"query": "db_system=mariadb metric=mysql_slave_Seconds_Behind_Master db_cluster=* server=* host=* | avg by db_cluster, server, host"
},
{
"rowId": "B",
"query": "db_system=mariadb metric=mysql_slave_SQL_delay db_cluster=* server=* host=* | avg by db_cluster, server, host"
},
{
"rowId": "C",
"query": "(#A - #B) along db_cluster, server, host"
}
],
"triggers": [
{
"detectionMethod": "StaticCondition",
"triggerType": "Critical",
"timeRange": "-5m",
"threshold": 900,
"thresholdType": "GreaterThanOrEqual",
"field": null,
"occurrenceType": "Always",
"triggerSource": "AnyTimeSeries"
},
{
"detectionMethod": "StaticCondition",
"triggerType": "ResolvedCritical",
"timeRange": "-5m",
"threshold": 900,
"thresholdType": "LessThan",
"field": null,
"occurrenceType": "Always",
"triggerSource": "AnyTimeSeries"
}
],
"notifications": [],
"isDisabled": true,
"groupNotifications": true,
"playbook": ""
},
{
"name": "MariaDB - Large number of statement errors",
"description": "This alert fires when there are 5 or more statement errors within a 5 minute time interval.",
"type": "MonitorsLibraryMonitorExport",
"monitorType": "Metrics",
"evaluationDelay": "0m",
"alertName": null,
"runAs": null,
"notificationGroupFields": [],
"queries": [
{
"rowId": "A",
"query": "db_system=mariadb metric=mysql_perf_schema_events_statements_errors_total db_cluster=* server=* schema=* | sum by db_cluster, host, server, schema"
}
],
"triggers": [
{
"detectionMethod": "StaticCondition",
"triggerType": "Critical",
"timeRange": "-5m",
"threshold": 5,
"thresholdType": "GreaterThanOrEqual",
"field": null,
"occurrenceType": "Always",
"triggerSource": "AnyTimeSeries"
},
{
"detectionMethod": "StaticCondition",
"triggerType": "ResolvedCritical",
"timeRange": "-5m",
"threshold": 5,
"thresholdType": "LessThan",
"field": null,
"occurrenceType": "Always",
"triggerSource": "AnyTimeSeries"
}
],
"notifications": [],
"isDisabled": true,
"groupNotifications": true,
"playbook": ""
},
{
"name": "MariaDB - Large number of statement warnings",
"description": "This alert fires when we detect that there are 20 or more statement warnings within a 5 minute time interval.",
"type": "MonitorsLibraryMonitorExport",
"monitorType": "Metrics",
"evaluationDelay": "0m",
"alertName": null,
"runAs": null,
"notificationGroupFields": [],
"queries": [
{
"rowId": "A",
"query": "db_system=mariadb metric=mysql_perf_schema_events_statements_warnings_total db_cluster=* server=* schema=* | sum by db_cluster, host, server, schema"
}
],
"triggers": [
{
"detectionMethod": "StaticCondition",
"triggerType": "Critical",
"timeRange": "-5m",
"threshold": 20,
"thresholdType": "GreaterThanOrEqual",
"field": null,
"occurrenceType": "Always",
"triggerSource": "AnyTimeSeries"
},
{
"detectionMethod": "StaticCondition",
"triggerType": "ResolvedCritical",
"timeRange": "-5m",
"threshold": 20,
"thresholdType": "LessThan",
"field": null,
"occurrenceType": "Always",
"triggerSource": "AnyTimeSeries"
}
],
"notifications": [],
"isDisabled": true,
"groupNotifications": true,
"playbook": ""
},
{
"name": "MariaDB - Instance down",
"description": "This alert fires when we detect that a MariaDB instance is down",
"type": "MonitorsLibraryMonitorExport",
"monitorType": "Logs",
"evaluationDelay": "0m",
"alertName": null,
"runAs": null,
"notificationGroupFields": [],
"queries": [
{
"rowId": "A",
"query": "db_system=mariadb db_cluster=* (\"Shutdown complete\" or \"Terminated.\")\n| json \"log\" nodrop | if (_raw matches \"{*\", log, _raw) as mesg\n| parse regex field=mesg \"\\[(?<ErrorLogtype>[^\\]]*)][\\:]*\\s(?<ErrorMsg>.*)\" nodrop\n| \"Unknown\" as server_status\n| if (ErrorMsg matches \"*Terminated.*\", \"Down\", server_status) as server_status\n| if (ErrorMsg matches \"*Shutdown complete*\", \"Down\", server_status) as server_status\n| where server_status = \"Down\"\n| if (isEmpty(pod),_sourceHost,pod) as host\n| timeslice 1s\n| count by _timeslice, db_cluster,host,server_status,ErrorMsg"
}
],
"triggers": [
{
"detectionMethod": "StaticCondition",
"triggerType": "Critical",
"timeRange": "-5m",
"threshold": 1,
"thresholdType": "GreaterThanOrEqual",
"field": "",
"occurrenceType": "ResultCount",
"triggerSource": "AllResults"
},
{
"detectionMethod": "StaticCondition",
"triggerType": "ResolvedCritical",
"timeRange": "-5m",
"threshold": 1,
"thresholdType": "LessThan",
"field": "",
"occurrenceType": "ResultCount",
"triggerSource": "AllResults"
}
],
"notifications": [],
"isDisabled": true,
"groupNotifications": true,
"playbook": ""
},
{
"name": "MariaDB - Large number of aborted connections",
"description": "This alert fires when there are 5 or more aborted connections detected within a 5 minute time interval.",
"type": "MonitorsLibraryMonitorExport",
"monitorType": "Metrics",
"evaluationDelay": "0m",
"alertName": null,
"runAs": null,
"notificationGroupFields": [],
"queries": [
{
"rowId": "A",
"query": "db_system=mariadb metric=mysql_aborted_connects db_cluster=* server=* | sum by db_cluster,host, server"
}
],
"triggers": [
{
"detectionMethod": "StaticCondition",
"triggerType": "Critical",
"timeRange": "-5m",
"threshold": 5,
"thresholdType": "GreaterThanOrEqual",
"field": null,
"occurrenceType": "Always",
"triggerSource": "AnyTimeSeries"
},
{
"detectionMethod": "StaticCondition",
"triggerType": "ResolvedCritical",
"timeRange": "-5m",
"threshold": 5,
"thresholdType": "LessThan",
"field": null,
"occurrenceType": "Always",
"triggerSource": "AnyTimeSeries"
}
],
"notifications": [],
"isDisabled": true,
"groupNotifications": true,
"playbook": ""
},
{
"name": "MariaDB - Connection refused",
"description": "This alert fires when connections are refused when the limit of maximum connections is reached.",
"type": "MonitorsLibraryMonitorExport",
"monitorType": "Metrics",
"evaluationDelay": "0m",
"alertName": null,
"runAs": null,
"notificationGroupFields": [],
"queries": [
{
"rowId": "A",
"query": "db_system=mariadb metric=mysql_connection_errors_max_connections db_cluster=* host=* server=* | sum by db_cluster, host, server"
}
],
"triggers": [
{
"detectionMethod": "StaticCondition",
"triggerType": "Critical",
"timeRange": "-5m",
"threshold": 1,
"thresholdType": "GreaterThanOrEqual",
"field": null,
"occurrenceType": "Always",
"triggerSource": "AnyTimeSeries"
},
{
"detectionMethod": "StaticCondition",
"triggerType": "ResolvedCritical",
"timeRange": "-5m",
"threshold": 1,
"thresholdType": "LessThan",
"field": null,
"occurrenceType": "Always",
"triggerSource": "AnyTimeSeries"
}
],
"notifications": [],
"isDisabled": true,
"groupNotifications": true,
"playbook": ""
},
{
"name": "MariaDB - Slave Server Error",
"description": "This alert fires when slave server error within 5 minute time interval.",
"type": "MonitorsLibraryMonitorExport",
"monitorType": "Metrics",
"evaluationDelay": "0m",
"alertName": null,
"runAs": null,
"notificationGroupFields": [],
"queries": [
{
"rowId": "C",
"query": "db_system=mariadb (metric=mysql_slave_last_io_errno or metric=mysql_slave_last_sql_errno) db_cluster=* | filter latest > 0 | sum by db_cluster,host,server"
}
],
"triggers": [
{
"detectionMethod": "StaticCondition",
"triggerType": "Critical",
"timeRange": "-5m",
"threshold": 0,
"thresholdType": "GreaterThan",
"field": null,
"occurrenceType": "Always",
"triggerSource": "AnyTimeSeries"
},
{
"detectionMethod": "StaticCondition",
"triggerType": "ResolvedCritical",
"timeRange": "-5m",
"threshold": 0,
"thresholdType": "LessThanOrEqual",
"field": null,
"occurrenceType": "Always",
"triggerSource": "AnyTimeSeries"
}
],
"notifications": [],
"isDisabled": true,
"groupNotifications": true,
"playbook": ""
},
{
"name": "MariaDB - High Innodb buffer pool utilization",
"description": "This alert fires when the InnoDB buffer pool utilization is high (>=90%) within a 5 minute time interval.",
"type": "MonitorsLibraryMonitorExport",
"monitorType": "Metrics",
"evaluationDelay": "0m",
"alertName": null,
"runAs": null,
"notificationGroupFields": [],
"queries": [
{
"rowId": "A",
"query": "db_system=mariadb metric=mysql_Innodb_buffer_pool_pages_total db_cluster=* server=* | sum by db_cluster, host, server"
},
{
"rowId": "B",
"query": "db_system=mariadb metric=mysql_Innodb_buffer_pool_pages_free db_cluster=* server=* | sum by db_cluster, host, server"
},
{
"rowId": "C",
"query": "((#A - #B) / #A) * 100 along db_cluster, host, server"
}
],
"triggers": [
{
"detectionMethod": "StaticCondition",
"triggerType": "Critical",
"timeRange": "-5m",
"threshold": 90,
"thresholdType": "GreaterThanOrEqual",
"field": null,
"occurrenceType": "Always",
"triggerSource": "AnyTimeSeries"
},
{
"detectionMethod": "StaticCondition",
"triggerType": "ResolvedCritical",
"timeRange": "-5m",
"threshold": 90,
"thresholdType": "LessThan",
"field": null,
"occurrenceType": "Always",
"triggerSource": "AnyTimeSeries"
}
],
"notifications": [],
"isDisabled": true,
"groupNotifications": true,
"playbook": ""
},
{
"name": "MariaDB - Excessive Slow Query Detected",
"description": "This alert fires when the average time to execute a query is more than 15 seconds for a 5 minute time interval.",
"type": "MonitorsLibraryMonitorExport",
"monitorType": "Logs",
"evaluationDelay": "0m",
"alertName": null,
"runAs": null,
"notificationGroupFields": [],
"queries": [
{
"rowId": "A",
"query": "db_system=mariadb db_cluster=* \"User@Host\" \"Query_time\"\n| json auto maxdepth 1 nodrop\n| if (isEmpty(log), _raw, log) as mariadb_log_message\n| parse regex field=mariadb_log_message \"(?<query_block># User@Host:[\\S\\s]+?SET timestamp=\\d+;[\\S\\s]+?;)\" multi\n| parse regex field=query_block \"Schema: (?<schema>(?:\\S*|\\s)?)\\s*Last_errno[\\s\\S]+?Query_time:\\s+(?<query_time>[\\d.]*)\\s+Lock_time:\\s+(?<lock_time>[\\d.]*)\\s+Rows_sent:\\s+(?<rows_sent>[\\d.]*)\\s+Rows_examined:\\s+(?<rows_examined>[\\d.]*)\\s+Rows_affected:\\s+(?<rows_affected>[\\d.]*)\\s+Rows_read:\\s+(?<rows_read>[\\d.]*)\\n\" nodrop // Pttrn2-vrtn1\n| parse regex field=query_block \"Schema: (?<schema>(?:\\S*|\\s)?)\\s*Last_errno[\\s\\S]+?\\s+Killed:\\s+\\d+\\n\" nodrop // Pttrn2-vrtn2\n| parse regex field=query_block \"Query_time:\\s+(?<query_time>[\\d.]*)\\s+Lock_time:\\s+(?<lock_time>[\\d.]*)\\s+Rows_sent:\\s+(?<rows_sent>[\\d]*)\\s+Rows_examined:\\s+(?<rows_examined>[\\d]*)\\s+Rows_affected:\\s+(?<rows_affected>[\\d]*)\\s+\" nodrop // Pttrn2-vrtn3\n| parse regex field=query_block \"Query_time:\\s+(?<query_time>[\\d.]*)\\s+Lock_time:\\s+(?<lock_time>[\\d.]*)\\s+Rows_sent:\\s+(?<rows_sent>[\\d]*)\\s+Rows_examined:\\s+(?<rows_examined>[\\d]*)\" // Pttrn2-vrtn4\n| fields -query_block\n| num (query_time)\n| count as frequency, sum(query_time) as total_time, min(query_time) as min_time, max(query_time) as max_time, avg(query_time) as avg_time, avg(rows_examined) as avg_rows_examined, avg(rows_sent) as avg_rows_sent, avg(Lock_Time) as avg_lock_time group by sql_cmd, db_cluster, schema\n| 15 as threshold // customize if need different value. As an example, query taking more than 15 Seconds is considered as Excessive Slow.\n| where avg_time > threshold\n| sort by avg_time, frequency asc"
}
],
"triggers": [
{
"detectionMethod": "StaticCondition",
"triggerType": "Critical",
"timeRange": "-1d",
"threshold": 1,
"thresholdType": "GreaterThanOrEqual",
"field": "",
"occurrenceType": "ResultCount",
"triggerSource": "AllResults"
},
{
"detectionMethod": "StaticCondition",
"triggerType": "ResolvedCritical",
"timeRange": "-1d",
"threshold": 1,
"thresholdType": "LessThan",
"field": "",
"occurrenceType": "ResultCount",
"triggerSource": "AllResults"
}
],
"notifications": [],
"isDisabled": true,
"groupNotifications": true,
"playbook": ""
},
{
"name": "MariaDB - Large number of internal connection errors",
"description": "This alert fires when there are 5 or more internal connection errors within a 5 minute time interval.",
"type": "MonitorsLibraryMonitorExport",
"monitorType": "Metrics",
"evaluationDelay": "0m",
"alertName": null,
"runAs": null,
"notificationGroupFields": [],
"queries": [
{
"rowId": "A",
"query": "db_system=mariadb metric=mysql_connection_errors_internal db_cluster=* server=* | sum by db_cluster, host, server"
}
],
"triggers": [
{
"detectionMethod": "StaticCondition",
"triggerType": "Critical",
"timeRange": "-5m",
"threshold": 5,
"thresholdType": "GreaterThanOrEqual",
"field": null,
"occurrenceType": "Always",
"triggerSource": "AnyTimeSeries"
},
{
"detectionMethod": "StaticCondition",
"triggerType": "ResolvedCritical",
"timeRange": "-5m",
"threshold": 5,
"thresholdType": "LessThan",
"field": null,
"occurrenceType": "Always",
"triggerSource": "AnyTimeSeries"
}
],
"notifications": [],
"isDisabled": true,
"groupNotifications": true,
"playbook": ""
},
{
"name": "MariaDB - High average query run time",
"description": "This alert fires when the average run time of MariaDB queries within a 5 minute time interval for a given schema is greater than or equal to one second.",
"type": "MonitorsLibraryMonitorExport",
"monitorType": "Metrics",
"evaluationDelay": "0m",
"alertName": null,
"runAs": null,
"notificationGroupFields": [],
"queries": [
{
"rowId": "A",
"query": "db_system=mariadb metric=mysql_perf_schema_events_statements_seconds_total db_cluster=* server=* schema=* | avg by db_cluster, host, server, schema"
}
],
"triggers": [
{
"detectionMethod": "StaticCondition",
"triggerType": "Critical",
"timeRange": "-5m",
"threshold": 1,
"thresholdType": "GreaterThanOrEqual",
"field": null,
"occurrenceType": "Always",
"triggerSource": "AnyTimeSeries"
},
{
"detectionMethod": "StaticCondition",
"triggerType": "ResolvedCritical",
"timeRange": "-5m",
"threshold": 1,
"thresholdType": "LessThan",
"field": null,
"occurrenceType": "Always",
"triggerSource": "AnyTimeSeries"
}
],
"notifications": [],
"isDisabled": true,
"groupNotifications": true,
"playbook": ""
}
]
}