-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmysql.yml
182 lines (163 loc) · 6.53 KB
/
mysql.yml
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
groups:
- name: MySQL
rules:
- alert: mysql_server_has_been_stopped
expr: mysql_up == 0
for: 10s
labels:
level: P0
annotations:
description: "cluster: {{ $labels.cluster }}, instance: {{ $labels.instance }}"
summary: "mysql server has been stopped"
- alert: mysql_server_has_been_restarted
expr: mysql_global_status_uptime < 300
for: 1m
labels:
level: P0
annotations:
description: "cluster: {{ $labels.cluster }}, instance: {{ $labels.instance }}"
summary: "mysql server has been restarted"
- alert: mysql_slave_io_thread_or_slave_sql_thread_has_been_stopped
expr: mysql_slave_status_slave_sql_running == 0 or mysql_slave_status_slave_io_running == 0
for: 10s
labels:
level: P0
annotations:
description: "cluster: {{ $labels.cluster }}, instance: {{ $labels.instance }}"
summary: "mysql slave_io_thread or slave_sql_thread has been stopped"
- alert: mysql_slave_is_not_readonly
expr: ((mysql_slave_status_slave_io_running == 1 and mysql_slave_status_slave_sql_running == 1) + on (instance, cluster, host, job) mysql_global_variables_read_only) == 1
for: 10s
labels:
level: P1
annotations:
description: "cluster: {{ $labels.cluster }}, instance: {{ $labels.instance }}"
summary: "mysql slave is not readonly"
- alert: mysql_master_is_readonly
expr: (mysql_global_variables_read_only unless on (host) mysql_slave_status_slave_sql_running) and mysql_global_variables_read_only == 1
for: 10s
labels:
level: P0
annotations:
description: "cluster: {{ $labels.cluster }}, instance: {{ $labels.instance }}"
summary: "mysql master is readonly"
- alert: mysql_threads_running_too_many
expr: mysql_global_status_threads_running > 50
for: 10s
labels:
level: P1
annotations:
description: "cluster: {{ $labels.cluster }}, instance: {{ $labels.instance }}, value: {{ $value }}"
summary: "mysql threads running is too many"
- alert: mysql_auto_increment_too_high
expr: floor(mysql_info_schema_auto_increment_column/mysql_info_schema_auto_increment_column_max * 100) > 80
for: 10s
labels:
level: P2
annotations:
description: "cluster: {{ $labels.cluster }}, instance: {{ $labels.instance }}, schema: {{ $labels.schema }}, table: {{ $labels.table }}, value: {{ $value }}%"
summary: "mysql auto increment too high"
- alert: "mysql_master_sync_binlog_and_innodb_flush_trx_commit_is_not_eq_1"
expr: (mysql_global_variables_sync_binlog unless on (host) mysql_slave_status_slave_sql_running) and (mysql_global_variables_sync_binlog != 1 or mysql_global_variables_innodb_flush_log_at_trx_commit !=1)
for: 10s
labels:
level: P2
annotations:
description: "cluster: {{ $labels.cluster }}, instance: {{ $labels.instance }}"
summary: "sync_binlog and innodb_flush_at_trx_commit is not equal 1"
- alert: mysql_slave_status_seconds_behind_master
expr: mysql_slave_status_seconds_behind_master > 60
for: 10s
labels:
level: P1
annotations:
description: "cluster: {{ $labels.cluster }}, instance: {{ $labels.instance }}, value: {{ $value }}"
summary: "mysql slave delay"
- alert: mysql_waiting_for_global_read_lock
expr: mysql_info_schema_processlist_seconds{state="waiting_for_global_read_lock"} > 5
for: 10s
labels:
level: P0
annotations:
description: "cluster: {{ $labels.cluster }}, instance: {{ $labels.instance }}, value: {{ $value }}"
summary: "mysql waitting for global read lock"
- alert: mysql_waiting_for_table_metadata_lock
expr: mysql_info_schema_processlist_seconds{state="waiting_for_table_metadata_lock"} > 5
for: 10s
labels:
level: P1
annotations:
description: "cluster: {{ $labels.cluster }}, instance: {{ $labels.instance }}, value: {{ $value }}"
summary: "mysql waitting for table metadata lock"
- alert: mysql_max_connections_too_high
expr: mysql_global_status_threads_connected / mysql_global_variables_max_connections * 100 > 80
for: 60s
labels:
level: P2
annotations:
description: "cluster: {{ $labels.cluster }}, instance: {{ $labels.instance }}, value: {{ $value }}"
summary: "mysql max connections too high"
- alert: mysql_log_bin_is_disabled
expr: mysql_global_variables_log_bin == 0
for: 60s
labels:
level: P1
annotations:
description: "mysql instance: {{ $labels.instance }}, value:{{ $value }}"
summary: "mysql log_bin is disabled"
- alert: mysql_log_slave_updates_is_disabled
expr: mysql_global_variables_log_slave_updates == 0
for: 60s
labels:
level: P1
annotations:
description: "mysql instance: {{ $labels.instance }}, value:{{ $value }}"
summary: "mysql log_slave_updates is disabled"
- alert: mysql_slow_queries_too_many
expr: rate(mysql_global_status_slow_queries[1m]) > 5
for: 60s
labels:
level: P1
annotations:
description: "mysql instance: {{ $labels.instance }}, value:{{ $value }}"
summary: "mysql slow queries is too many"
- alert: mysql_innodb_force_recovery_is_enabled
expr: mysql_global_variables_innodb_force_recovery != 0
for: 60s
labels:
level: P2
annotations:
description: "mysql instance: {{ $labels.instance }}, value:{{ $value }}"
summary: "Innodb Force Recovery is enabled"
- alert: mysql_binlog_size_bytes_too_large
expr: mysql_binlog_size_bytes > 1024 * 1024 * 1024 * 200
for: 60s
labels:
level: P2
annotations:
description: "mysql instance: {{ $labels.instance }}, value:{{ $value }}"
summary: "mysql total binlog size is too large"
- alert: mysql_binlog_file_too_many
expr: mysql_binlog_files > 200
for: 60s
labels:
level: P2
annotations:
description: "mysql instance: {{ $labels.instance }}, value:{{ $value }}"
summary: "mysql binlog files is too many"
- alert: mysql_slave_skip_errors
expr: mysql_global_variables_slave_skip_errors != 0
for: 60s
labels:
level: P2
annotations:
description: "mysql instance: {{ $labels.instance }}, value:{{ $value }}"
summary: "mysql global variables slave skip errors(eg.1032,1062)"
- alert: mysql_open_table_cache_too_small
expr: mysql_global_status_open_tables/mysql_global_variables_table_open_cache > 0.8
for: 60s
labels:
level: P2
annotations:
description: "mysql instance: {{ $labels.instance }}, values: {{ $value }}"
summary: "mysql open table cache is too small"