Module: check_mk
Branch: master
Commit: 8bcbf65b01dfe6e603d3ce99b804280201a28883
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8bcbf65b01dfe6…
Author: Óscar Nájera <on(a)mathias-kettner.de>
Date: Mon Oct 8 11:33:04 2018 +0200
6643 MySQL connections performance Data
MySQL parallel connections performance data is now captured and historic
graphs and Perf-O-Meter are views are generated.
CMK-716
Change-Id: Ia7fc72249cc6ac80e29f814c7d0b39db4ed5590b
---
.werks/6643 | 11 +++++++++++
checks/mysql | 19 ++++++++++++++-----
cmk/gui/plugins/metrics/check_mk.py | 32 ++++++++++++++++++++++++++++++++
3 files changed, 57 insertions(+), 5 deletions(-)
diff --git a/.werks/6643 b/.werks/6643
new file mode 100644
index 0000000..812ebcb
--- /dev/null
+++ b/.werks/6643
@@ -0,0 +1,11 @@
+Title: MySQL connections performance Data
+Level: 1
+Component: core
+Compatible: compat
+Edition: cre
+Version: 1.6.0i1
+Date: 1538991035
+Class: feature
+
+MySQL parallel connections performance data is now captured and historic graphs and
Perf-O-Meter are views are generated.
+
diff --git a/checks/mysql b/checks/mysql
index 81b9752..66aec4b 100644
--- a/checks/mysql
+++ b/checks/mysql
@@ -208,11 +208,13 @@ check_info['mysql.innodb_io'] = {
# | |
# +----------------------------------------------------------------------+
+
def inventory_mysql_connections(parsed):
for instance, values in parsed.items():
if 'Max_used_connections' in values and 'max_connections' in
values:
yield instance, {}
+
# TODO: This check should rather output the current number of connections.
# The historic maximum can be viewed in the RRD data...
def check_mysql_connections(item, params, parsed):
@@ -232,6 +234,11 @@ def check_mysql_connections(item, params, parsed):
status = 0
status_txt = ''
+ perf_data = [
+ ("connections_max_used", conn),
+ ("connections_max", max_conn),
+ ('connections_perc_used', perc_used),
+ ]
if 'perc_used' in params:
warn, crit = params['perc_used']
@@ -244,13 +251,15 @@ def check_mysql_connections(item, params, parsed):
status_txt = ' (Threshold (%0.2f%%) for number of maximum parallel
connections ' \
'has been reached at least once since program start'
% warn
+
return status, 'Max. parallel Connections: %d (Max.: %d): %0.2f%%%s' % \
- (conn, max_conn, perc_used, status_txt)
+ (conn, max_conn, perc_used, status_txt), perf_data
check_info['mysql.connections'] = {
- "inventory_function" : inventory_mysql_connections,
- "check_function" : check_mysql_connections,
- "service_description" : "MySQL Connections %s",
- "group" : "mysql_connections",
+ "inventory_function": inventory_mysql_connections,
+ "check_function": check_mysql_connections,
+ "service_description": "MySQL Connections %s",
+ "group": "mysql_connections",
+ "has_perfdata": True,
}
diff --git a/cmk/gui/plugins/metrics/check_mk.py b/cmk/gui/plugins/metrics/check_mk.py
index 9766069..2b88b94 100644
--- a/cmk/gui/plugins/metrics/check_mk.py
+++ b/cmk/gui/plugins/metrics/check_mk.py
@@ -4430,6 +4430,24 @@ metric_info["dtu_percent"] = {
"color" : "#4040ff"
}
+metric_info["connections_max_used"] ={
+ "title": _("Maximum used parallel connections"),
+ "unit" : "count",
+ "color" : "42/a",
+}
+
+metric_info["connections_max"] ={
+ "title": _("Maximum parallel connections"),
+ "unit" : "count",
+ "color" : "51/b",
+}
+
+metric_info["connections_perc_used"] ={
+ "title": _("Parallel connections load"),
+ "unit" : "%",
+ "color" : "21/a",
+}
+
#.
# .--Checks--------------------------------------------------------------.
# | ____ _ _ |
@@ -6751,6 +6769,12 @@ perfometer_info.append({
"exponent" : 2,
})
+perfometer_info.append({
+ "type" : "linear",
+ "segments" : ["connections_perc_used"],
+ "total" : 100,
+})
+
#.
# .--Graphs--------------------------------------------------------------.
# | ____ _ |
@@ -8553,3 +8577,11 @@ graph_info['files_notification_spool'] = {
],
"optional_metrics": ['deferred_files', 'corrupted_files'],
}
+
+graph_info['DB_connections'] = {
+ 'title' : _('Parallel connections'),
+ 'metrics': [
+ ('connections_max_used', 'area'),
+ ('connections_max', 'line'),
+ ],
+}