1
1
groups :
2
- - name : MySQLExporter
2
+ - name : MySQLExporterK8s
3
3
4
4
rules :
5
5
# 2.1.1
9
9
labels :
10
10
severity : critical
11
11
annotations :
12
- summary : MySQL Down (instance {{ $labels.instance }})
13
- description : " MySQL instance is down\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
12
+ summary : MySQL instance {{ $labels.instance }} is down.
13
+ description : |
14
+ LABELS = {{ $labels }}.
14
15
15
16
# 2.1.2
16
17
# customized: 80% -> 90%
@@ -20,18 +21,10 @@ groups:
20
21
labels :
21
22
severity : warning
22
23
annotations :
23
- summary : MySQL too many connections (> 90%) (instance {{ $labels.instance }})
24
- description : " More than 90% of MySQL connections are in use on {{ $labels.instance }}\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
25
-
26
- # 2.1.3
27
- - alert : MySQLHighPreparedStatementsUtilization(>80%)
28
- expr : max_over_time(mysql_global_status_prepared_stmt_count[1m]) / mysql_global_variables_max_prepared_stmt_count * 100 > 80
29
- for : 2m
30
- labels :
31
- severity : warning
32
- annotations :
33
- summary : MySQL high prepared statements utilization (> 80%) (instance {{ $labels.instance }})
34
- description : " High utilization of prepared statements (>80%) on {{ $labels.instance }}\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
24
+ summary : MySQL instance {{ $labels.instance }} is using > 90% of `max_connections`.
25
+ description : |
26
+ Consider checking the client application responsible for generating those additional connections.
27
+ LABELS = {{ $labels }}.
35
28
36
29
# 2.1.4
37
30
# customized: 60% -> 80%
@@ -41,8 +34,22 @@ groups:
41
34
labels :
42
35
severity : warning
43
36
annotations :
44
- summary : MySQL high threads running (instance {{ $labels.instance }})
45
- description : " More than 80% of MySQL connections are in running state on {{ $labels.instance }}\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
37
+ summary : MySQL instance {{ $labels.instance }} is actively using > 80% of `max_connections`.
38
+ description : |
39
+ Consider reviewing the value of the `max-connections` config parameter or allocate more resources to your database server.
40
+ LABELS = {{ $labels }}.
41
+
42
+ # 2.1.3
43
+ - alert : MySQLHighPreparedStatementsUtilization(>80%)
44
+ expr : max_over_time(mysql_global_status_prepared_stmt_count[1m]) / mysql_global_variables_max_prepared_stmt_count * 100 > 80
45
+ for : 2m
46
+ labels :
47
+ severity : warning
48
+ annotations :
49
+ summary : MySQL instance {{ $labels.instance }} is using > 80% of `max_prepared_stmt_count`.
50
+ description : |
51
+ Too many prepared statements might consume a lot of memory.
52
+ LABELS = {{ $labels }}.
46
53
47
54
# 2.1.8
48
55
# customized: warning -> info
@@ -52,8 +59,10 @@ groups:
52
59
labels :
53
60
severity : info
54
61
annotations :
55
- summary : MySQL slow queries (instance {{ $labels.instance }})
56
- description : " MySQL server mysql has some new slow query.\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
62
+ summary : MySQL instance {{ $labels.instance }} has a slow query.
63
+ description : |
64
+ Consider optimizing the query by reviewing its execution plan, then rewrite the query and add any relevant indexes.
65
+ LABELS = {{ $labels }}.
57
66
58
67
# 2.1.9
59
68
- alert : MySQLInnoDBLogWaits
@@ -62,8 +71,11 @@ groups:
62
71
labels :
63
72
severity : warning
64
73
annotations :
65
- summary : MySQL InnoDB log waits (instance {{ $labels.instance }})
66
- description : " MySQL innodb log writes stalling\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
74
+ summary : MySQL instance {{ $labels.instance }} has long InnoDB log waits.
75
+ description : |
76
+ MySQL InnoDB log writes might be stalling.
77
+ Check I/O activity on your nodes to find the responsible process or query. Consider using iotop and the performance_schema.
78
+ LABELS = {{ $labels }}.
67
79
68
80
# 2.1.10
69
81
- alert : MySQLRestarted
@@ -72,5 +84,8 @@ groups:
72
84
labels :
73
85
severity : info
74
86
annotations :
75
- summary : MySQL restarted (instance {{ $labels.instance }})
76
- description : " MySQL has just been restarted, less than one minute ago on {{ $labels.instance }}.\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
87
+ summary : MySQL instance {{ $labels.instance }} restarted.
88
+ description : |
89
+ MySQL restarted less than one minute ago.
90
+ If the restart was unplanned or frequent, check Loki logs (e.g. `error.log`).
91
+ LABELS = {{ $labels }}.
0 commit comments