Module: check_mk
Branch: master
Commit: 992a0b1c9409d4aad58a2848f687e75f87fd3961
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=992a0b1c9409d4…
Author: Götz Golla <gg(a)mathias-kettner.de>
Date: Fri Oct 18 22:07:44 2013 +0200
Allow for multiline sql statements in active check check_sql,
WATO integration included
---
checks/check_sql | 5 +++--
doc/treasures/active_checks/check_sql | 3 ++-
web/plugins/wato/active_checks.py | 2 +-
3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/checks/check_sql b/checks/check_sql
index 54a1bca..4bd610e 100644
--- a/checks/check_sql
+++ b/checks/check_sql
@@ -25,7 +25,7 @@
# Boston, MA 02110-1301 USA.
def check_sql_arguments(params):
- args = " --hostname '$HOSTNAME$'"
+ args = " --hostname '$HOSTADDRESS$'"
args += " --dbms %s" % quote_shell_string(params["dbms"])
args += " --name %s" % quote_shell_string(params["name"])
args += " --user '%s'" % params["user"]
@@ -48,7 +48,8 @@ def check_sql_arguments(params):
args += " -w %s:%s" % (lower[0], upper[0])
args += " -c %s:%s" % (lower[1], upper[1])
- args += " %s" % quote_shell_string(params["sql"])
+ sql_tmp = params["sql"].replace("\n", r"\n")
+ args += " %s" % quote_shell_string(sql_tmp)
return args
diff --git a/doc/treasures/active_checks/check_sql
b/doc/treasures/active_checks/check_sql
index 3e90ba5..8e84bb5 100755
--- a/doc/treasures/active_checks/check_sql
+++ b/doc/treasures/active_checks/check_sql
@@ -118,7 +118,8 @@ try:
sys.exit(0)
if args:
- opt_sql = ' '.join(map(str,args))
+ opt_sql_tmp = ' '.join(map(str,args))
+ opt_sql = opt_sql_tmp.replace(r"\n", "\n")
else:
print "UNKNOWN - no SQL statement given"
sys.exit(3)
diff --git a/web/plugins/wato/active_checks.py b/web/plugins/wato/active_checks.py
index f6efe8e..ca141ed 100644
--- a/web/plugins/wato/active_checks.py
+++ b/web/plugins/wato/active_checks.py
@@ -260,7 +260,7 @@ register_rule(group,
help = _('The name of the database on the DBMS'))
),
( "sql",
- TextAscii(title = _("SQL-Statement"), allow_empty = False,
+ TextAreaUnicode(title = _("SQL-Statement"), allow_empty = False,
help = _('The SQL-Statement which is sent to the DBMS'))
),
( "user",