Module: check_mk
Branch: master
Commit: f57ca256bd21804d85a477c326ebae9bd674656e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f57ca256bd2180…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Wed Jan 16 17:59:04 2019 +0100
7008 mssql_connections: Service graph shows #connections
Change-Id: Ic33d741b37544a8225e910896e3ee40e82c47fee
---
.werks/7008 | 10 ++++++++++
checks/mssql_connections | 13 ++++++++++---
cmk/gui/plugins/metrics/check_mk.py | 11 ++++++++++-
3 files changed, 30 insertions(+), 4 deletions(-)
diff --git a/.werks/7008 b/.werks/7008
new file mode 100644
index 0000000..17c241a
--- /dev/null
+++ b/.werks/7008
@@ -0,0 +1,10 @@
+Title: mssql_connections: Service graph shows #connections
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.6.0i1
+Date: 1547657879
+Class: feature
+
+
diff --git a/checks/mssql_connections b/checks/mssql_connections
index f1db0ed..f23fa52 100644
--- a/checks/mssql_connections
+++ b/checks/mssql_connections
@@ -58,10 +58,16 @@ def check_mssql_connections(item, params, parsed):
warn, crit = params['levels']
if connection_count >= crit:
- return 2, 'Connections: %d (warn/crit at %d/%d)' % (connection_count,
warn, crit)
+ state = 2
elif connection_count >= warn:
- return 1, 'Connections: %d (warn/crit at %d/%d)' % (connection_count,
warn, crit)
- return 0, 'Connections: %d' % connection_count
+ state = 1
+ else:
+ state = 0
+
+ infotext = "Connections: %d" % connection_count
+ if state:
+ infotext += " (warn/crit at %d/%d)" % (warn, crit)
+ return state, infotext, [('connections', connection_count, warn, crit)]
check_info['mssql_connections'] = {
@@ -71,4 +77,5 @@ check_info['mssql_connections'] = {
'service_description': 'MSSQL Connections %s',
'group': 'mssql_connections',
'default_levels_variable': "mssql_connections_default_levels",
+ 'has_perfdata': True,
}
diff --git a/cmk/gui/plugins/metrics/check_mk.py b/cmk/gui/plugins/metrics/check_mk.py
index b1e20dd..6487034 100644
--- a/cmk/gui/plugins/metrics/check_mk.py
+++ b/cmk/gui/plugins/metrics/check_mk.py
@@ -8164,10 +8164,19 @@ graph_info["total_and_open_slots"] = {
graph_info["connections"] = {
"title": _("Connections"),
"metrics": [
+ ("connections", "area"),
("connections_async_writing", "area"),
("connections_async_keepalive", "stack"),
("connections_async_closing", "stack"),
- ("connections", "line"),
+ ],
+ "optional_metrics": [
+ "connections_async_writing",
+ "connections_async_keepalive",
+ "connections_async_closing",
+ ],
+ "scalars": [
+ "connections:warn",
+ "connections:crit",
],
}