Module: check_mk
Branch: master
Commit: fe89769b260281d85e2aeb7057f6d122f42c7e89
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=fe89769b260281…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Tue Jul 31 13:12:15 2018 +0200
Rework of 'mssql_blocked_sessions' instance awareness
Change-Id: I2433006ec2c3d292b6fd2c5f197ecc1a4d0caf49
---
.werks/6140 | 15 ++++++++++-----
agents/windows/plugins/mssql.vbs | 3 ---
checks/mssql_blocked_sessions | 7 +++++--
cmk/gui/plugins/wato/check_mk_configuration.py | 1 +
cmk/gui/plugins/wato/check_parameters.py | 2 +-
5 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/.werks/6140 b/.werks/6140
index b336ef8..448e686 100644
--- a/.werks/6140
+++ b/.werks/6140
@@ -7,12 +7,17 @@ Version: 1.6.0i1
Date: 1529935714
Class: feature
-In order to make this check work take the following steps:
+Previously the {{mssql.vbs}} agent plugin did not send information
+about the instance identifier. Thus all blocked session information
+was processed by one service and the mapping of this information to
+the right instance was missing.
+
+In order to make the new check plugin work take the following steps:
<ul>
<li>Install the newest agent plugin {{mssql.vbs}}.</li>
-
-<li>Transform all configured parameters from the old deprecared ruleset
-{{MSSQL Blocked Sessions}} into the new ruleset of the same name.</li>
-
+<li>Remove the old deprecared ruleset {{MSSQL Blocked Sessions}}.</li>
+<li>Enable new service description {{MSSQL Blocked Sessions}} in global settings, execution of checks</li>
<li>Perform a rediscovery on the affected hosts.</li>
+<li>Apply the new ruleset {{MSSQL Blocked Sessions}}.</li>
+<li>Activate changes.</li>
</ul>
diff --git a/agents/windows/plugins/mssql.vbs b/agents/windows/plugins/mssql.vbs
index c50f109..af305e9 100644
--- a/agents/windows/plugins/mssql.vbs
+++ b/agents/windows/plugins/mssql.vbs
@@ -294,9 +294,6 @@ For Each instance_id In instances.Keys: Do ' Continue trick
objectName = Replace(Replace(Trim(RS("object_name")), " ", "_"), "$", "_")
counterName = LCase(Replace(Trim(RS("counter_name")), " ", "_"))
instanceName = Replace(Trim(RS("instance_name")), " ", "_")
- If instanceName = "" Then
- instanceName = "None"
- End If
value = Trim(RS("cntr_value"))
addOutput( objectName & "|" & counterName & "|" & instanceName & "|" & value )
RS.MoveNext
diff --git a/checks/mssql_blocked_sessions b/checks/mssql_blocked_sessions
index 2d6519e..a06c0fc 100644
--- a/checks/mssql_blocked_sessions
+++ b/checks/mssql_blocked_sessions
@@ -41,8 +41,8 @@ factory_settings['mssql_blocked_sessions_default_levels'] = {
def parse_mssql_blocked_sessions(info):
- db_instance = collections. namedtuple("DBInstance", ["session_id", "wait_type",
- "blocking_session_id", "wait_duration"])
+ db_instance = collections.namedtuple("DBInstance", ["session_id", "wait_type",
+ "blocking_session_id", "wait_duration"])
parsed = {}
for line in info:
if len(line) == 5:
@@ -65,6 +65,9 @@ def inventory_mssql_blocked_sessions(parsed):
def check_mssql_blocked_sessions(item, params, parsed):
+ if item is None:
+ item = ""
+
if item not in parsed:
# Assume general connection problem to the database, which is reported
# by the "X Instance" service and skip this check.
diff --git a/cmk/gui/plugins/wato/check_mk_configuration.py b/cmk/gui/plugins/wato/check_mk_configuration.py
index 64ef5ef..2913370 100644
--- a/cmk/gui/plugins/wato/check_mk_configuration.py
+++ b/cmk/gui/plugins/wato/check_mk_configuration.py
@@ -1350,6 +1350,7 @@ register_configvar(group,
( "mssql_tablespaces", _("MSSQL Tablespace")),
( "mssql_transactionlogs", _("MSSQL Transactionlog")),
( "mssql_versions", _("MSSQL Version")),
+ ( "mssql_blocked_sessions", _("MSSQL Blocked Sessions")),
],
render_orientation = "vertical",
),
diff --git a/cmk/gui/plugins/wato/check_parameters.py b/cmk/gui/plugins/wato/check_parameters.py
index 812f699..9e1c9b9 100644
--- a/cmk/gui/plugins/wato/check_parameters.py
+++ b/cmk/gui/plugins/wato/check_parameters.py
@@ -11078,7 +11078,7 @@ register_check_parameters(
)),
],
),
- TextAscii(title=_("Instance name")),
+ TextAscii(title=_("Instance identifier")),
"dict",
)