Module: check_mk
Branch: master
Commit: d900c8167ee2abfa88f9971b87a3ffbaa4f47ea4
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d900c8167ee2ab…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Jan 26 14:14:23 2016 +0100
#2960 FIX tsm_stagingpools: Fixed exception in case of garbled agent output
---
.werks/2960 | 9 +++++++++
ChangeLog | 1 +
checks/tsm_stagingpools | 23 +++++++++++++++++++----
3 files changed, 29 insertions(+), 4 deletions(-)
diff --git a/.werks/2960 b/.werks/2960
new file mode 100644
index 0000000..9d38106
--- /dev/null
+++ b/.werks/2960
@@ -0,0 +1,9 @@
+Title: tsm_stagingpools: Fixed exception in case of garbled agent output
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i4
+Date: 1453814049
+Class: fix
+
+
diff --git a/ChangeLog b/ChangeLog
index 40c6fd6..7e6ff5b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -219,6 +219,7 @@
* 2957 FIX: Renamed Lotus Domino Task Inventory rule to Lotus Domino Task Discovery
* 2958 FIX: domino_tasks: Fixed broken discovery and check
* 2959 FIX: apt: Made check more robust against invalid agent data
+ * 2960 FIX: tsm_stagingpools: Fixed exception in case of garbled agent output
Multisite:
* 2684 Added icons for downloading agent data / walks of hosts...
diff --git a/checks/tsm_stagingpools b/checks/tsm_stagingpools
index d88739d..55fff44 100644
--- a/checks/tsm_stagingpools
+++ b/checks/tsm_stagingpools
@@ -42,20 +42,34 @@ factory_settings["tsm_stagingpools_default_levels"] = {
"free_below" : 70,
}
-def inventory_tsm_stagingpools(info):
+# The agent plugin sometimes seems to mix two lines together some times.
+# detect and fix that.
+def parse_tsm_stagingpools(info):
+ parsed = []
+ for line in info:
+ if len(line) == 6:
+ parsed.append(line[:3])
+ parsed.append(line[3:])
+ else:
+ parsed.append(line)
+ return parsed
+
+
+def inventory_tsm_stagingpools(parsed):
items = set([])
- for inst, pool, util in info:
+ for inst, pool, util in parsed:
if inst == "default":
items.add(pool)
else:
items.add(inst + " / " + pool)
return [ (item, "tsm_stagingpools_default_levels") for item in items ]
-def check_tsm_stagingpools(item, params, info):
+
+def check_tsm_stagingpools(item, params, parsed):
num_tapes = 0
num_free_tapes = 0
utilization = 0.0 # in relation to one tape size
- for inst, pool, util in info:
+ for inst, pool, util in parsed:
if inst + " / " + pool == item or pool == item:
util = float(util) / 100.0
utilization += util
@@ -91,6 +105,7 @@ def check_tsm_stagingpools(item, params, info):
check_info['tsm_stagingpools'] = {
+ "parse_function" : parse_tsm_stagingpools,
"check_function" : check_tsm_stagingpools,
"inventory_function" : inventory_tsm_stagingpools,
"service_description" : "TSM Stagingpool %s",