Module: check_mk
Branch: master
Commit: 8505241cfdf84c041cde2cd32cf26e2de2c2ee5d
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8505241cfdf84c…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Apr 30 07:01:22 2018 +0200
6045 FIX df: Disable for docker containers
Change-Id: I985f80c869b97e87b99e7de710c1025a39b9d12c
---
.werks/6045 | 11 +++++++++++
agents/check_mk_agent.linux | 44 ++++++++++++++++++++++++++------------------
2 files changed, 37 insertions(+), 18 deletions(-)
diff --git a/.werks/6045 b/.werks/6045
new file mode 100644
index 0000000..7cbbe30
--- /dev/null
+++ b/.werks/6045
@@ -0,0 +1,11 @@
+Title: df: Disable for docker containers
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1525064482
+
+
diff --git a/agents/check_mk_agent.linux b/agents/check_mk_agent.linux
index 9df613a..85c7d4c 100755
--- a/agents/check_mk_agent.linux
+++ b/agents/check_mk_agent.linux
@@ -153,6 +153,31 @@ function section_uptime()
fi
}
+# Print out Partitions / Filesystems. (-P gives non-wrapped POSIXed output)
+# Heads up: NFS-mounts are generally supressed to avoid agent hangs.
+# If hard NFS mounts are configured or you have too large nfs retry/timeout
+# settings, accessing those mounts from the agent would leave you with
+# thousands of agent processes and, ultimately, a dead monitored system.
+# These should generally be monitored on the NFS server, not on the clients.
+function section_df()
+{
+ if [ -n "$MK_IN_CONTAINER" ]; then
+ return
+ fi
+
+ echo '<<<df>>>'
+ # The exclusion list is getting a bit of a problem. -l should hide any remote FS but
seems
+ # to be all but working.
+ local excludefs="-x smbfs -x cifs -x iso9660 -x udf -x nfsv4 -x nfs -x mvfs -x
zfs -x prl_fs"
+ df -PTlk "$excludefs" | sed 1d
+
+ # df inodes information
+ echo '<<<df>>>'
+ echo '[df_inodes_start]'
+ df -PTli "$excludefs" | sed 1d
+ echo '[df_inodes_end]'
+}
+
function run_mrpe() {
local descr=$1
shift
@@ -333,24 +358,7 @@ then
sed -n
'/^service[[:space:]]*check_mk/,/}/s/^[[:space:]]*only_from[[:space:]]*=[[:space:]]*\(.*\)/\1/p'
/etc/xinetd.d/* | head -n1; echo
fi
-# Print out Partitions / Filesystems. (-P gives non-wrapped POSIXed output)
-# Heads up: NFS-mounts are generally supressed to avoid agent hangs.
-# If hard NFS mounts are configured or you have too large nfs retry/timeout
-# settings, accessing those mounts from the agent would leave you with
-# thousands of agent processes and, ultimately, a dead monitored system.
-# These should generally be monitored on the NFS server, not on the clients.
-
-echo '<<<df>>>'
-# The exclusion list is getting a bit of a problem. -l should hide any remote FS but
seems
-# to be all but working.
-excludefs="-x smbfs -x cifs -x iso9660 -x udf -x nfsv4 -x nfs -x mvfs -x zfs -x
prl_fs"
-df -PTlk "$excludefs" | sed 1d
-
-# df inodes information
-echo '<<<df>>>'
-echo '[df_inodes_start]'
-df -PTli "$excludefs" | sed 1d
-echo '[df_inodes_end]'
+section_df
# Filesystem usage for ZFS
if type zfs > /dev/null 2>&1 ; then