Module: check_mk
Branch: master
Commit: 2e4781c46da7d6b423cd2b2438876c6d37a8372b
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=2e4781c46da7d6…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Nov 17 12:34:48 2016 +0100
4044 Display host/service notification delay with d/h/m/s, not with fractions of minute
---
.werks/4044 | 9 +++++++++
ChangeLog | 1 +
web/plugins/wato/check_mk_configuration.py | 26 +++++++++++++++++---------
3 files changed, 27 insertions(+), 9 deletions(-)
diff --git a/.werks/4044 b/.werks/4044
new file mode 100644
index 0000000..9e3c3b3
--- /dev/null
+++ b/.werks/4044
@@ -0,0 +1,9 @@
+Title: Display host/service notification delay with d/h/m/s, not with fractions of
minute
+Level: 1
+Component: wato
+Compatible: compat
+Version: 1.4.0i3
+Date: 1479382462
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index ed38bbe..3667e80 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -27,6 +27,7 @@
WATO:
* 3984 Permissions can now be filtered by providing a search term on the "edit
role" page...
+ * 4044 Display host/service notification delay with d/h/m/s, not with fractions of
minute
* 4039 FIX: Fix UnicodeEncodeError exception in WATO folder display...
* 4041 FIX: Fix exception when editing global configuration settings...
* 3975 FIX: Improved error handling when trying to edit not existing global setting
diff --git a/web/plugins/wato/check_mk_configuration.py
b/web/plugins/wato/check_mk_configuration.py
index c3ca5b2..13db28f 100644
--- a/web/plugins/wato/check_mk_configuration.py
+++ b/web/plugins/wato/check_mk_configuration.py
@@ -1601,20 +1601,26 @@ register_rule(group,
itemtype = "service")
+def transform_float_minutes_to_age(float_minutes):
+ return int(float_minutes * 60)
+
+def transform_age_to_float_minutes(age):
+ return float(age) / 60.0
+
register_rule(group,
"extra_host_conf:first_notification_delay",
Transform(
- Float(
- minvalue = 0.0,
- default_value = 60.0,
+ Age(
+ minvalue = 0,
+ default_value = 300,
label = _("Delay:"),
- unit = _("minutes"),
title = _("Delay host notifications"),
help = _("This setting delays notifications about host problems by the
"
"specified amount of time. If the host is up again within that
"
"time, no notification will be sent out."),
),
- forth = lambda x: float(x),
+ forth = transform_float_minutes_to_age,
+ back = transform_age_to_float_minutes,
),
factory_default = 0.0,
)
@@ -1622,9 +1628,9 @@ register_rule(group,
register_rule(group,
"extra_service_conf:first_notification_delay",
Transform(
- Float(
- minvalue = 0.0,
- default_value = 60.0,
+ Age(
+ minvalue = 0,
+ default_value = 300,
label = _("Delay:"),
unit = _("minutes"),
title = _("Delay service notifications"),
@@ -1632,11 +1638,13 @@ register_rule(group,
"specified amount of time. If the service is OK again within
that "
"time, no notification will be sent out."),
),
- forth = lambda x: float(x),
+ forth = transform_float_minutes_to_age,
+ back = transform_age_to_float_minutes,
),
factory_default = 0.0,
itemtype = "service")
+
register_rule(group,
"extra_host_conf:notification_interval",
Optional(