Module: check_mk
Branch: master
Commit: 63b7ef6510eb54952d1fb37232ffeb3e42bc531e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=63b7ef6510eb54…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu May 3 15:39:49 2012 +0200
WATO: make notification_interval configurable
---
web/htdocs/valuespec.py | 17 +++++++------
web/plugins/wato/check_mk_configuration.py | 36 ++++++++++++++++++++++++++++
2 files changed, 45 insertions(+), 8 deletions(-)
diff --git a/web/htdocs/valuespec.py b/web/htdocs/valuespec.py
index 5a29b85..a1ecff0 100644
--- a/web/htdocs/valuespec.py
+++ b/web/htdocs/valuespec.py
@@ -1341,19 +1341,20 @@ class Optional(ValueSpec):
self._label = kwargs.get("label")
self._negate = kwargs.get("negate", False)
self._none_label = kwargs.get("none_label", _("(unset)"))
+ self._none_value = kwargs.get("none_value", None)
self._sameline = kwargs.get("sameline", False)
def canonical_value(self):
- return None
+ return self._none_value
def render_input(self, varprefix, value):
div_id = "option_" + varprefix
checked = html.get_checkbox(varprefix + "_use")
if checked == None:
if self._negate:
- checked = value == None
+ checked = value == self._none_value
else:
- checked = value != None
+ checked = value != self._none_value
html.write("<span>")
@@ -1382,7 +1383,7 @@ class Optional(ValueSpec):
display = ""
html.write('<span id="%s" style="display: %s">'
% (div_id, display))
- if value == None:
+ if value == self._none_value:
value = self._valuespec.default_value()
if self._valuespec.title():
html.write(self._valuespec.title() + " ")
@@ -1390,7 +1391,7 @@ class Optional(ValueSpec):
html.write('</span>\n')
def value_to_text(self, value):
- if value == None:
+ if value == self._none_value:
return self._none_label
else:
return self._valuespec.value_to_text(value)
@@ -1399,14 +1400,14 @@ class Optional(ValueSpec):
if html.get_checkbox(varprefix + "_use") != self._negate:
return self._valuespec.from_html_vars(varprefix + "_value")
else:
- return None
+ return self._none_value
def validate_datatype(self, value, varprefix):
- if value != None:
+ if value != self._none_value:
self._valuespec.validate_datatype(value, varprefix + "_value")
def validate_value(self, value, varprefix):
- if value != None:
+ if value != self._none_value:
self._valuespec.validate_value(value, varprefix + "_value")
# Handle case when there are several possible allowed formats
diff --git a/web/plugins/wato/check_mk_configuration.py
b/web/plugins/wato/check_mk_configuration.py
index 61a5d93..ad6fbf1 100644
--- a/web/plugins/wato/check_mk_configuration.py
+++ b/web/plugins/wato/check_mk_configuration.py
@@ -669,6 +669,42 @@ register_rule(group,
"as the 'service time'.")),
itemtype = "service")
+register_rule(group,
+ "extra_host_conf:notification_interval",
+ Optional(
+ Integer(
+ minvalue = 1,
+ default_value = 120,
+ label = _("Interval:"),
+ unit = _("minutes")),
+ title = _("Periodic notifications during host problems"),
+ help = _("If you enable periodic notifications, then during a problem state
"
+ "of the host notifications will be sent out in regular intervals
"
+ "until the problem is acknowledged."),
+ label = _("Enable periodic notifications"),
+ none_label = _("disabled"),
+ none_value = 0,
+ )
+ )
+
+register_rule(group,
+ "extra_service_conf:notification_interval",
+ Optional(
+ Integer(
+ minvalue = 1,
+ default_value = 120,
+ label = _("Interval:"),
+ unit = _("minutes")),
+ title = _("Periodic notifications during service problems"),
+ help = _("If you enable periodic notifications, then during a problem state
"
+ "of the service notifications will be sent out in regular intervals
"
+ "until the problem is acknowledged."),
+ label = _("Enable periodic notifications"),
+ none_label = _("disabled"),
+ none_value = 0,
+ ),
+ itemtype = "service")
+
group = "monconf/Inventory and Check_MK settings"
register_rule(group,