From 5d8f911d975c86dfaa3f73390c6939c46843f9f8 Mon Sep 17 00:00:00 2001 From: luhellma Date: Wed, 25 Mar 2020 11:57:29 +0100 Subject: [PATCH 1/2] feat: Add new rules for MySQLd_exporter from prometheus --- _data/rules.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/_data/rules.yml b/_data/rules.yml index 38dae95..764144c 100644 --- a/_data/rules.yml +++ b/_data/rules.yml @@ -301,6 +301,22 @@ groups: - name: prometheus/mysqld_exporter doc_url: https://github.com/prometheus/mysqld_exporter rules: + - name: MySQL down + description: MySQL down on {{ $labels.instance }} + query: 'mysql_up == 0' + severity: error + - name: MySQL connections number is high + description: MySQL connections numbers approach the maximum number of connexion possible : more than 80% of connection are in use on {{ $labels.instance }} + query: '(mysql_global_status_threads_connected / mysql_global_variables_max_connections) * 100 > 80' + severity: error + - name: MySQL slow query count + description: MySQL server is having some slow query. The count is higher than 0 on {{ $labels.instance }} + query: 'rate(mysql_global_status_slow_queries[5m]) > 0' + severity: warning + - name: MySQL restart + description: MySQL has just been restarted, less than one minute ago on {{ $labels.instance }}. + query: 'mysql_global_status_uptime < 60' + severity: warning - name: PostgreSQL exporters: From 5559e0140b047c7afb3142307ea6442cb5de9b70 Mon Sep 17 00:00:00 2001 From: luhellma Date: Wed, 25 Mar 2020 16:34:04 +0100 Subject: [PATCH 2/2] fix: double usage in query and alert configuration --- _data/rules.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_data/rules.yml b/_data/rules.yml index 764144c..db81abb 100644 --- a/_data/rules.yml +++ b/_data/rules.yml @@ -311,7 +311,7 @@ groups: severity: error - name: MySQL slow query count description: MySQL server is having some slow query. The count is higher than 0 on {{ $labels.instance }} - query: 'rate(mysql_global_status_slow_queries[5m]) > 0' + query: '(mysql_global_status_slow_queries > 0' severity: warning - name: MySQL restart description: MySQL has just been restarted, less than one minute ago on {{ $labels.instance }}.