Module: check_mk
Branch: master
Commit: 18047e65fa54d31d70af24a3a5cb820c91c1b6a0
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=18047e65fa54d3…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Dec 25 12:15:47 2012 +0100
Reverse order of Condition, Value and General options in rule editor
---
ChangeLog | 1 +
web/htdocs/wato.py | 56 ++++++++++++++++++------------------
web/plugins/wato/active_checks.py | 4 +-
3 files changed, 31 insertions(+), 30 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index aef65b6..b44c6c1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -77,6 +77,7 @@
* The rules formular now uses POST as transaction method
* Modularized the authentication and user management code
* Default config: add contact group 'all' and put all hosts into it
+ * Reverse order of Condition, Value and General options in rule editor
Event Console:
* FIX: fix exception in rules that use facility local7
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 548c510..1bc25e3 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -9382,7 +9382,7 @@ def change_host_tags_in_rules(folder, operations, mode):
# '----------------------------------------------------------------------'
vs_rule_options = Dictionary(
- title = _("General options"),
+ title = _("Additional options"),
optional_keys = False,
render = "form",
elements = [
@@ -9397,7 +9397,7 @@ vs_rule_options = Dictionary(
),
( "docu_url",
TextAscii(
- title = _("Docu-URL"),
+ title = _("Documentation-URL"),
help = _("An optional URL pointing to documentation or any other page. This will be displayed "
"as an icon <img class=icon src='images/button_url_lo.png'> and open a new page when clicked. "
"You can use either global URLs (beginning with <tt>http://</tt>), absolute local urls "
@@ -10271,7 +10271,7 @@ def mode_edit_rule(phase, new = False):
if phase == "action":
if html.check_transaction():
- # General options
+ # Additional options
rule_options = vs_rule_options.from_html_vars("options")
vs_rule_options.validate_value(rule_options, "options")
@@ -10322,34 +10322,10 @@ def mode_edit_rule(phase, new = False):
return ("edit_ruleset", _("%s rule in ruleset '%s' in folder %s") %
(new and _("Created new") or _("Edited"), rulespec["title"], new_rule_folder["title"]))
- html.help(rulespec["help"])
+ html.write("<div class=info>" + rulespec["help"] + "</div>")
html.begin_form("rule_editor", method="POST")
- # Rule Options
- vs_rule_options.render_input("options", rule_options)
-
- # Value
- forms.header(_("Value"))
- if valuespec:
- value = rule[0]
- forms.section()
- try:
- valuespec.validate_datatype(value, "ve")
- valuespec.render_input("ve", value)
- except:
- if config.debug:
- raise
- valuespec.render_input("ve", valuespec.default_value())
-
- valuespec.set_focus("ve")
- else:
- forms.section("")
- for posneg, img in [ ("positive", "yes"), ("negative", "no")]:
- val = img == "yes"
- html.write('<img class=ruleyesno align=top src="images/rule_%s.png"> ' % img)
- html.radiobutton("value", img, value == val, _("Make the outcome of the ruleset <b>%s</b><br>") % posneg)
-
# Conditions
forms.header(_("Conditions"))
@@ -10438,6 +10414,30 @@ def mode_edit_rule(phase, new = False):
"For example C:\\\\tmp\\\\message.log"))
html.write("</div>")
+ # Value
+ forms.header(_("Value"))
+ if valuespec:
+ value = rule[0]
+ forms.section()
+ try:
+ valuespec.validate_datatype(value, "ve")
+ valuespec.render_input("ve", value)
+ except:
+ if config.debug:
+ raise
+ valuespec.render_input("ve", valuespec.default_value())
+
+ valuespec.set_focus("ve")
+ else:
+ forms.section("")
+ for posneg, img in [ ("positive", "yes"), ("negative", "no")]:
+ val = img == "yes"
+ html.write('<img class=ruleyesno align=top src="images/rule_%s.png"> ' % img)
+ html.radiobutton("value", img, value == val, _("Make the outcome of the ruleset <b>%s</b><br>") % posneg)
+
+ # Addiitonal rule options
+ vs_rule_options.render_input("options", rule_options)
+
forms.end()
html.button("save", _("Save"))
html.hidden_fields()
diff --git a/web/plugins/wato/active_checks.py b/web/plugins/wato/active_checks.py
index 5bba69a..676d3ce 100644
--- a/web/plugins/wato/active_checks.py
+++ b/web/plugins/wato/active_checks.py
@@ -33,8 +33,8 @@ register_rule(group,
"active_checks:dns",
Tuple(
title = _("Check DNS service"),
- help = _("Check optain an IP address for a host or domain"
- "It uses <tt>check_dns</tt> from standard plugins."),
+ help = _("Check the resultion of a hostname into an IP address by a DNS server. "
+ "This check uses <tt>check_dns</tt> from the standard Nagios plugins."),
elements = [
TextAscii(title = _("Hostname"), allow_empty = False,
help = _('The name or address you want to query')),
Module: check_mk
Branch: master
Commit: 17ac1741006370922b9ce4c33e3d6ccdb60a1515
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=17ac1741006370…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Dec 25 12:01:50 2012 +0100
WATO: remove trivial docu_url when saving
---
web/htdocs/wato.py | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 89189e5..cf5f598 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -10086,16 +10086,20 @@ def construct_rule(ruleset, value, tag_specs, host_list, item_list, rule_options
if item_list != None:
rule.append(item_list)
- # Append rule options, but only if they are not trivial
+ # Append rule options, but only if they are not trivial. That way we
+ # keep as close as possible to the original Check_MK in rules.mk so that
+ # command line users will feel at home...
ro = {}
if rule_options.get("disabled"):
ro["disabled"] = True
if rule_options.get("comment"):
ro["comment"] = rule_options["comment"]
+ if rule_options.get("docu_url"):
+ ro["docu_url"] = rule_options["docu_url"]
# Preserve other keys that we do not know of
for k,v in rule_options.items():
- if k not in [ "disabled", "comment"] :
+ if k not in [ "disabled", "comment", "docu_url"]:
ro[k] = v
if ro:
rule.append(ro)
Module: check_mk
Branch: master
Commit: fe3238c26a4a257b872e5736b9834446b2bb65a9
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=fe3238c26a4a25…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Dec 25 11:28:53 2012 +0100
Default config: add contact group 'all' and put all hosts into it
---
ChangeLog | 3 ++-
web/htdocs/wato.py | 43 ++++++++++++++++++++++++++++++++-----------
2 files changed, 34 insertions(+), 12 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index ea48465..aef65b6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -48,7 +48,6 @@
users using the form based authentication with LDAP. It is also possible
to synchronize some attributes like mail addresses, names and roles from
LDAP into multisite.
- * Modularized the authentication and user management code in WATO
* Restructured cookie auth cookies (all auth cookies will be invalid
after update -> all users have to login again)
* Modularized login and cookie validation
@@ -76,6 +75,8 @@
* FIX: Persisting changing of folder titles when only the title has changed
* Add: Creating a new rule immediately opens its edit formular
* The rules formular now uses POST as transaction method
+ * Modularized the authentication and user management code
+ * Default config: add contact group 'all' and put all hosts into it
Event Console:
* FIX: fix exception in rules that use facility local7
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 08cb129..f8e0342 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -5653,7 +5653,8 @@ def mode_groups(phase, what):
global_buttons()
html.context_button(_("New group"), make_link([("mode", "edit_%s_group" % what)]), "new")
if what == "contact":
- pass
+ html.context_button(_("Rules"), make_link([("mode", "rulesets"),
+ ("filled_in", "search"), ("search", "contact group")]), "rulesets")
else:
varname = what + "_groups"
html.context_button(_("Rules"), make_link([("mode", "edit_ruleset"), ("varname", varname)]), "rulesets")
@@ -10950,14 +10951,22 @@ def page_user_profile():
# | Functions for creating an example configuration |
# '----------------------------------------------------------------------'
-# Create a very basic sample configuration, but only if no host tags
-# or rules have been defined *ever*.
+# Create a very basic sample configuration, but only if none of the
+# files that we will create already exists. That is e.g. the case
+# after an update from an older version where no sample config had
+# been created.
def create_sample_config():
if os.path.exists(multisite_dir + "hosttags.mk") \
- or os.path.exists(root_dir + "rules.mk"):
+ or os.path.exists(root_dir + "rules.mk") \
+ or os.path.exists(root_dir + "groups.mk"):
return
- # Example values for host tags
+ # A contact group where everyone is member of
+ groups = {
+ "contact" : { 'all', u'Everybody' },
+ }
+
+ # Basic setting of host tags
wato_host_tags = \
[('agent',
u'Agent type',
@@ -10984,17 +10993,29 @@ def create_sample_config():
save_hosttags(wato_host_tags, wato_aux_tags)
- # Example values for rules
+ # Rules that match the upper host tag definition
rulesets = {
+ # Make the tag 'offline' remove hosts from the monitoring
'only_hosts': [
- (['!offline'], ['@all'])],
- 'ping_levels': [
+ (['!offline'], ['@all'],
+ {'comment': u'Do not monitor hosts with the tag "offline"'})],
+
+ # Rule for WAN hosts with adapted PING levels
+ 'ping_levels': [
({'loss': (80.0, 100.0),
'packets': 6,
'rta': (1500.0, 3000.0),
- 'timeout': 20}, ['wan'], ['@all'])],
- 'bulkwalk_hosts': [
- (['!snmp-v1'], ['@all'])],
+ 'timeout': 20}, ['wan'], ['@all'],
+ {'comment': u'Allow longer round trip times when pinging WAN hosts'})],
+
+ # All hosts should use SNMP v2c if not specially tagged
+ 'bulkwalk_hosts': [
+ (['!snmp-v1'], ['@all'], {'comment': u'Hosts with the tag "snmp-v1" must not use bulkwalk'})],
+
+ # Put all hosts and the contact group 'all'
+ 'host_contactgroups': [
+ ('all', [], ALL_HOSTS, {'comment': u'Put all hosts into the contact group "all"'} ),
+ ]
}
save_rulesets(g_root_folder, rulesets)
Module: check_mk
Branch: master
Commit: 0b6b8004d58cf66de4e9cb20b5d55243b70518a1
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=0b6b8004d58cf6…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Dec 25 11:48:12 2012 +0100
Disable notification per default for new users
Now you can edit and save omdadmin without an error message or
changing something of the status quo
---
web/htdocs/wato.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index aa84a62..a7a229a 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -8148,7 +8148,7 @@ def mode_edit_user(phase):
forms.header(_("Notifications"), isopen=False)
forms.section(_("Enabling"), simple=True)
- html.checkbox("notifications_enabled", user.get("notifications_enabled", True),
+ html.checkbox("notifications_enabled", user.get("notifications_enabled", False),
label = _("enable notifications"))
html.help(_("Notifications are sent out "
"when the status of a host or service changes."))