Module: check_mk
Branch: master
Commit: 5ca9a03d782636e8513aa4ba7e38b0c56acf1221
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5ca9a03d782636…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Oct 20 10:26:31 2017 +0200
Little more consistent formating of seconds in host/service detail view
Change-Id: Ia69f1de0e213b44e98ef93fbb90f2031bc5a75d5
---
web/plugins/views/painters.py | 28 +++++++++++++++-------------
1 file changed, 15 insertions(+), 13 deletions(-)
diff --git a/web/plugins/views/painters.py b/web/plugins/views/painters.py
index a23ddf8..611988f 100644
--- a/web/plugins/views/painters.py
+++ b/web/plugins/views/painters.py
@@ -876,14 +876,14 @@ multisite_painters["svc_check_latency"] = {
"title" : _("Service check latency"),
"short" : _("Latency"),
"columns" : [ "service_latency" ],
- "paint" : lambda row: ("", "%.3f sec" %
row["service_latency"]),
+ "paint" : lambda row: ("",
age_human_readable(row["service_latency"])),
}
multisite_painters["svc_check_duration"] = {
"title" : _("Service check duration"),
"short" : _("Duration"),
"columns" : [ "service_execution_time" ],
- "paint" : lambda row: ("", "%.3f sec" %
row["service_execution_time"]),
+ "paint" : lambda row: ("",
age_human_readable(row["service_execution_time"])),
}
multisite_painters["svc_attempt"] = {
@@ -897,27 +897,28 @@ multisite_painters["svc_normal_interval"] = {
"title" : _("Service normal check interval"),
"short" : _("Check int."),
"columns" : [ "service_check_interval" ],
- "paint" : lambda row: ("number", "%.0fs" %
(row["service_check_interval"] * 60.0)),
+ "paint" : lambda row: ("number",
age_human_readable(row["service_check_interval"] * 60.0)),
}
multisite_painters["svc_retry_interval"] = {
"title" : _("Service retry check interval"),
"short" : _("Retry"),
"columns" : [ "service_retry_interval" ],
- "paint" : lambda row: ("number", "%.0fs" %
(row["service_retry_interval"] * 60.0)),
+ "paint" : lambda row: ("number",
age_human_readable(row["service_retry_interval"] * 60.0)),
}
multisite_painters["svc_check_interval"] = {
"title" : _("Service normal/retry check interval"),
"short" : _("Interval"),
"columns" : [ "service_check_interval",
"service_retry_interval" ],
- "paint" : lambda row: (None, "%.0fs/%.0fs" % (
- row["service_check_interval"] * 60.0,
row["service_retry_interval"] * 60.0)),
+ "paint" : lambda row: (None, "%s / %s" % (
+ age_human_readable(row["service_check_interval"] * 60.0),
+ age_human_readable(row["service_retry_interval"] * 60.0))),
}
multisite_painters["svc_check_type"] = {
"title" : _("Service check type"),
"short" : _("Type"),
"columns" : [ "service_check_type" ],
- "paint" : lambda row: (None, row["service_check_type"] == 0 and
"ACTIVE" or "PASSIVE"),
+ "paint" : lambda row: (None, _("ACTIVE") if
row["service_check_type"] == 0 else _("PASSIVE")),
}
def paint_nagiosflag(row, field, bold_if_nonzero):
@@ -1344,14 +1345,14 @@ multisite_painters["host_check_latency"] = {
"title" : _("Host check latency"),
"short" : _("Latency"),
"columns" : [ "host_latency" ],
- "paint" : lambda row: ("", "%.3f sec" %
row["host_latency"]),
+ "paint" : lambda row: ("",
age_human_readable(row["host_latency"])),
}
multisite_painters["host_check_duration"] = {
"title" : _("Host check duration"),
"short" : _("Duration"),
"columns" : [ "host_execution_time" ],
- "paint" : lambda row: ("", "%.3f sec" %
row["host_execution_time"]),
+ "paint" : lambda row: ("",
age_human_readable(row["host_execution_time"])),
}
multisite_painters["host_attempt"] = {
@@ -1365,20 +1366,21 @@ multisite_painters["host_normal_interval"] = {
"title" : _("Normal check interval"),
"short" : _("Check int."),
"columns" : [ "host_check_interval" ],
- "paint" : lambda row: (None, "%.0fs" %
(row["host_check_interval"] * 60.0)),
+ "paint" : lambda row: (None,
age_human_readable(row["host_check_interval"] * 60.0)),
}
multisite_painters["host_retry_interval"] = {
"title" : _("Retry check interval"),
"short" : _("Retry"),
"columns" : [ "host_retry_interval" ],
- "paint" : lambda row: (None, "%.0fs" %
(row["host_retry_interval"] * 60.0)),
+ "paint" : lambda row: (None,
age_human_readable(row["host_retry_interval"] * 60.0)),
}
multisite_painters["host_check_interval"] = {
"title" : _("Normal/retry check interval"),
"short" : _("Interval"),
"columns" : [ "host_check_interval",
"host_retry_interval" ],
- "paint" : lambda row: (None, "%.0fs/%.0fs" % (
- row["host_check_interval"] * 60.0,
row["host_retry_interval"] * 60.0)),
+ "paint" : lambda row: (None, "%s / %s" % (
+ age_human_readable(row["host_check_interval"] * 60.0),
+ age_human_readable(row["host_retry_interval"] * 60.0))),
}
multisite_painters["host_check_type"] = {