Module: check_mk
Branch: master
Commit: b919890e51eabde773b7710fa1d8efd16542bfa0
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b919890e51eabd…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Apr 6 12:15:56 2018 +0200
5949 cpu.threads cpu.load: Disabled in docker container contexts
These checks do not make sense in the context of a docker container.
The agent is now skipping this section when executed in a container.
Change-Id: I3619e796da31fbb7487baf2e13b5a6fe905ec25f
---
.werks/5949 | 11 +++++++++++
agents/check_mk_agent.linux | 14 ++++++++------
2 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/.werks/5949 b/.werks/5949
new file mode 100644
index 0000000..01c9930
--- /dev/null
+++ b/.werks/5949
@@ -0,0 +1,11 @@
+Title: cpu.threads cpu.load: Disabled in docker container contexts
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.5.0i4
+Date: 1523009711
+Class: feature
+
+These checks do not make sense in the context of a docker container.
+The agent is now skipping this section when executed in a container.
diff --git a/agents/check_mk_agent.linux b/agents/check_mk_agent.linux
index 672fb3f..0ae70e3 100755
--- a/agents/check_mk_agent.linux
+++ b/agents/check_mk_agent.linux
@@ -120,13 +120,15 @@ function section_mem()
function section_cpu()
{
- echo '<<<cpu>>>'
- if [ $(uname -m) = "armv7l" ]; then
- CPU_REGEX='^processor'
- else
- CPU_REGEX='^CPU|^processor'
+ if [ -z "$MK_IN_CONTAINER" ]; then
+ echo '<<<cpu>>>'
+ if [ "$(uname -m)" = "armv7l" ]; then
+ CPU_REGEX='^processor'
+ else
+ CPU_REGEX='^CPU|^processor'
+ fi
+ echo "$(cat /proc/loadavg) $(grep -c -E $CPU_REGEX <
/proc/cpuinfo)"
fi
- echo "$(cat /proc/loadavg) $(grep -E $CPU_REGEX < /proc/cpuinfo | wc
-l)"
}