Module: check_mk
Branch: master
Commit: e48b0e3feacfa63a573e183b7b56379ba42cc9f7
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e48b0e3feacfa6…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Nov 26 12:22:14 2014 +0100
#1550 FIX zfs_arc_cache: do not inventorize of no cache information available
This avoid an exception.
---
.werks/1550 | 9 +++++++++
ChangeLog | 1 +
checks/zfs_arc_cache | 17 +++++++----------
3 files changed, 17 insertions(+), 10 deletions(-)
diff --git a/.werks/1550 b/.werks/1550
new file mode 100644
index 0000000..54f5d9d
--- /dev/null
+++ b/.werks/1550
@@ -0,0 +1,9 @@
+Title: zfs_arc_cache: do not inventorize of no cache information available
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.5i7
+Date: 1417000713
+Class: fix
+
+This avoid an exception.
diff --git a/ChangeLog b/ChangeLog
index c47760f..815d18e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -42,6 +42,7 @@
* 1548 FIX: bluecat_ntp: do not inventorized devices where NTP information is
missing
* 1549 FIX: bluecat_threads: do not inventorize this check where information is
missing...
* 1536 FIX: fritz!Box special agent now deals with new URLs (firmware >= 6.0)
correctly
+ * 1550 FIX: zfs_arc_cache: do not inventorize of no cache information available...
Multisite:
* 1508 Allow input of plugin output and perfdata when faking check results...
diff --git a/checks/zfs_arc_cache b/checks/zfs_arc_cache
index b26f320..b707a23 100644
--- a/checks/zfs_arc_cache
+++ b/checks/zfs_arc_cache
@@ -93,7 +93,7 @@
# [...]
# }
-def zfs_arc_cache_parse(info):
+def parse_zfs_arc_cache(info):
parsed = {}
for line in info:
if len(line) > 2 and line[1] == "=":
@@ -109,15 +109,13 @@ def zfs_arc_cache_parse(info):
# | |
# '----------------------------------------------------------------------'
-def inventory_zfs_arc_cache(info):
- parsed = zfs_arc_cache_parse(info)
- if "hits" in parsed.keys() and "misses" in parsed.keys():
+def inventory_zfs_arc_cache(parsed):
+ if parsed.get("hits") and parsed.get("misses"):
return [ (None, None) ]
else:
return []
-def check_zfs_arc_cache(_no_item, _no_params, info):
- parsed = zfs_arc_cache_parse(info)
+def check_zfs_arc_cache(_no_item, _no_params, parsed):
status = 0
perfdata = []
message = "ZFS arc cache:"
@@ -174,6 +172,7 @@ def check_zfs_arc_cache(_no_item, _no_params, info):
return status, message, perfdata
check_info["zfs_arc_cache"] = {
+ "parse_function" : parse_zfs_arc_cache,
"check_function" : check_zfs_arc_cache,
"inventory_function" : inventory_zfs_arc_cache,
"service_description" : "ZFS arc cache",
@@ -190,16 +189,14 @@ check_info["zfs_arc_cache"] = {
# | |
# '----------------------------------------------------------------------'
-def inventory_zfs_arc_cache_l2(info):
- parsed = zfs_arc_cache_parse(info)
+def inventory_zfs_arc_cache_l2(parsed):
# if l2_size == 0 there is no l2 cache available at all
if "l2_size" in parsed.keys() and parsed["l2_size"] > 0:
return [ (None, None) ]
else:
return []
-def check_zfs_arc_cache_l2(_no_item, _no_params, info):
- parsed = zfs_arc_cache_parse(info)
+def check_zfs_arc_cache_l2(_no_item, _no_params, parsed):
status = 0
perfdata = []
message = "ZFS arc cache L2:"