Module: check_mk
Branch: master
Commit: cc399957ac28beecac4f9baf0576854b8163e494
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=cc399957ac28be…
Author: Konstantin Büttner <kb(a)mathias-kettner.de>
Date: Tue Sep 25 16:30:32 2018 +0200
6630 FIX df: Do not ignore filesystems mounted at /var/lib/docker and
/var/lib/docker-latest
We do not want to discover the container filesystems, but previously, the filtering had
been too aggressive. This has been fixed.
Change-Id: I0aa6c4ab291e1f1792f33e3bb40a2d97721e714c
---
.werks/6630 | 12 ++++++++++++
checks/df | 2 +-
tests/unit/checks/test_df_check.py | 15 ++++++++++++++-
3 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/.werks/6630 b/.werks/6630
new file mode 100644
index 0000000..819c9e0
--- /dev/null
+++ b/.werks/6630
@@ -0,0 +1,12 @@
+Title: df: Do not ignore filesystems mounted at /var/lib/docker and
/var/lib/docker-latest
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1537884926
+
+We do not want to discover the container filesystems, but previously, the filtering had
+been too aggressive. This has been fixed.
diff --git a/checks/df b/checks/df
index a157f45..50cc7c1 100644
--- a/checks/df
+++ b/checks/df
@@ -252,7 +252,7 @@ def check_df(item, params, parsed):
# And also exclude docker mounts in containers which are reported
# by the agent when the agent is executed in the container context
def _filter_docker_filesystems(df_blocks):
- return [ e for e in df_blocks if not e[0].startswith("/var/lib/docker")
+ return [ e for e in df_blocks if not e[0].startswith("/var/lib/docker/")
and e[0] not in [ "/etc/resolv.conf", "/etc/hostname",
"/etc/hosts" ] ]
diff --git a/tests/unit/checks/test_df_check.py b/tests/unit/checks/test_df_check.py
index 76e1842..51e9e55 100644
--- a/tests/unit/checks/test_df_check.py
+++ b/tests/unit/checks/test_df_check.py
@@ -42,6 +42,16 @@ info_df_win = [[u'C:\\', u'NTFS', u'8192620',
u'7724268', u'468352', u'95%', u'C
u'41%',
u'F:\\']]
+info_df_lnx_docker = [
+ [u'/dev/sda2', u'ext4', u'143786696', u'101645524',
u'34814148', u'75%', u'/var/lib/docker'],
+ [u'/dev/sda3', u'ext4', u'143786696', u'101645524',
u'34814148', u'75%', u'/var/lib/docker-latest'],
+ [u'/dev/sda4', u'ext4', u'143786696', u'101645524',
u'34814148', u'75%', u'/var/lib/docker/some-fs/mnt/grtzlhash'],
+ [u'[df_inodes_start]'],
+ [u'/dev/sda2', u'ext4', u'9142272', u'1654272',
u'7488000', u'19%', u'/var/lib/docker'],
+ [u'/dev/sda3', u'ext4', u'9142272', u'1654272',
u'7488000', u'19%', u'/var/lib/docker-latest'],
+ [u'/dev/sda4', u'ext4', u'9142272', u'1654272',
u'7488000', u'19%', u'/var/lib/docker/some-fs/mnt/grtzlhash'],
+ [u'[df_inodes_end]']]
+
info_df_lnx_tmpfs = [[u'tmpfs',
u'tmpfs',
u'8152820',
@@ -251,7 +261,10 @@ info_empty_inodes = [
(info_df_btrfs, [(u'/dev/sda1 btrfs /dev/sda1', {})],
{
"include_volume_name" : True }), # btrfs w/ volume name option
(info_solaris_zfs, [], {}),
# ignore filensystems without size
- (info_empty_inodes, [], {})
+ (info_empty_inodes, [], {}),
+ (info_df_lnx_docker, [(u'/var/lib/docker', {}),
# Omit docker container filesystems,
+ (u'/var/lib/docker-latest', {}),
# but not /var/lib/docker{,-latest}
+ ], {}),
])
def test_df_discovery_with_parse(check_manager, info, expected_result,
inventory_df_rules):