Module: check_mk
Branch: master
Commit: 0d5e17103eb818a9cc8c0d5fb14776ab5b569e8e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=0d5e17103eb818…
Author: Marcel Arentz <ma(a)mathias-kettner.de>
Date: Mon Oct 17 10:15:44 2016 +0200
3947 mssql_blocked_sessions: thresholds for wait time can be set now
Thresholds for wait_duration_ms can be set now. The value will be a floating point
in seconds to provide a better usability.
---
.werks/3947 | 10 ++++++++++
ChangeLog | 1 +
checkman/mssql_blocked_sessions | 11 +++++++++--
checks/mssql_blocked_sessions | 17 +++++++++++++----
web/plugins/wato/check_parameters.py | 18 +++++++++++++++---
5 files changed, 48 insertions(+), 9 deletions(-)
diff --git a/.werks/3947 b/.werks/3947
new file mode 100644
index 0000000..c7cde7c
--- /dev/null
+++ b/.werks/3947
@@ -0,0 +1,10 @@
+Title: mssql_blocked_sessions: thresholds for wait time can be set now
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.4.0i2
+Date: 1476691606
+Class: feature
+
+Thresholds for wait_duration_ms can be set now. The value will be a floating point
+in seconds to provide a better usability.
diff --git a/ChangeLog b/ChangeLog
index 092eee0..943648f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -11,6 +11,7 @@
* 3954 postfix_mailq_status: new check which monitors the status of postfix mail
instances
* 3945 fortigate_node: Memory on fortigate clusters are now configurable by WATO...
* 3956 fileinfo.groups: now allows regular expressions within include and exclude
patterns each beginning with a tilde
+ * 3947 mssql_blocked_sessions: thresholds for wait time can be set now...
* 3894 FIX: mkeventd_status: Fixed bug in case Event Console is not running
* 3907 FIX: oracle_tablespaces: simplyfied free space calculation depending on
version...
* 3819 FIX: windows agent: fixed 2 bugs related to mrpe...
diff --git a/checkman/mssql_blocked_sessions b/checkman/mssql_blocked_sessions
index 26a8f2a..076f75d 100644
--- a/checkman/mssql_blocked_sessions
+++ b/checkman/mssql_blocked_sessions
@@ -4,8 +4,15 @@ catalog: app/mssql
license: GPL
distribution: check_mk
description:
- 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 lists all blocked sessions on a MSSQL Server. As
+ long at least one session is blocked, it will be {CRITICAL}.
+ This state is configurable with a default value of {CRITICAL}.
+
+ Alternatively you can configure thresholds for the SQL output
+ "wait_duration_ms".
+
+ These two options can {not} be combined. If thresholds are set,
+ they will have precedence.
This check needs the Check_MK mssql.vbs -plugin installed in
the agent. Please refer to the online documentation
diff --git a/checks/mssql_blocked_sessions b/checks/mssql_blocked_sessions
index e874081..a9d1e8d 100644
--- a/checks/mssql_blocked_sessions
+++ b/checks/mssql_blocked_sessions
@@ -39,21 +39,30 @@ def inventory_mssql_blocked_sessions(info):
def check_mssql_blocked_sessions(_no_item, params, info):
if not info:
- yield 0, "No blocked sessions"
+ yield 0, "No blocked sessions"
return
state = 2
- if params:
- state = params.get("state", 2)
for session_id, wait_duration_ms, wait_type, blocking_session_id in info[1:]:
+ if params:
+ state = params.get("state", 2)
+ warn, crit = params.get("waittime", (0, 0))
+ wait_duration_sec = float(wait_duration_ms) / 100
+ if wait_duration_sec >= crit and not crit == 0:
+ state = 2
+ elif wait_duration_sec >= warn and not warn == 0:
+ state = 1
+ elif warn > 0 or crit > 0:
+ state = 0
+
yield state, \
"Session %s blocked by %s (Wait %s ms, Type: %s)" % \
( session_id, blocking_session_id, wait_duration_ms, wait_type )
check_info['mssql_blocked_sessions'] = {
- 'check_function' : check_mssql_blocked_sessions,
'inventory_function' : inventory_mssql_blocked_sessions,
+ 'check_function' : check_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 21254f0..e85b02d 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -8195,10 +8195,22 @@ register_check_parameters(
_("MSSQL Blocked Sessions"),
Dictionary(
elements = [
- ( "state",
+ ( "state",
MonitoringState(
- title = _("State of MSSQL Blocked Sessions is treated
as"),
- default_value = 2,
+ title = _("State of MSSQL Blocked Sessions is treated
as"),
+ help = _("The default state if there is at least one
"
+ "blocked session."),
+ default_value = 2,
+ )),
+ ( "waittime", Tuple(
+ title = _("Levels for wait"),
+ help = _("The threshholds for wait_duration_ms. Will
"
+ "overwrite the default state set
above."),
+ default_value = (0, 0),
+ elements = [
+ Float(title = _("Warning at"), unit =
_("seconds")),
+ Float(title = _("Critical at"), unit =
_("seconds")),
+ ]
)),
],
),