Module: check_mk
Branch: master
Commit: 149fff236a34bbebe42fbcb5afcdb81e9f23d49b
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=149fff236a34bb…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Mon May 30 10:22:50 2016 +0200
3625 FIX zfs_arc_cache: fixed data handling if hits and misses are missing
---
.werks/3625 | 10 +++++++
ChangeLog | 1 +
checks/zfs_arc_cache | 73 +++++++++++++++++++++++++++++++++++++-------------
3 files changed, 65 insertions(+), 19 deletions(-)
diff --git a/.werks/3625 b/.werks/3625
new file mode 100644
index 0000000..62f1476
--- /dev/null
+++ b/.werks/3625
@@ -0,0 +1,10 @@
+Title: zfs_arc_cache: fixed data handling if hits and misses are missing
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.9i1
+Date: 1464596505
+
+
diff --git a/ChangeLog b/ChangeLog
index 3b2da98..a8554b1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -242,6 +242,7 @@
* 3623 FIX: ipmi: fixed discrete sensor discovery if sensor is disabled
* 3578 FIX: df: Fixed exception when monitoring filesystems without inode infos
* 3624 FIX: oracle_asm_diskgroup: fixed dismounted disk handling
+ * 3625 FIX: zfs_arc_cache: fixed data handling if hits and misses are missing
Multisite:
* 3187 notification view: new filter for log command via regex
diff --git a/checks/zfs_arc_cache b/checks/zfs_arc_cache
index b529191..1eacf82 100644
--- a/checks/zfs_arc_cache
+++ b/checks/zfs_arc_cache
@@ -85,6 +85,26 @@
# arc_meta_limit = 80 MB
# arc_meta_max = 2077 MB
+# newer output under solaris 11.3
+# <<<zfs_arc_cache>>>
+# size = 46751 MB
+# target size (c) = 1027788 MB
+# target mru_size (p) = 64236 MB
+# c_min = 4018 MB
+# c_max = 1027788 MB
+# buf_size = 605 MB
+# data_size = 43123 MB
+# other_size = 2988 MB
+# rawdata_size = 0 MB
+# meta_used = 3628 MB
+# meta_max = 3628 MB
+# meta_limit = 0 MB
+# memory_throttle_count = 0
+# arc_no_grow = 0
+# arc_tempreserve = 0 MB
+# mfu_size = 30605 MB
+# mru_size = 11601 MB
+
# parses agent output in a structure like
# {'arc_meta_limit': 80,
@@ -93,6 +113,7 @@
# [...]
# }
+
def parse_zfs_arc_cache(info):
parsed = {}
for line in info:
@@ -100,6 +121,7 @@ def parse_zfs_arc_cache(info):
parsed[line[0]] = int(line[2])
return parsed
+
# .--cache---------------------------------------------------------------.
# | _ |
# | ___ __ _ ___| |__ ___ |
@@ -109,36 +131,45 @@ def parse_zfs_arc_cache(info):
# | |
# '----------------------------------------------------------------------'
+
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, parsed):
- for key in [ "", "prefetch_data_", "prefetch_metadata_"
]:
- human_key = key.replace("_", " ")
- total_hits_misses = parsed["%shits" % key] +
parsed["%smisses" % key]
- if not total_hits_misses:
- yield 0, " No %sHits or Misses" % human_key,
[("%shit_ratio" % key, 0, '', '', 0, 100)]
- else:
- hit_ratio = float(parsed["%shits" % key]) / total_hits_misses *
100
- yield 0, " %sHit Ratio: %0.2f %%" % (human_key.title(), hit_ratio),
[("%shit_ratio" % key, "%0.2f" % hit_ratio, '', '', 0,
100)]
+ if parsed.get("hits") and parsed.get("misses"):
+ for key in [ "", "prefetch_data_",
"prefetch_metadata_" ]:
+ human_key = key.replace("_", " ")
+ total_hits_misses = parsed["%shits" % key] +
parsed["%smisses" % key]
+ if not total_hits_misses:
+ yield 0, "No %sHits or Misses" % human_key, \
+ [("%shit_ratio" % key, 0, '', '', 0,
100)]
+
+ else:
+ hit_ratio = float(parsed["%shits" % key]) / total_hits_misses *
100
+ yield 0, "%sHit Ratio: %0.2f%%" % (human_key.title(),
hit_ratio), \
+ [("%shit_ratio" % key, "%0.2f" % hit_ratio,
'', '', 0, 100)]
+ else:
+ yield 3, "No info about hit ratio available"
# size
if "size" in parsed.keys():
- yield 0, "Cache size: %d MB" % parsed["size"],
[("size", parsed["size"] * 1024 * 1024, '', '', 0)]
+ yield 0, "Cache size: %d MB" % parsed["size"], \
+ [("size", parsed["size"] * 1024 * 1024, '',
'', 0)]
# arc_meta
# these values may be missing, this is ok too
# in this case just do not report these values
- if "arc_meta_used" in parsed.keys() and "arc_meta_limit" in
parsed.keys() and "arc_meta_max" in parsed.keys():
- yield 0, "Arc Meta %d MB used, Limit %d MB, Max %d MB" \
- % (parsed["arc_meta_used"],
parsed["arc_meta_limit"], parsed["arc_meta_max"]),[
- ("arc_meta_used", parsed["arc_meta_used"] * 1024 * 1024,
'', '', 0),
- ("arc_meta_limit", parsed["arc_meta_limit"] * 1024 * 1024,
'', '', 0),
- ("arc_meta_max", parsed["arc_meta_max"] * 1024 * 1024,
'', '', 0)
- ]
+ if "arc_meta_used" in parsed.keys() and "arc_meta_limit" in
parsed.keys() and \
+ "arc_meta_max" in parsed.keys():
+ yield 0, "Arc Meta %d MB used, Limit %d MB, Max %d MB" % \
+ (parsed["arc_meta_used"], parsed["arc_meta_limit"],
parsed["arc_meta_max"]), \
+ [("arc_meta_used", parsed["arc_meta_used"] * 1024 *
1024, '', '', 0),
+ ("arc_meta_limit", parsed["arc_meta_limit"] * 1024 *
1024, '', '', 0),
+ ("arc_meta_max", parsed["arc_meta_max"] * 1024 *
1024, '', '', 0)]
check_info["zfs_arc_cache"] = {
@@ -149,6 +180,7 @@ check_info["zfs_arc_cache"] = {
"has_perfdata" : True,
}
+
#.
# .--L2 cache------------------------------------------------------------.
# | _ ____ _ |
@@ -159,6 +191,7 @@ check_info["zfs_arc_cache"] = {
# | |
# '----------------------------------------------------------------------'
+
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:
@@ -166,6 +199,7 @@ def inventory_zfs_arc_cache_l2(parsed):
else:
return []
+
def check_zfs_arc_cache_l2(_no_item, _no_params, parsed):
status = 0
perfdata = []
@@ -174,8 +208,9 @@ def check_zfs_arc_cache_l2(_no_item, _no_params, parsed):
# hit ratio
if "l2_hits" in parsed.keys() and "l2_misses" in parsed.keys():
l2_hit_ratio = float(parsed["l2_hits"]) / (parsed["l2_hits"]
+ parsed["l2_misses"]) * 100
- message += " L2 hit ratio: %0.2f %%" % l2_hit_ratio
+ message += " L2 hit ratio: %0.2f%%" % l2_hit_ratio
perfdata.append(("l2_hit_ratio", "%0.2f" % l2_hit_ratio,
'', '', 0, 100))
+
else:
message += " no info about L2 hit ratio available"
perfdata.append(("l2_hit_ratio", 0, '', '', 0, 100))
@@ -189,13 +224,13 @@ def check_zfs_arc_cache_l2(_no_item, _no_params, parsed):
message += ", no info about L2 size available"
perfdata.append(("l2_size", 0, '', '', 0))
status = 3
+
return status, message, perfdata
+
check_info["zfs_arc_cache.l2"] = {
"check_function" : check_zfs_arc_cache_l2,
"inventory_function" : inventory_zfs_arc_cache_l2,
"service_description" : "ZFS arc cache L2",
"has_perfdata" : True,
}
-
-#.