Module: check_mk
Branch: master
Commit: 3e41714432d8788b71cfce0e931e226afb6f01f3
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3e41714432d878…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Jan 27 13:50:03 2016 +0100
#2972 FIX df: Filesystem trends: Outputting less senseless time left in case of nearly 0
growth
---
.werks/2972 | 9 +++++++++
ChangeLog | 1 +
checks/df.include | 6 +++++-
3 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/.werks/2972 b/.werks/2972
new file mode 100644
index 0000000..f20e38f
--- /dev/null
+++ b/.werks/2972
@@ -0,0 +1,9 @@
+Title: df: Filesystem trends: Outputting less senseless time left in case of nearly 0
growth
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i4
+Date: 1453898951
+Class: fix
+
+
diff --git a/ChangeLog b/ChangeLog
index 49f7d06..dc1a5dd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -225,6 +225,7 @@
* 2963 FIX: esx_vsphere_datastores: Deal with empty url attribute of datastores
* 2983 FIX: netapp_api_disk: fixed exception when disks were not included in the
raid...
* 2971 FIX: heartbeat_crm: Is now compatible with more forms of crm_mon output
formats
+ * 2972 FIX: df: Filesystem trends: Outputting less senseless time left in case of
nearly 0 growth
Multisite:
* 2684 Added icons for downloading agent data / walks of hosts...
diff --git a/checks/df.include b/checks/df.include
index 4b81861..90696af 100644
--- a/checks/df.include
+++ b/checks/df.include
@@ -439,7 +439,11 @@ def df_check_filesystem_single(hostname, mountpoint, size_mb,
avail_mb, reserved
hours_left = space_left / trend * range
timeleft = levels.get("trend_timeleft")
def format_hours(hours):
- if hours > 4 * 7 * 24: # 4 weeks
+ if hours > 365 * 24:
+ return "more than a year"
+ elif hours > 90 * 24:
+ return "%0d months" % (hours/ (30 * 24))
+ elif hours > 4 * 7 * 24: # 4 weeks
return "%0d weeks" % (hours/ (7 * 24))
elif hours > 7 * 24: # 1 week
return "%0.1f weeks" % (hours/ (7 * 24))