From 2494ccdf3164f06df9e90a1c444511088b52ef47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rastislav=20P=C3=B4bi=C5=A1?= Date: Tue, 26 Mar 2024 16:56:15 +0100 Subject: [PATCH] Added prepared statements mysqld-exporter alert (#407) --- _data/rules.yml | 5 +++++ dist/rules/mysql/mysqld-exporter.yml | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/_data/rules.yml b/_data/rules.yml index 9f430eb12..3dc5c1506 100644 --- a/_data/rules.yml +++ b/_data/rules.yml @@ -588,6 +588,11 @@ groups: query: "max_over_time(mysql_global_status_threads_connected[1m]) / mysql_global_variables_max_connections * 100 > 80" severity: warning for: 2m + - name: MySQL high prepared statements utilization (> 80%) + description: "High utilization of prepared statements (>80%) on {{ $labels.instance }}" + query: "max_over_time(mysql_global_status_prepared_stmt_count[1m]) / mysql_global_variables_max_prepared_stmt_count * 100 > 80" + severity: warning + for: 2m - name: MySQL high threads running description: "More than 60% of MySQL connections are in running state on {{ $labels.instance }}" query: "max_over_time(mysql_global_status_threads_running[1m]) / mysql_global_variables_max_connections * 100 > 60" diff --git a/dist/rules/mysql/mysqld-exporter.yml b/dist/rules/mysql/mysqld-exporter.yml index ad8ed5f52..4811ee95a 100644 --- a/dist/rules/mysql/mysqld-exporter.yml +++ b/dist/rules/mysql/mysqld-exporter.yml @@ -22,6 +22,15 @@ groups: summary: MySQL too many connections (> 80%) (instance {{ $labels.instance }}) description: "More than 80% of MySQL connections are in use on {{ $labels.instance }}\n VALUE = {{ $value }}\n LABELS = {{ $labels }}" + - alert: MySQL high prepared statements utilization (> 80%) + expr: 'max_over_time(mysql_global_status_prepared_stmt_count[1m]) / mysql_global_variables_max_prepared_stmt_count * 100 > 80' + for: 2m + labels: + severity: warning + annotations: + summary: MySQL high prepared statements utilization (> 80%) (instance {{ $labels.instance }}) + description: "High utilization of prepared statements (>80%) on {{ $labels.instance }}\n VALUE = {{ $value }}\n LABELS = {{ $labels }}" + - alert: MysqlHighThreadsRunning expr: 'max_over_time(mysql_global_status_threads_running[1m]) / mysql_global_variables_max_connections * 100 > 60' for: 2m