Module: check_mk
Branch: master
Commit: 5c319eef6f6063150b96d9ecd9f2ab20878dfebc
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5c319eef6f6063…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Tue Nov 10 15:12:49 2015 +0100
#2701 FIX zfsget: fixed handling in case of zero total size based on buggy 'df -h' command on some solaris systems
Affected solaris systems are solaris 10 10/08 s10s_u6wos_07b SPARC and solaris 10 10/09 s10x_u8wos_08a X86.
---
.werks/2701 | 9 +++++++++
ChangeLog | 1 +
checks/zfsget | 19 +++++++++++++++----
3 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/.werks/2701 b/.werks/2701
new file mode 100644
index 0000000..0f1fb71
--- /dev/null
+++ b/.werks/2701
@@ -0,0 +1,9 @@
+Title: zfsget: fixed handling in case of zero total size based on buggy 'df -h' command on some solaris systems
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i4
+Date: 1447164386
+Class: fix
+
+Affected solaris systems are solaris 10 10/08 s10s_u6wos_07b SPARC and solaris 10 10/09 s10x_u8wos_08a X86.
diff --git a/ChangeLog b/ChangeLog
index 863a120..01bde39 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -63,6 +63,7 @@
* 2755 FIX: apc_symmetra: Check is handling missing data more robust now
* 2783 FIX: esx_vsphere_datastores: fixed crash when no provisioning levels were set
* 2700 FIX: ibm_svc_node: fixed handling with agent output after firmware update
+ * 2701 FIX: zfsget: fixed handling in case of zero total size based on buggy 'df -h' command on some solaris systems...
Multisite:
* 2684 Added icons for downloading agent data / walks of hosts...
diff --git a/checks/zfsget b/checks/zfsget
index f100cbf..bc9cc20 100644
--- a/checks/zfsget
+++ b/checks/zfsget
@@ -110,12 +110,23 @@ def parse_zfsget(info):
device, fs_type, kbytes, used, avail, percent, mountpoint = line
if mountpoint.startswith("/"):
entry = {}
- total = int(kbytes) / 1024.0
entry["name"] = device
- entry["total"] = total
- entry["used"] = int(used) / 1024.0
- entry["available"] = total - entry["used"]
entry["mountpoint"] = mountpoint
+ # With some versions of solaris systems such as
+ # solaris 10 10/08 s10s_u6wos_07b SPARC and solaris 10 10/09 s10x_u8wos_08a X86
+ # there migth be a bug in the 'df -h' command which we use for filesystem infos.
+ # Then the received data from the agent looks like "/ 0 12445007 19012273 5% /".
+ # In this case we compute the total size as the sum of used and available.
+ total = int(kbytes)
+ used = int(used)
+ avail = int(avail)
+ if used and avail and not total:
+ total = used + avail
+ else:
+ avail = total - used
+ entry["total"] = total / 1024.0
+ entry["used"] = used / 1024.0
+ entry["available"] = avail / 1024.0
df_parsed[mountpoint] = entry
# Now remove duplicate entries for the root filesystem, such