Module: check_mk
Branch: master
Commit: 68b6e43aa08db657e5e89ddccb0c847923db5a02
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=68b6e43aa08db6…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Apr 6 11:23:15 2018 +0200
5947 df: Exclude docker local storage mounts on docker nodes
The df check is now excluding all filesystems found below
<tt>/var/lib/docker</tt>, which is the default location for
the docker container local storage.
Depending on the used storage engine docker creates overlay
filesystems and mounts below this hierarchy for the started
containers.
The filesystems are not interesting for our monitoring. They
will be monitored from the container context.
Change-Id: I25deab75bf7e9cc1a73b34999ce046f0bb06092a
---
.werks/5947 | 19 +++++++++++++++++++
checks/df | 10 +++++++++-
2 files changed, 28 insertions(+), 1 deletion(-)
diff --git a/.werks/5947 b/.werks/5947
new file mode 100644
index 0000000..3aa41f4
--- /dev/null
+++ b/.werks/5947
@@ -0,0 +1,19 @@
+Title: df: Exclude docker local storage mounts on docker nodes
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.5.0i4
+Date: 1523005992
+Class: feature
+
+The df check is now excluding all filesystems found below
+<tt>/var/lib/docker</tt>, which is the default location for
+the docker container local storage.
+
+Depending on the used storage engine docker creates overlay
+filesystems and mounts below this hierarchy for the started
+containers.
+
+The filesystems are not interesting for our monitoring. They
+will be monitored from the container context.
diff --git a/checks/df b/checks/df
index c0dfbc3..e4bef0e 100644
--- a/checks/df
+++ b/checks/df
@@ -203,7 +203,7 @@ def inventory_df(parsed):
(df_blocks, volume_info), _ = parsed
mplist = []
- for line in df_blocks:
+ for line in _filter_docker_local_storage(df_blocks):
mountpoint = line[0]
if mountpoint in inventory_df_exclude_mountpoints:
@@ -230,6 +230,9 @@ def inventory_df(parsed):
def check_df(item, params, parsed):
(df_blocks, volume_info), df_inodes = parsed
+
+ df_blocks = _filter_docker_local_storage(df_blocks)
+
if "patterns" in params or item in volume_info:
return df_check_filesystem_list(item, params, df_blocks, df_inodes)
else:
@@ -237,6 +240,11 @@ def check_df(item, params, parsed):
return df_check_filesystem_list(mountpoint, params, df_blocks, df_inodes)
+# Always exclude filesystems below dockers local storage area
+def _filter_docker_local_storage(df_blocks):
+ return [ e for e in df_blocks if not e[0].startswith("/var/lib/docker") ]
+
+
check_info['df'] = {
"parse_function" : parse_df,
"inventory_function" : inventory_df,