Module: check_mk
Branch: master
Commit: fbb458e66ce299666a2cf6b962952de1342a9554
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=fbb458e66ce299…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Thu Oct 8 11:04:19 2015 +0200
fixed ucd_mem check: if oids are empty or have additionaly an unit
---
checks/ucd_mem | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/checks/ucd_mem b/checks/ucd_mem
index 19d66fc..1a43b93 100644
--- a/checks/ucd_mem
+++ b/checks/ucd_mem
@@ -35,11 +35,17 @@ factory_settings["ucd_mem_default_levels"] = {
def inventory_ucd_mem(info):
- return [ ("", {}) ]
+ if len(info) > 0:
+ for line in info[0]:
+ if line == "":
+ return []
+
+ return [ ("", {}) ]
def check_ucd_mem(_no_item, params, info):
- mem_total_bytes, mem_avail_bytes = map(lambda x: int(x) * 1024, info[0])
+ mem_total_bytes, mem_avail_bytes = \
+ map(lambda x: int(x.replace("kB", "").strip()) * 1024,
info[0])
mem_used_bytes = mem_total_bytes - mem_avail_bytes
return check_memory_simple(mem_used_bytes, mem_total_bytes, params)