Skip to content

Commit 8137c6f

Browse files
authored
[MySQL] Add alerting rule templates (#15418)
* Add initial alert rule templates
1 parent c1bdc20 commit 8137c6f

File tree

6 files changed

+99
-3
lines changed

6 files changed

+99
-3
lines changed

packages/mysql/changelog.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
# newer versions go on top
2+
- version: "1.29.0"
3+
changes:
4+
- description: Add alerting rule templates.
5+
type: enhancement
6+
link: https://github.com/elastic/integrations/pull/15418
27
- version: "1.28.1"
38
changes:
49
- description: Update MySQL Integration documentation with the required privileges.

packages/mysql/data_stream/slowlog/elasticsearch/ingest_pipeline/default.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@
4141
"description": "Renames the original `message` field to `event.original` to store a copy of the original message. The `event.original` field is not touched if the document already has one; it may happen when Logstash sends the document."
4242
}
4343
},
44+
{
45+
"remove": {
46+
"field": "message",
47+
"if": "ctx.event?.original != null",
48+
"ignore_missing": true
49+
}
50+
},
4451
{
4552
"script": {
4653
"lang": "painless",
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"id": "mysql-galera-cluster-state",
3+
"type": "alerting_rule_template",
4+
"attributes": {
5+
"name": "[MySQL Galera] Cluster State Abnormal",
6+
"tags": ["MySQL Galera"],
7+
"ruleTypeId": ".es-query",
8+
"schedule": {
9+
"interval": "1m"
10+
},
11+
"params": {
12+
"searchType": "esqlQuery",
13+
"timeWindowSize": 15,
14+
"timeWindowUnit": "m",
15+
"esqlQuery": {
16+
"esql": "// Alert triggers when the Galera cluster connection status is not ON for any host within the look back time window. The recommended threshold value for connected status is != \"ON\", and the alerting rule is grouped by host name. You can adjust the threshold value by modifying the statuses value in the WHERE clause.\nFROM metrics-mysql.galera_status-default\n| WHERE mysql.galera_status.connected IS NOT NULL\n| STATS statuses = VALUES(mysql.galera_status.connected) BY host.name\n| WHERE statuses != \"ON\""
17+
},
18+
"groupBy": "row",
19+
"timeField": "@timestamp"
20+
},
21+
"alertDelay": {
22+
"active": 1
23+
}
24+
},
25+
"managed": true,
26+
"coreMigrationVersion": "8.8.0",
27+
"typeMigrationVersion": "10.1.0"
28+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"id": "mysql-replication-lag",
3+
"type": "alerting_rule_template",
4+
"attributes": {
5+
"name": "[MySQL Replica] Replication Lag High",
6+
"tags": ["MySQL Replica"],
7+
"ruleTypeId": ".es-query",
8+
"schedule": {
9+
"interval": "1m"
10+
},
11+
"params": {
12+
"searchType": "esqlQuery",
13+
"timeWindowSize": 15,
14+
"timeWindowUnit": "m",
15+
"esqlQuery": {
16+
"esql": "// Alert triggers when the p95 query latency exceeds the recommended threshold value of 500 milliseconds within the look back time window. The alerting rule is grouped by host name, query id and schema name. You can adjust the threshold value by modifying the p95_ms value in the WHERE clause, which is specified in milliseconds.\nFROM metrics-mysql.performance-default\n| WHERE `mysql.performance.events_statements.quantile.95` IS NOT NULL\n| STATS p95_ms = max(`mysql.performance.events_statements.quantile.95`/1e9) BY host.name, mysql.performance.events_statements.query_id, mysql.performance.events_statements.schemaname\n| WHERE p95_ms > 500"
17+
},
18+
"groupBy": "row",
19+
"timeField": "@timestamp"
20+
},
21+
"alertDelay": {
22+
"active": 1
23+
}
24+
},
25+
"managed": true,
26+
"coreMigrationVersion": "8.8.0",
27+
"typeMigrationVersion": "10.1.0"
28+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"id": "mysql-slow-queries",
3+
"type": "alerting_rule_template",
4+
"attributes": {
5+
"name": "[MySQL Performance] Slow Query Latency High",
6+
"tags": ["MySQL Performance"],
7+
"ruleTypeId": ".es-query",
8+
"schedule": {
9+
"interval": "1m"
10+
},
11+
"params": {
12+
"searchType": "esqlQuery",
13+
"timeWindowSize": 15,
14+
"timeWindowUnit": "m",
15+
"esqlQuery": {
16+
"esql": "// Alert triggers when the replication lag exceeds the recommended threshold value of 10 seconds within the look back time window. The alerting rule is grouped by host name and channel name. You can adjust the threshold value by modifying the secondsbehind value in the WHERE clause, which is specified in seconds.\nFROM metrics-mysql.replica_status-default\n| WHERE mysql.replica_status.seconds_behind_source IS NOT NULL\n| STATS secondsbehind=max(mysql.replica_status.seconds_behind_source) by host.name, mysql.replica_status.channel.name\n| WHERE secondsbehind > 10"
17+
},
18+
"groupBy": "row",
19+
"timeField": "@timestamp"
20+
},
21+
"alertDelay": {
22+
"active": 1
23+
}
24+
},
25+
"managed": true,
26+
"coreMigrationVersion": "8.8.0",
27+
"typeMigrationVersion": "10.1.0"
28+
}

packages/mysql/manifest.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
format_version: "3.0.2"
1+
format_version: "3.4.0"
22
name: mysql
33
title: MySQL
4-
version: "1.28.1"
4+
version: "1.29.0"
55
description: Collect logs and metrics from MySQL servers with Elastic Agent.
66
type: integration
77
categories:
88
- datastore
99
- observability
1010
conditions:
1111
kibana:
12-
version: "^8.15.0 || ^9.0.0"
12+
version: "^8.19.0 || ^9.2.1"
1313
elastic:
1414
subscription: basic
1515
screenshots:

0 commit comments

Comments
 (0)