Module: check_mk
Branch: master
Commit: 57c9a610ba11fa7f4a5d97404c4c8beafadeb68a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=57c9a610ba11fa…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Mar 26 08:42:25 2015 +0100
#2162 FIX citrix_sessions: Handle not set thresholds on single values correctly
When a user sets citrix_sessions_default_levels to a value which misses one of
the needed thresholds, the check results in an exception. This is now more
robust.
However, the check should better use the factory defaults mechanism.
---
.werks/2162 | 14 ++++++++++++++
ChangeLog | 1 +
checks/citrix_sessions | 6 +++---
3 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/.werks/2162 b/.werks/2162
new file mode 100644
index 0000000..749d042
--- /dev/null
+++ b/.werks/2162
@@ -0,0 +1,14 @@
+Title: citrix_sessions: Handle not set thresholds on single values correctly
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i1
+Date: 1427355497
+
+When a user sets citrix_sessions_default_levels to a value which misses one of
+the needed thresholds, the check results in an exception. This is now more
+robust.
+
+However, the check should better use the factory defaults mechanism.
diff --git a/ChangeLog b/ChangeLog
index f35a259..e29441f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -282,6 +282,7 @@
* 1240 FIX: multipath: improved detection for not installed multipath
* 2159 FIX: netapp_api_disk.summary: Changed default thresholds to WARN on the first
broken disk, CRIT on 50%...
* 2161 FIX: heartbeat_crm: Fixed UnboundLocalError exception on some systems
+ * 2162 FIX: citrix_sessions: Handle not set thresholds on single values correctly...
Multisite:
* 1758 Improved exception hander: Shows details without additional debug request,
added mailto link for error report...
diff --git a/checks/citrix_sessions b/checks/citrix_sessions
index dc1abc9..2343b26 100644
--- a/checks/citrix_sessions
+++ b/checks/citrix_sessions
@@ -45,12 +45,12 @@ def check_citrix_sessions(_no_item, params, info):
messages = []
perf = []
for what in [ 'total', 'active', 'inactive' ]:
- warn, crit = params[what]
+ warn, crit = params.get(what, (None, None))
perf.append(( what, session[what], warn, crit ))
- if session[what] > crit:
+ if crit != None and session[what] > crit:
messages.append("%s: %s(!!)" % ( what, session[what] ))
state = 2
- elif session[what] > warn:
+ elif warn != None and session[what] > warn:
messages.append("%s: %s(!)" % ( what, session[what] ))
state = max(state, 1)
else: