Module: check_mk
Branch: master
Commit: a3d447cf0ae465225a32634d2f38e3780c046844
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a3d447cf0ae465…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Dec 17 12:47:58 2013 +0100
Active HTTP check now supports multiline regexp matching
Previous versions of the configuration form did not provide the
option to form regex patterns accross multi lines. The used
check_http plugin provides the option "-l" to realize this. The
WATO form now has a checkbox to make it possible to use this.
---
.werks/382 | 13 +++++++++++++
ChangeLog | 1 +
checks/check_http | 2 ++
web/plugins/wato/active_checks.py | 23 ++++++++++++++---------
4 files changed, 30 insertions(+), 9 deletions(-)
diff --git a/.werks/382 b/.werks/382
new file mode 100644
index 0000000..0186b27
--- /dev/null
+++ b/.werks/382
@@ -0,0 +1,13 @@
+Title: Active HTTP check now supports multiline regexp matching
+Level: 1
+Component: wato
+Class: feature
+State: unknown
+Version: 1.2.5i1
+Date: 1387280779
+Targetversion: future
+
+Previous versions of the configuration form did not provide the
+option to form regex patterns accross multi lines. The used
+check_http plugin provides the option "-l" to realize this. The
+WATO form now has a checkbox to make it possible to use this.
diff --git a/ChangeLog b/ChangeLog
index 06fc932..0558d5e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -70,6 +70,7 @@
* 0329 Removed Distributed WATO peer mode...
NOTE: Please refer to the migration notes!
* 0244 New features for WATO page Backup & Restore...
+ * 0382 Active HTTP check now supports multiline regexp matching...
* 0057 FIX: Fix exception in WATO host editor on custom tag without topic...
* 0241 FIX: Improved sorting of WATO folders in dropdown menu...
* 0019 FIX: Fixed wording in WATO rule for MSSQL check
diff --git a/checks/check_http b/checks/check_http
index d74666e..1ac9f7e 100644
--- a/checks/check_http
+++ b/checks/check_http
@@ -89,6 +89,8 @@ def check_http_arguments(params):
args += ' -s %s' %
quote_shell_string(settings["expect_string"])
if "expect_regex" in settings:
+ if len(settings['expect_regex']) >= 4 and
settings['expect_regex'][3]:
+ args += ' -l '
if settings['expect_regex'][1]:
args += ' -R'
else:
diff --git a/web/plugins/wato/active_checks.py b/web/plugins/wato/active_checks.py
index 5b0e27f..7285211 100644
--- a/web/plugins/wato/active_checks.py
+++ b/web/plugins/wato/active_checks.py
@@ -631,15 +631,20 @@ register_rule(group,
)
),
( "expect_regex",
- Tuple(
- title = _("Regular expression to expect in
content"),
- orientation = "vertical",
- show_titles = False,
- elements = [
- RegExp(label = _("Regular expression:
")),
- Checkbox(label = _("Case insensitive")),
- Checkbox(label = _("return CRITICAL if found,
OK if not")),
- ])
+ Transform(
+ Tuple(
+ orientation = "vertical",
+ show_titles = False,
+ elements = [
+ RegExp(label = _("Regular expression:
")),
+ Checkbox(label = _("Case
insensitive")),
+ Checkbox(label = _("return CRITICAL if
found, OK if not")),
+ Checkbox(label = _("Multiline string
matching")),
+ ]
+ ),
+ forth = lambda x: len(x) == 3 and tuple(list(x) +
[False]) or x,
+ title = _("Regular expression to expect in
content"),
+ ),
),
( "post_data",
Tuple(