Module: check_mk
Branch: master
Commit: 8a5846d2e6a7f5994126e125013e7b01b46889e8
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8a5846d2e6a7f5…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Mon Dec 7 11:10:12 2015 +0100
#2884 mssql_blocked_sessions: the state of the blocked sessions is now configurable
---
.werks/2884 | 9 +++++++++
ChangeLog | 1 +
checkman/mssql_blocked_sessions | 6 +++---
checks/mssql_blocked_sessions | 13 +++++++++----
web/plugins/wato/check_parameters.py | 16 ++++++++++++++++
5 files changed, 38 insertions(+), 7 deletions(-)
diff --git a/.werks/2884 b/.werks/2884
new file mode 100644
index 0000000..97f97a8
--- /dev/null
+++ b/.werks/2884
@@ -0,0 +1,9 @@
+Title: mssql_blocked_sessions: the state of the blocked sessions is now configurable
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i4
+Date: 1449482942
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index 0a2671b..613a44c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -55,6 +55,7 @@
* 2874 netstat_an.bat: Restrict output of connections to TCP, safes performance
* 2866 ewon: Added support for monitoring Wagner OxyReduct devices with their data
exposed through an ewon router...
* 2867 check_http: client certificate and private key file parameters can now be set
in wato...
+ * 2884 mssql_blocked_sessions: the state of the blocked sessions is now configurable
* 2660 FIX: fixed windows agent using the wrong working directory...
* 2664 FIX: ps: Speedup in situation with many matching processes...
* 2661 FIX: windows agent: fixed incomplete process list...
diff --git a/checkman/mssql_blocked_sessions b/checkman/mssql_blocked_sessions
index 5617a78..26a8f2a 100644
--- a/checkman/mssql_blocked_sessions
+++ b/checkman/mssql_blocked_sessions
@@ -4,12 +4,12 @@ catalog: app/mssql
license: GPL
distribution: check_mk
description:
- This Checks lists all bolcked sessions on a MSSQL Server. As long at least one session
is blocked,
- it will be {CRITICAL}.
+ This check lists all blocked sessions on a MSSQL Server. As long at least one session is
blocked,
+ it will be {CRITICAL}. This state is configurable. The default value is {CRITICAL}.
This check needs the Check_MK mssql.vbs -plugin installed in
the agent. Please refer to the online documentation
for how to install that plugin.
inventory:
- One Check per Host will be created
+ One check per host will be created
diff --git a/checks/mssql_blocked_sessions b/checks/mssql_blocked_sessions
index 033e3e9..eb04e71 100644
--- a/checks/mssql_blocked_sessions
+++ b/checks/mssql_blocked_sessions
@@ -34,11 +34,15 @@
def inventory_mssql_blocked_sessions(info):
return [(None, None)]
-def check_mssql_blocked_sessions(item, params, info):
+def check_mssql_blocked_sessions(_no_item, params, info):
if len(info) > 1:
- for session_id, wait_duration_ms, wait_type, blocking_session_id in info[1:]:
- yield 2, "Session %s blocked by %s (Wait %s ms, Type: %s)" % \
- ( session_id, blocking_session_id, wait_duration_ms, wait_type )
+ state = 2
+ if params:
+ state = params.get("state", 2)
+ for session_id, wait_duration_ms, wait_type, blocking_session_id in info[1:]:
+ yield state, \
+ "Session %s blocked by %s (Wait %s ms, Type: %s)" % \
+ ( session_id, blocking_session_id, wait_duration_ms, wait_type )
else:
yield 0, "No blocked sessions"
@@ -47,4 +51,5 @@ check_info['mssql_blocked_sessions'] = {
'check_function' : check_mssql_blocked_sessions,
'inventory_function' : inventory_mssql_blocked_sessions,
'service_description' : "MSSQL Blocked Sessions",
+ 'group' : "mssql_blocked_sessions",
}
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 8997979..738c569 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -5342,6 +5342,22 @@ register_check_parameters(
match_type = "dict",
)
+register_check_parameters(
+ subgroup_applications,
+ "mssql_blocked_sessions",
+ _("MSSQL Blocked Sessions"),
+ Dictionary(
+ elements = [
+ ( "state",
+ MonitoringState(
+ title = _("State of MSSQL Blocked Sessions is treated
as"),
+ default_value = 2,
+ )),
+ ],
+ ),
+ None,
+ "dict",
+)
register_check_parameters(
subgroup_applications,