Module: check_mk
Branch: master
Commit: 0f51e513ba84d8688ccdb441c74ac59bb9c875dd
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=0f51e513ba84d8…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Tue Apr 2 11:59:42 2019 +0200
mssql_blocked_sessions: Minor cleanup
Change-Id: Ia2c9296ce348a33d071f64908d116164470109db
---
checkman/mssql_blocked_sessions | 3 ---
checks/mssql_blocked_sessions | 16 +++++++++-------
.../wato/check_parameters/mssql_blocked_sessions.py | 4 +---
.../check_parameters/mssql_instance_blocked_sessions.py | 4 +---
4 files changed, 11 insertions(+), 16 deletions(-)
diff --git a/checkman/mssql_blocked_sessions b/checkman/mssql_blocked_sessions
index 076f75d..76f8d64 100644
--- a/checkman/mssql_blocked_sessions
+++ b/checkman/mssql_blocked_sessions
@@ -11,9 +11,6 @@ description:
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
for how to install that plugin.
diff --git a/checks/mssql_blocked_sessions b/checks/mssql_blocked_sessions
index 077ef55..aa9426a 100644
--- a/checks/mssql_blocked_sessions
+++ b/checks/mssql_blocked_sessions
@@ -80,25 +80,27 @@ def check_mssql_blocked_sessions(item, params, parsed):
ignored_waittypes.add(db_inst.wait_type)
continue
- level_info = ""
- state = 0
if crit is not None and db_inst.wait_duration >= crit:
state = 2
elif warn is not None and db_inst.wait_duration >= warn:
state = 1
- if state:
- level_info = " (warn/crit at %s/%s)" %
(get_age_human_readable(warn),
- get_age_human_readable(crit))
+ else:
+ state = 0
summary.setdefault(db_inst.session_id, 0)
summary[db_inst.session_id] += 1
- details.append((state, "Session %s blocked by %s (Type: %s, Wait:
%s)%s" % \
+ details.append((state, "Session %s blocked by %s (Type: %s, Wait: %s)"
% \
(db_inst.session_id, db_inst.blocking_session_id,
db_inst.wait_type,
- get_age_human_readable(db_inst.wait_duration), level_info)))
+ get_age_human_readable(db_inst.wait_duration))))
if summary:
yield params['state'], "Summary: %s" % (", ".join(
["%s blocked by %s ID(s)" % (k, v) for k, v in
summary.iteritems()]))
+
+ max_state = max([state for state, _infotext in details])
+ if max_state:
+ yield max_state, 'At least one session above thresholds (warn/crit at
%s/%s)' % (
+ get_age_human_readable(warn), get_age_human_readable(crit))
for state, infotext in details:
yield state, "\n%s" % infotext
diff --git a/cmk/gui/plugins/wato/check_parameters/mssql_blocked_sessions.py
b/cmk/gui/plugins/wato/check_parameters/mssql_blocked_sessions.py
index b831436..ee825c0 100644
--- a/cmk/gui/plugins/wato/check_parameters/mssql_blocked_sessions.py
+++ b/cmk/gui/plugins/wato/check_parameters/mssql_blocked_sessions.py
@@ -477,9 +477,7 @@ class
RulespecCheckgroupParametersMssqlBlockedSessions(CheckParameterRulespecWit
elements=[
("state",
MonitoringState(
- title=_("State of MSSQL Blocked Sessions is treated as"),
- help=_("The default state if there is at least one "
- "blocked session."),
+ title=_("State if at least one blocked session"),
default_value=2,
)),
("waittime",
diff --git a/cmk/gui/plugins/wato/check_parameters/mssql_instance_blocked_sessions.py
b/cmk/gui/plugins/wato/check_parameters/mssql_instance_blocked_sessions.py
index 3182058..60f71d9 100644
--- a/cmk/gui/plugins/wato/check_parameters/mssql_instance_blocked_sessions.py
+++ b/cmk/gui/plugins/wato/check_parameters/mssql_instance_blocked_sessions.py
@@ -66,9 +66,7 @@ class
RulespecCheckgroupParametersMssqlInstanceBlockedSessions(CheckParameterRul
elements=[
("state",
MonitoringState(
- title=_("State of MSSQL Blocked Sessions is treated as"),
- help=_("The default state if there is at least one "
- "blocked session."),
+ title=_("State if at least one blocked session"),
default_value=2,
)),
("waittime",