Module: check_mk
Branch: master
Commit: 46eae19c6aabe084cf7b5c5aeacd883ed9d3ce67
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=46eae19c6aabe0…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Dec 3 10:49:28 2014 +0100
#1562 Move manual checks into a new WATO module
The rulesets for configuration manual checks (i.e. checks not created by the service
discovery) have been moved into a new WATO module <i>Manual Checks</i>. This
should
save users from accidentally using these rules instead of their counterparts for
invetorized checks.
---
.werks/1562 | 12 ++++++++++++
ChangeLog | 1 +
web/htdocs/images/icon_static_checks.png | Bin 0 -> 3242 bytes
web/htdocs/wato.py | 28 +++++++++++++++++++++++-----
web/plugins/wato/builtin_modules.py | 3 +++
5 files changed, 39 insertions(+), 5 deletions(-)
diff --git a/.werks/1562 b/.werks/1562
new file mode 100644
index 0000000..9759232
--- /dev/null
+++ b/.werks/1562
@@ -0,0 +1,12 @@
+Title: Move manual checks into a new WATO module
+Level: 2
+Component: wato
+Compatible: compat
+Version: 1.2.5i7
+Date: 1417599830
+Class: feature
+
+The rulesets for configuration manual checks (i.e. checks not created by the service
+discovery) have been moved into a new WATO module <i>Manual Checks</i>. This
should
+save users from accidentally using these rules instead of their counterparts for
+invetorized checks.
diff --git a/ChangeLog b/ChangeLog
index ee7258c..01bbdca 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -108,6 +108,7 @@
* 1587 SEC: Prevent logging of passwords during initial distributed site login...
* 1560 Put host and service groups into one WATO menu item...
* 1561 Remove Auditlog from the main WATO menu and put it into the activate Changes
page
+ * 1562 Move manual checks into a new WATO module...
* 1165 FIX: Fixed exception in service discovery of logwatch event console forwarding
checks...
* 1490 FIX: Timperiod excludes can now even be configured when creating a
timeperiod...
* 1491 FIX: Fixed bug in dynamic lists where removing an item was not always
possible...
diff --git a/web/htdocs/images/icon_static_checks.png
b/web/htdocs/images/icon_static_checks.png
new file mode 100644
index 0000000..b7b58ee
Binary files /dev/null and b/web/htdocs/images/icon_static_checks.png differ
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 2132e18..a626574 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -834,6 +834,7 @@ def mode_folder(phase):
global_buttons()
if config.may("wato.rulesets") or config.may("wato.seeall"):
html.context_button(_("Rulesets"),
make_link([("mode", "ruleeditor")]), "rulesets")
+ html.context_button(_("Manual Checks"),
make_link([("mode", "static_checks")]), "static_checks")
if auth_read:
html.context_button(_("Folder Properties"),
make_link_to([("mode", "editfolder")], g_folder), "edit")
if not g_folder.get(".lock_subfolders") and
config.may("wato.manage_folders") and auth_write:
@@ -13587,6 +13588,8 @@ def mode_ruleeditor(phase):
title = _("Used Rulesets")
help = _("Show only modified rulesets<br>(all rulesets with at
least one rule)")
icon = "usedrulesets"
+ elif groupname == "static": # these have moved into their own WATO
module
+ continue
else:
title, help = g_rulegroups.get(groupname, (groupname, ""))
icon = "rulesets"
@@ -13749,9 +13752,14 @@ def mode_ineffective_rules(phase):
html.write('</div>')
return
+def mode_static_checks(phase):
+ return mode_rulesets(phase, "static")
+
+
+def mode_rulesets(phase, group=None):
+ if not group:
+ group = html.var("group") # obligatory
-def mode_rulesets(phase):
- group = html.var("group") # obligatory
search = html.var("search")
if search != None:
search = search.strip().lower()
@@ -13760,6 +13768,10 @@ def mode_rulesets(phase):
title = _("Used Rulesets")
help = _("Non-empty rulesets")
only_used = True
+ elif group == "static":
+ title = _("Manual Checks")
+ help = _("Here you can create explicit checks that are not being created by
the automatic service discovery.")
+ only_used = False
elif search != None:
title = _("Rules matching ") + search
help = _("All rules that contain '%s' in their name") % search
@@ -13780,12 +13792,14 @@ def mode_rulesets(phase):
elif phase == "buttons":
if only_host:
home_button()
- html.context_button(_("All Rulesets"),
make_link([("mode", "ruleeditor"), ("host", only_host)]),
"back")
+ if group != "static":
+ html.context_button(_("All Rulesets"),
make_link([("mode", "ruleeditor"), ("host", only_host)]),
"back")
html.context_button(only_host,
make_link([("mode", "edithost"), ("host",
only_host)]), "host")
else:
global_buttons()
- html.context_button(_("All Rulesets"),
make_link([("mode", "ruleeditor")]), "back")
+ if group != "static":
+ html.context_button(_("All Rulesets"),
make_link([("mode", "ruleeditor")]), "back")
if config.may("wato.hosts") or
config.may("wato.seeall"):
html.context_button(_("Folder"), make_link([("mode",
"folder")]), "folder")
return
@@ -13818,7 +13832,7 @@ def mode_rulesets(phase):
# Select matching rule groups while keeping their configured order
groupnames = [ gn for gn, rulesets in g_rulespec_groups
- if only_used or search != None or gn == group or gn.startswith(group +
"/") ]
+ if only_used or search or gn == group or gn.startswith(group +
"/") ]
# In case of search we need to sort the groups since main chapters would
# appear more than once otherwise.
@@ -13853,6 +13867,9 @@ def mode_rulesets(phase):
and search not in varname:
continue
+ if search != None and groupname.startswith("static/"):
+ continue # search must not find these
+
# Handle case where a host is specified
rulespec = g_rulespecs[varname]
@@ -18208,6 +18225,7 @@ modes = {
"edit_configvar" : (["global"], mode_edit_configvar),
"ldap_config" : (["global"], mode_ldap_config),
"ruleeditor" : (["rulesets"], mode_ruleeditor),
+ "static_checks" : (["rulesets"], mode_static_checks),
"rulesets" : (["rulesets"], mode_rulesets),
"ineffective_rules" : (["rulesets"], mode_ineffective_rules),
"edit_ruleset" : (["rulesets"], mode_edit_ruleset),
diff --git a/web/plugins/wato/builtin_modules.py b/web/plugins/wato/builtin_modules.py
index d337e8b..5a6daaa 100644
--- a/web/plugins/wato/builtin_modules.py
+++ b/web/plugins/wato/builtin_modules.py
@@ -43,6 +43,9 @@ modules += [
_("Check parameters and other configuration variables on "
"hosts and services") ),
+ ( "static_checks", _("Manual Checks"),
"static_checks", "rulesets",
+ _("Configure fixed checks without using service discovery")),
+
( "host_groups", _("Host & Service Groups"),
"hostgroups", "groups",
_("Organize your hosts and services in groups independent of the tree
structure.") ),