Module: check_mk
Branch: master
Commit: cc5dc797b9fb951308cd0b417f70d89983c84c33
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=cc5dc797b9fb95…
Author: Konstantin Büttner <kb(a)mathias-kettner.de>
Date: Tue Mar 6 13:34:15 2018 +0100
5712 FIX cisco_mem, cisco_mem_asa, cisco_mem_asa64: No longer crash when total memory is
reported as 0.
The state in case of 0 total memory is still UNKNOWN, but the error message is more
helpful.
Change-Id: Iacb4711a441eb66bf6fad8c101902c900746a68c
---
.werks/5712 | 11 +++++++++++
checks/cisco_mem.include | 7 ++++---
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/.werks/5712 b/.werks/5712
new file mode 100644
index 0000000..9d2b3a4
--- /dev/null
+++ b/.werks/5712
@@ -0,0 +1,11 @@
+Title: cisco_mem, cisco_mem_asa, cisco_mem_asa64: No longer crash when total memory is
reported as 0.
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.5.0i4
+Date: 1520339353
+
+The state in case of 0 total memory is still UNKNOWN, but the error message is more
helpful.
diff --git a/checks/cisco_mem.include b/checks/cisco_mem.include
index f99f9f4..e75351a 100644
--- a/checks/cisco_mem.include
+++ b/checks/cisco_mem.include
@@ -47,21 +47,22 @@ def inventory_cisco_mem(info):
def check_cisco_mem(item, params, info):
for line in info:
+
if line[0] != item:
continue
if type(params) == tuple:
params = {"levels": params}
- mem_free = saveint(line[2])
- mem_used = saveint(line[1])
+ mem_free = int(line[2])
+ mem_used = int(line[1])
mem_total = mem_free + mem_used
return check_cisco_mem_sub(item, params, mem_used, mem_total)
def check_cisco_mem_sub(item, params, mem_used, mem_total):
if not mem_total:
- return 2, "total memory not available", []
+ return 3, "Cannot calculate memory usage: Device reports total memory
0"
perc_used = 100.0 * (float(mem_used) / float(mem_total))
warn, crit = params["levels"]