Skip to content

Commit 1644601

Browse files
[DPE-2477] Add a minimal set of alert rules from the Awesome Prometheus Alert Rules blog (#469)
* Add a minimal set of alert rules from the Awesome Prometheus Alert Rules blog * Fix typo
1 parent 979df4b commit 1644601

File tree

1 file changed

+64
-1
lines changed

1 file changed

+64
-1
lines changed

src/prometheus_alert_rules/metrics_alert_rules.yaml

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
groups:
2-
- name: MysqlExporter
2+
- name: MySQLExporter
33

44
rules:
5+
# 2.1.1
56
- alert: MySQLDown
67
expr: "mysql_up == 0"
78
for: 0m
@@ -11,3 +12,65 @@ groups:
1112
summary: MySQL Down (instance {{ $labels.instance }})
1213
description: "MySQL instance is down\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
1314

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

Comments
 (0)