Module: check_mk
Branch: master
Commit: b2ce37ec1cf8f408701a29ca267359de3f8718a0
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b2ce37ec1cf8f4…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Tue Apr 15 12:16:16 2014 +0200
FIX solaris_mem: fixed invalid calculation of total swap
Solaris systems which reported the memory information like<br>
Memory: 10G phys mem, 1905M free mem, 8002M total swap, 8002M free swap<br>
got incorrect total swap values in the check.
---
.werks/832 | 11 +++++++++++
ChangeLog | 1 +
checks/solaris_mem | 14 +++++++++++---
3 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/.werks/832 b/.werks/832
new file mode 100644
index 0000000..17e2f60
--- /dev/null
+++ b/.werks/832
@@ -0,0 +1,11 @@
+Title: solaris_mem: fixed invalid calculation of total swap
+Level: 1
+Component: checks
+Version: 1.2.5i3
+Date: 1397556871
+Class: fix
+
+Solaris systems which reported the memory information like<br>
+Memory: 10G phys mem, 1905M free mem, 8002M total swap, 8002M free swap<br>
+got incorrect total swap values in the check.
+
diff --git a/ChangeLog b/ChangeLog
index 9a7f3bd..686c0a2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -39,6 +39,7 @@
* 0889 FIX: logwatch: fix case where rule wouldn't be applied...
* 0882 FIX: check_bi_local.py: fix crash in case of non-ascii characters...
* 0606 FIX: apache_status: now also sends an accept header to make it work with
mod_security enables servers
+ * 0832 FIX: solaris_mem: fixed invalid calculation of total swap...
Multisite:
* 0779 Hostgroups (Summary): Empty hostgroups are no longer shown (can be re-enabled
by filter)
diff --git a/checks/solaris_mem b/checks/solaris_mem
index ab5dc59..95ab08c 100644
--- a/checks/solaris_mem
+++ b/checks/solaris_mem
@@ -49,14 +49,22 @@ def inventory_solaris_mem_used(info):
return [(None, {})]
def check_solaris_mem_used(_no_item, params, info):
- keys = ['MemTotal', 'MemFree', 'SwapTotal',
'SwapFree']
- values = [ solaris_mem_to_kbytes(v) for v in info[0] if v[0] in '01234567890'
]
+ values = []
+ mem_tokens = " ".join(info[0][1:]).split(",")
+ is_total_swap = False
+ for token in mem_tokens:
+ if "total swap" in token:
+ is_total_swap = True
+ values.append(solaris_mem_to_kbytes(token.split()[0]))
+
if len(values) != 4:
return 3, "Got unexpected information from agent"
# convert swap-in-use to swap-total, as expected by check_memory()
- values[2] = values[2] + values[3]
+ if not is_total_swap:
+ values[2] = values[2] + values[3]
+ keys = ['MemTotal', 'MemFree', 'SwapTotal',
'SwapFree']
return check_memory(params, dict(zip(keys, values)))
check_info['solaris_mem'] = {