1
1
groups :
2
- - name : MysqlExporter
2
+ - name : MySQLExporter
3
3
4
4
rules :
5
+ # 2.1.1
5
6
- alert : MySQLDown
6
7
expr : " mysql_up == 0"
7
8
for : 0m
@@ -11,3 +12,65 @@ groups:
11
12
summary : MySQL Down (instance {{ $labels.instance }})
12
13
description : " MySQL instance is down\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
13
14
15
+ # 2.1.2
16
+ # customized: 80% -> 90%
17
+ - alert : MySQLTooManyConnections(>90%)
18
+ expr : max_over_time(mysql_global_status_threads_connected[1m]) / mysql_global_variables_max_connections * 100 > 90
19
+ for : 2m
20
+ labels :
21
+ severity : warning
22
+ 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 }}"
35
+
36
+ # 2.1.4
37
+ # customized: 60% -> 80%
38
+ - alert : MySQLHighThreadsRunning
39
+ expr : max_over_time(mysql_global_status_threads_running[1m]) / mysql_global_variables_max_connections * 100 > 80
40
+ for : 2m
41
+ labels :
42
+ severity : warning
43
+ 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 }}"
46
+
47
+ # 2.1.8
48
+ # customized: warning -> info
49
+ - alert : MySQLSlowQueries
50
+ expr : increase(mysql_global_status_slow_queries[1m]) > 0
51
+ for : 2m
52
+ labels :
53
+ severity : info
54
+ 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 }}"
57
+
58
+ # 2.1.9
59
+ - alert : MySQLInnoDBLogWaits
60
+ expr : rate(mysql_global_status_innodb_log_waits[15m]) > 10
61
+ for : 0m
62
+ labels :
63
+ severity : warning
64
+ annotations :
65
+ summary : MySQL InnoDB log waits (instance {{ $labels.instance }})
66
+ description : " MySQL innodb log writes stalling\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
67
+
68
+ # 2.1.10
69
+ - alert : MySQLRestarted
70
+ expr : mysql_global_status_uptime < 60
71
+ for : 0m
72
+ labels :
73
+ severity : info
74
+ 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 }}"
0 commit comments