Module: check_mk
Branch: master
Commit: 7fc992fc92085156a8037220108577e547750f95
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7fc992fc920851…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Wed Apr 27 14:20:39 2016 +0200
3429 FIX ps, mem, mem.include: fixed missing parse_proc_meminfo_bytes during precompiling
---
.werks/3429 | 10 ++++++++++
ChangeLog | 1 +
checks/mem | 26 ++++++++------------------
checks/mem.include | 10 ++++++++++
4 files changed, 29 insertions(+), 18 deletions(-)
diff --git a/.werks/3429 b/.werks/3429
new file mode 100644
index 0000000..0530ece
--- /dev/null
+++ b/.werks/3429
@@ -0,0 +1,10 @@
+Title: ps, mem, mem.include: fixed missing parse_proc_meminfo_bytes during precompiling
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.9i1
+Date: 1461759504
+
+
diff --git a/ChangeLog b/ChangeLog
index 7c634b9..d664acc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -191,6 +191,7 @@
* 3427 FIX: mssql_counters.sqlstats: fixed rate calculation
* 3438 FIX: mk_mongodb: Fixed agent plugin handling when pymongo can not be imported
* 3441 FIX: ps: Added missing graph for number of processes
+ * 3429 FIX: ps, mem, mem.include: fixed missing parse_proc_meminfo_bytes during
precompiling
Multisite:
* 3187 notification view: new filter for log command via regex
diff --git a/checks/mem b/checks/mem
index e9cfb44..c1323c2 100644
--- a/checks/mem
+++ b/checks/mem
@@ -157,16 +157,6 @@ factory_settings["mem_linux_default_levels"] = {
"levels_vmalloc": ("abs_free", (50*1024*1024,
30*1024*1024)),
}
-# Parse /proc/meminfo into the canonical form: into bytes, not kB
-def parse_proc_meminfo_bytes(info):
- meminfo = {}
- for line in info:
- value = int(line[1])
- if len(line) > 2 and line[2] == 'kB':
- value *= 1024
- meminfo[line[0][:-1]] = value
- return meminfo
-
def is_linux_meminfo(meminfo):
return "PageTables" in meminfo and "Writeback" in meminfo and
"Committed_AS" in meminfo
@@ -360,15 +350,15 @@ def check_mem_linux(_no_item, params, info):
yield 0, "", perfdata
-
check_info["mem.linux"] = {
- 'check_function': check_mem_linux,
- 'inventory_function': inventory_mem_linux,
- 'service_description': 'Memory',
- 'default_levels_variable': 'mem_linux_default_levels',
- 'has_perfdata': True,
- 'group': 'memory_linux',
- "handle_real_time_checks" : True,
+ 'inventory_function' : inventory_mem_linux,
+ 'check_function' : check_mem_linux,
+ 'service_description' : 'Memory',
+ 'default_levels_variable' : 'mem_linux_default_levels',
+ 'has_perfdata' : True,
+ 'group' : 'memory_linux',
+ "handle_real_time_checks" : True,
+ 'includes' : [ 'mem.include' ],
}
#.
diff --git a/checks/mem.include b/checks/mem.include
index 9d3760f..e0a4f99 100644
--- a/checks/mem.include
+++ b/checks/mem.include
@@ -30,6 +30,16 @@ factory_settings["memory_default_levels"] = {
"levels" : memused_default_levels,
}
+# Parse /proc/meminfo into the canonical form: into bytes, not kB
+# This function is also used by the ps check
+def parse_proc_meminfo_bytes(info):
+ meminfo = {}
+ for line in info:
+ value = int(line[1])
+ if len(line) > 2 and line[2] == 'kB':
+ value *= 1024
+ meminfo[line[0][:-1]] = value
+ return meminfo
def check_memory(params, meminfo):
swapused = meminfo['SwapTotal'] - meminfo['SwapFree']