Module: check_mk
Branch: master
Commit: 174d2e206770b231b46d888dde6ebcbd739c9e00
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=174d2e206770b2…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Feb 16 18:25:15 2018 +0100
Cleaned up special case from age_human_readable()
Change-Id: Icbc0cee746d8cff5afc101c49ca32a8da425fc57
---
web/htdocs/lib.py | 10 +++++-----
web/plugins/perfometer/check_mk.py | 3 +--
2 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/web/htdocs/lib.py b/web/htdocs/lib.py
index 984aeff..7c98ba0 100644
--- a/web/htdocs/lib.py
+++ b/web/htdocs/lib.py
@@ -354,26 +354,26 @@ def number_human_readable(n, precision=1, unit="B"):
return (f + "%s") % (n, unit)
-def age_human_readable(secs, min_only=False):
+def age_human_readable(secs):
if secs < 0:
- return "- " + age_human_readable(-secs, min_only)
+ return "- " + age_human_readable(-secs)
elif secs > 0 and secs < 1: # ms
return physical_precision(secs, 3, _("s"))
- elif min_only:
- mins = secs / 60.0
- return "%.1f %s" % (mins, _("m"))
elif secs < 10:
return "%.2f %s" % (secs, _("s"))
elif secs < 60:
return "%.1f %s" % (secs, _("s"))
elif secs < 240:
return "%d %s" % (secs, _("s"))
+
mins = secs / 60
if mins < 360:
return "%d %s" % (mins, _("m"))
+
hours = mins / 60
if hours < 48:
return "%d %s" % (hours, _("h"))
+
days = hours / 24.0
if days < 6:
d = ("%.1f" % days).rstrip("0").rstrip(".")
diff --git a/web/plugins/perfometer/check_mk.py b/web/plugins/perfometer/check_mk.py
index b89a44f..c5d845a 100644
--- a/web/plugins/perfometer/check_mk.py
+++ b/web/plugins/perfometer/check_mk.py
@@ -1058,8 +1058,7 @@ def perfometer_veeam_client(row, check_command, perf_data):
h = perfometer_logarithmic_dual_independent(avgspeed_bytes, '#54b948',
10000000, 2, duration_secs, '#2098cb', 500, 2)
avgspeed = cmk.render.bytes(avgspeed_bytes)
- # Return Value always as minutes
- duration = age_human_readable(duration_secs, True)
+ duration = age_human_readable(duration_secs)
return "%s/s %s" % (avgspeed, duration), h