Module: check_mk
Branch: master
Commit: f1d55d4b5ca2eadebfcd6080040a9ac27c6b3d23
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f1d55d4b5ca2ea…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Apr 13 12:19:39 2012 +0200
Fixed logwatch patterns spec
---
checks/logwatch | 9 ++---
web/htdocs/wato.py | 6 ++--
web/plugins/wato/check_parameters.py | 55 ++++++++++++++++-----------------
3 files changed, 34 insertions(+), 36 deletions(-)
diff --git a/checks/logwatch b/checks/logwatch
index a0194a7..7714d87 100644
--- a/checks/logwatch
+++ b/checks/logwatch
@@ -93,12 +93,11 @@ def logwatch_level_worst(worst, level):
# Extracts patterns that are relevant for the current host and item.
# Constructs simple list of pairs: [ ('W', 'crash.exe'), ('C',
'sshd.*test') ]
-def logwatch_precompile(hostname, item, params):
- # First load the logwatch_rules var (used by WATO)
- rules = get_checkgroup_parameters(hostname, 'logwatch', item)
-
- # Initialize params with these rules but remove the comment
+def logwatch_precompile(hostname, item, _unused):
+ # Initialize the patterns list with the logwatch_rules
params = []
+ description = check_info['logwatch']['service_description'] % item
+ rules = service_extra_conf(hostname, description, logwatch_rules)
for rule in rules:
for pattern in rule:
params.append((pattern[0], pattern[1]))
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 9d9a229..1b3a234 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -9936,7 +9936,7 @@ def mode_pattern_editor(phase):
html.context_button(_('Edit Logfile Rules'), make_link([
('mode', 'edit_ruleset'),
- ('varname', 'checkgroup_parameters:logwatch')
+ ('varname', 'logwatch_rules')
]),
'edit'
)
@@ -9989,7 +9989,7 @@ def mode_pattern_editor(phase):
html.show_user_errors()
return
- varname = 'checkgroup_parameters:logwatch'
+ varname = 'logwatch_rules'
rulespec = g_rulespecs[varname]
all_rulesets = load_all_rulesets()
ruleset = all_rulesets.get(varname)
@@ -10001,7 +10001,7 @@ def mode_pattern_editor(phase):
+ _('There are no logfile patterns defined. You may create '
'logfile patterns using the <a href="%s">Rule
Editor</a>.') % make_link([
('mode', 'edit_ruleset'),
- ('varname', 'checkgroup_parameters:logwatch')
+ ('varname', 'logwatch_rules')
])
+ "</div>"
)
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index dc738b1..0ee56cc 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -91,31 +91,10 @@ register_rule(group + "/" + subgroup_networking,
]),
match="dict")
-checkgroups = []
-
-checkgroups.append((
- subgroup_windows,
- "ad_replication",
- _("Active Directory Replication"),
- Tuple(
- help = _("The number of replication failures"),
- elements = [
- Integer(title = _("Warning at"), unit = _("failures")),
- Integer(title = _("Critical at"), unit = _("failures")),
- ]
- ),
- TextAscii(
- title = _("Replication Partner"),
- help = _("The name of the replication partner (Destination DC
Site/Destination DC)."),
- ),
- "first"
-))
-
-checkgroups.append((
- subgroup_applications,
- "logwatch",
- _("Logfile patterns"),
- ListOf(
+register_rule(group + '/' + subgroup_applications,
+ varname = "logwatch_rules",
+ title = _('Logwatch Patterns'),
+ valuespec = ListOf(
Tuple(
help = _("This defines one logfile pattern rule"),
show_titles = True,
@@ -146,11 +125,31 @@ checkgroups.append((
'to test the rules you defined here.'),
add_label = _("Add pattern"),
),
+ itemtype = 'item',
+ itemname = 'logfile',
+ itemhelp = _("One or several regular expressions for matching logfile
lines."),
+ match = 'list',
+)
+
+
+checkgroups = []
+
+checkgroups.append((
+ subgroup_windows,
+ "ad_replication",
+ _("Active Directory Replication"),
+ Tuple(
+ help = _("The number of replication failures"),
+ elements = [
+ Integer(title = _("Warning at"), unit = _("failures")),
+ Integer(title = _("Critical at"), unit = _("failures")),
+ ]
+ ),
TextAscii(
- title = _("logfile"),
- help = _("One or several regular expressions for matching logfile
lines."),
+ title = _("Replication Partner"),
+ help = _("The name of the replication partner (Destination DC
Site/Destination DC)."),
),
- 'first',
+ "first"
))
checkgroups.append((