Module: check_mk
Branch: master
Commit: abd02ebf32678c7f46322c79ac9e77ca227dcb4a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=abd02ebf32678c…
Author: Moritz Kiemer <mo(a)mathias-kettner.de>
Date: Fri Jul 13 10:17:16 2018 +0200
df: Fix case of "zfs is hashed (/usr/sbin/zsf)"
Change-Id: I5ea9bf7fd3bab445fb9470ceae2ce05ab1f86d2b
---
checks/df | 11 ++++++-----
tests/unit/checks/test_df_check.py | 4 ++++
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/checks/df b/checks/df
index 0f692c7..9143903 100644
--- a/checks/df
+++ b/checks/df
@@ -129,11 +129,12 @@ def parse_df(info):
else:
mountpoint = " ".join(line[6:]).replace('\\',
'/') # Windows \ is replaced with /
-
- if line[2] == '-' or int(line[2]) == 0:
- continue # exclude filesystems without size
-
-
+ # exclude filesystems without size
+ try:
+ if int(line[2]) == 0:
+ continue
+ except ValueError:
+ continue
# Beware: the 6th column of df ("used perc") may includes 5% which
are reserved
# for the superuser, whereas the 4th colum ("used MB") does *not*
include that.
diff --git a/tests/unit/checks/test_df_check.py b/tests/unit/checks/test_df_check.py
index 5c6009c..4d25bdc 100644
--- a/tests/unit/checks/test_df_check.py
+++ b/tests/unit/checks/test_df_check.py
@@ -208,6 +208,9 @@ info_df_btrfs = \
[u'[df_inodes_end]']]
+info_solaris_zfs = [
+ [u'zfs', u'is', u'hashed', u'(/usr/sbin/zfs)'],
+]
#.
# .--Test functions------------------------------------------------------.
@@ -241,6 +244,7 @@ info_df_btrfs = \
(info_df_btrfs, [(u'btrfs /dev/sda1', {})], {}),
# btrfs
(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
])
def test_df_discovery_with_parse(check_manager, info, expected_result,
inventory_df_rules):