Module: check_mk
Branch: master
Commit: bb3f40218550e186c32dc48c1ac8716b3c001dc1
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=bb3f40218550e1…
Author: Marcel Arentz <ma(a)mathias-kettner.de>
Date: Fri Feb 3 17:02:04 2017 +0100
4190 FIX mssql_blocked_sessions: Fixed unknown states if only one session is blocked
The check state has been unknown if only one session was blocked, because
the checkplugin was expecting one additional first line from the agent output
which does not exist anymore. The new version can handle both cases and will
not accidentally drop any information anymore.
Change-Id: Ibb51b14b5fed7c1d52c6bebe85264fb68cc2a860
---
.werks/4190 | 12 ++++++++++++
checks/mssql_blocked_sessions | 6 +++++-
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/.werks/4190 b/.werks/4190
new file mode 100644
index 0000000..d6c8c4b
--- /dev/null
+++ b/.werks/4190
@@ -0,0 +1,12 @@
+Title: mssql_blocked_sessions: Fixed unknown states if only one session is blocked
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.4.0i4
+Date: 1486137493
+Class: fix
+
+The check state has been unknown if only one session was blocked, because
+the checkplugin was expecting one additional first line from the agent output
+which does not exist anymore. The new version can handle both cases and will
+not accidentally drop any information anymore.
diff --git a/checks/mssql_blocked_sessions b/checks/mssql_blocked_sessions
index ad43fcb..8923224 100644
--- a/checks/mssql_blocked_sessions
+++ b/checks/mssql_blocked_sessions
@@ -43,7 +43,11 @@ def check_mssql_blocked_sessions(_no_item, params, info):
return
state = 2
- for session_id, wait_duration_ms, wait_type, blocking_session_id in info[1:]:
+ for line in info:
+ if "blocked" in line[0].lower():
+ continue # Skip debug output which was send by old agent by accident
+ session_id, wait_duration_ms, wait_type, blocking_session_id = line
+
if params:
state = params.get("state", 2)
warn, crit = params.get("waittime", (0, 0))