Module: check_mk
Branch: master
Commit: a76a497c001a241cca0cffdd1e6a88810509c565
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a76a497c001a24…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Mon Jun 26 10:09:47 2017 +0200
4872 FIX zfs_arc_cache: Fixed conversions of size, arc meta used, arc meta limit and arc
meta max
Change-Id: Ib55fd521c6fc238b180feb57cb4f905c476a3fa6
---
.werks/4872 | 11 ++++++++
checks/zfs_arc_cache | 79 ++++++++++++++++++++++++++++++++++++++++++++++++----
2 files changed, 85 insertions(+), 5 deletions(-)
diff --git a/.werks/4872 b/.werks/4872
new file mode 100644
index 0000000..eb90467
--- /dev/null
+++ b/.werks/4872
@@ -0,0 +1,11 @@
+Title: zfs_arc_cache: Fixed conversions of size, arc meta used, arc meta limit and arc
meta max
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.5.0i1
+Date: 1498464325
+
+
diff --git a/checks/zfs_arc_cache b/checks/zfs_arc_cache
index 004ffb4..2981a703 100644
--- a/checks/zfs_arc_cache
+++ b/checks/zfs_arc_cache
@@ -180,6 +180,66 @@
# size = 48851102592
# snaptime = 6646791,81811455
+#<<<zfs_arc_cache>>>
+#hits = 97798158981
+#misses = 29159034052
+#demand_data_hits = 21894170403
+#demand_data_misses = 6555284601
+#demand_metadata_hits = 67915356653
+#demand_metadata_misses = 2138181167
+#prefetch_data_hits = 6162208911
+#prefetch_data_misses = 19200459846
+#prefetch_metadata_hits = 1826423014
+#prefetch_metadata_misses = 1265108438
+#mru_hits = 32456530155
+#mru_ghost_hits = 2084134895
+#mfu_hits = 57357428725
+#mfu_ghost_hits = 1416265946
+#deleted = 26434603017
+#recycle_miss = 2014989945
+#mutex_miss = 548212067
+#evict_skip = 1758367956525
+#evict_l2_cached = 0
+#evict_l2_eligible = 236579643061760
+#evict_l2_ineligible = 68829096635392
+#hash_elements = 235200
+#hash_elements_max = 441047
+#hash_collisions = 5893650106
+#hash_chains = 22800
+#hash_chain_max = 8
+#p = 242 MB
+#c = 2048 MB
+#c_min = 2010 MB
+#c_max = 2048 MB
+#size = 1658 MB
+#hdr_size = 76639184
+#data_size = 998181888
+#other_size = 664157400
+#l2_hits = 0
+#l2_misses = 0
+#l2_feeds = 0
+#l2_rw_clash = 0
+#l2_read_bytes = 0
+#l2_write_bytes = 0
+#l2_writes_sent = 0
+#l2_writes_done = 0
+#l2_writes_error = 0
+#l2_writes_hdr_miss = 0
+#l2_evict_lock_retry = 0
+#l2_evict_reading = 0
+#l2_free_on_write = 0
+#l2_abort_lowmem = 0
+#l2_cksum_bad = 0
+#l2_io_error = 0
+#l2_size = 0
+#l2_hdr_size = 0
+#memory_throttle_count = 1014537
+#arc_no_grow = 0
+#arc_tempreserve = 0 MB
+#arc_meta_used = 1196 MB
+#arc_meta_limit = 512 MB
+#arc_meta_max = 2132 MB
+
#.
# parses agent output in a structure like
@@ -193,9 +253,16 @@
def parse_zfs_arc_cache(info):
parsed = {}
for line in info:
- if len(line) > 2 and line[1] == "=":
- if line[2].isdigit():
- parsed[line[0]] = int(line[2])
+ if not (len(line) <= 2 or line[1] == "=" or line[2].isdigit()):
+ continue
+
+ factor = 1
+ if len(line) == 4:
+ if line[3].lower() == "mb":
+ factor = 1024**2
+ elif line[3].lower() == "kb":
+ factor = 1024
+ parsed[line[0]] = int(line[2]) * factor
return parsed
@@ -244,8 +311,10 @@ def check_zfs_arc_cache(_no_item, _no_params, parsed):
# 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"]), \
+ yield 0, "Arc Meta %s used, Limit %s, Max %s" % \
+ (get_bytes_human_readable(parsed["arc_meta_used"]),
+ get_bytes_human_readable(parsed["arc_meta_limit"]),
+ get_bytes_human_readable(parsed["arc_meta_max"])), \
[("arc_meta_used", parsed["arc_meta_used"],
'', '', 0),
("arc_meta_limit", parsed["arc_meta_limit"],
'', '', 0),
("arc_meta_max", parsed["arc_meta_max"], '',
'', 0)]