Module: check_mk
Branch: master
Commit: bd651b76cfe2a0e1a5fca0b209a2c68d99e637c4
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=bd651b76cfe2a0…
Author: Marcel Arentz <ma(a)mathias-kettner.de>
Date: Thu Jul 6 16:30:02 2017 +0200
4914 FIX statgrab_mem: Plugin is now prioritized over solaris_mem if both is available
Until now the solaris_mem has been prioritized over statgrab_mem if both are available and
deliver the same information. This has been changed by this werk. Since the memory info
from top is under suspicion to be buggy we do prefer the mem information from statgrab
from now on. The information from top will be a fallback only if statgrab is not
available.
Change-Id: I120673e1c376e22ec8e90d75580a32e6a207d94d
---
.werks/4914 | 16 ++++++++++++++++
agents/check_mk_agent.solaris | 24 ++++++++++++------------
2 files changed, 28 insertions(+), 12 deletions(-)
diff --git a/.werks/4914 b/.werks/4914
new file mode 100644
index 0000000..5ea49c5
--- /dev/null
+++ b/.werks/4914
@@ -0,0 +1,16 @@
+Title: statgrab_mem: Plugin is now prioritized over solaris_mem if both is available
+Level: 1
+Component: checks
+Compatible: incompat
+Edition: cre
+Version: 1.5.0i1
+Date: 1499342226
+Class: fix
+
+Until now the solaris_mem has been prioritized over statgrab_mem if both are
+available and deliver the same information. This has been changed by this
+werk. Since the memory info from top is under suspicion to be buggy we do
+prefer the mem information from statgrab from now on. The information from
+top will be a fallback only if statgrab is not available.
+
+You may have to rediscover services to benefit from this change.
diff --git a/agents/check_mk_agent.solaris b/agents/check_mk_agent.solaris
index b54dbaf..d95796b 100755
--- a/agents/check_mk_agent.solaris
+++ b/agents/check_mk_agent.solaris
@@ -264,13 +264,10 @@ then
grep "^$s\." /tmp/statgrab.$$ | cut -d. -f2-99 | sed 's/ *= */
/'
done
- # the <<<statgrab_mem>>> info is already provided by
<<<solaris_mem>>>
- # However, we make an exception if /usr/bin/top is missing (required by solaris_mem)
- if [ ! -x /usr/bin/top ] && [ ! -x /usr/local/bin/top ]
- then
- echo '<<<statgrab_mem>>>'
- egrep "^(swap|mem)\." /tmp/statgrab.$$ | sed 's/ *= */ /'
- fi
+ # <<<statgrab_mem>>> info is preferred over
<<<solaris_mem>>>
+ # since solaris_mem is under suspicion to be buggy.
+ echo '<<<statgrab_mem>>>'
+ egrep "^(swap|mem)\." /tmp/statgrab.$$ | sed 's/ *= */ /'
[ -f /tmp/statgrab.$$ ] && rm -f /tmp/statgrab.$$
fi
@@ -311,11 +308,14 @@ fi
# Memory
-if [ -x /usr/bin/top ] || [ -x /usr/local/top ]
-then
- echo "<<<solaris_mem>>>"
- if [ -x /usr/bin/top ]; then /usr/bin/top | grep '^Memory:'; fi
- if [ -x /usr/local/bin/top ]; then /usr/bin/top | grep '^Memory:'; fi
+# <<<solaris_mem>>> should be used if statgrab is missing and top is
available.
+if ! type statgrab &>/dev/null
+ if [ -x /usr/bin/top ] || [ -x /usr/local/top ]
+ then
+ echo "<<<solaris_mem>>>"
+ if [ -x /usr/bin/top ]; then /usr/bin/top | grep '^Memory:'; fi
+ if [ -x /usr/local/bin/top ]; then /usr/bin/top | grep '^Memory:'; fi
+ fi
fi
if type prtdiag >/dev/null 2>&1