Module: check_mk
Branch: master
Commit: 6685a043813140fd7b36b1c3d36edf739dc3c4eb
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6685a043813140…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Tue Feb 17 09:54:43 2015 +0100
#1944 FIX hr_mem: no longer reports incorrect memory values when cached memory values are
broken
Some devices reported negative used cached values. As a result the
cached memory was added to to the total memory - instead of substracted.
This has been fixed. If the value for the used cache seems to be broken,
the check uses the total cache value instead.
This new behaviour also applies to the memory buffers data.
---
.werks/1944 | 13 +++++++++++++
ChangeLog | 1 +
checks/hr_mem | 5 ++++-
3 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/.werks/1944 b/.werks/1944
new file mode 100644
index 0000000..e365c49
--- /dev/null
+++ b/.werks/1944
@@ -0,0 +1,13 @@
+Title: hr_mem: no longer reports incorrect memory values when cached memory values are
broken
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i1
+Date: 1424162791
+Class: fix
+
+Some devices reported negative used cached values. As a result the
+cached memory was added to to the total memory - instead of substracted.
+This has been fixed. If the value for the used cache seems to be broken,
+the check uses the total cache value instead.
+This new behaviour also applies to the memory buffers data.
diff --git a/ChangeLog b/ChangeLog
index d6d1576..56da789 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -159,6 +159,7 @@
* 1941 FIX: df.include: fixed exception on emtpy filesystems...
* 1942 FIX: netapp_api_volumes: fixed exception when performance data generation was
enabled
* 1993 FIX: solaris_multipath: Fix detection of expected number of paths
+ * 1944 FIX: hr_mem: no longer reports incorrect memory values when cached memory
values are broken...
Multisite:
* 1758 Improved exception hander: Shows details without additional debug request,
added mailto link for error report...
diff --git a/checks/hr_mem b/checks/hr_mem
index 0942086..e3ba95e 100644
--- a/checks/hr_mem
+++ b/checks/hr_mem
@@ -60,7 +60,10 @@ def check_hr_mem(_no_item, params, info):
cached_mb = 0
for hrtype, hrdescr, hrunits, hrsize, hrused in info:
if hrdescr in [ "Cached memory", "Memory buffers" ]:
- cached_mb += saveint(hrused) * saveint(hrunits) / 1048576.0
+ hr_mem = saveint(hrused)
+ if hr_mem < 0: # some devices report negative used cache values...
+ hr_mem = saveint(hrsize)
+ cached_mb += hr_mem * saveint(hrunits) / 1048576.0
totalram_mb, ramused_mb = usage.get(".1.3.6.1.2.1.25.2.1.2", (0,0))
ramused_mb -= cached_mb