Module: check_mk
Branch: master
Commit: 3d6bff5efcda93669b7a81c72069e3261f08004c
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3d6bff5efcda93…
Author: Konstantin Büttner <kb(a)mathias-kettner.de>
Date: Mon Feb 27 17:25:01 2017 +0100
check_sql: Make host to connect to freely configurable
Change-Id: I3436f9a2f2930d835f60cad0572f50411ec54ef4
---
checks/check_sql | 6 +++++-
web/plugins/wato/active_checks.py | 12 +++++++++---
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/checks/check_sql b/checks/check_sql
index d674672..b689050 100644
--- a/checks/check_sql
+++ b/checks/check_sql
@@ -36,7 +36,11 @@
def check_sql_arguments(params):
args = []
- args += [ "--hostname=$HOSTADDRESS$" ]
+ if "host" in params:
+ args += [ "--hostname=%s" % params["host"] ]
+ else:
+ args += [ "--hostname=$HOSTADDRESS$" ]
+
args += [ "--dbms=%s" % params["dbms"] ]
args += [ "--name=%s" % params["name"] ]
args += [ "--user=%s" % params["user"] ]
diff --git a/web/plugins/wato/active_checks.py b/web/plugins/wato/active_checks.py
index 0c15d14..2afb0ce 100644
--- a/web/plugins/wato/active_checks.py
+++ b/web/plugins/wato/active_checks.py
@@ -428,7 +428,7 @@ register_rule(group,
"as the state of the check. If a procedure is used, input
parameters of the "
"procedures may by given as comma separated list. "
"This check uses the active check
<tt>check_sql</tt>."),
- optional_keys = [ "levels", "levels_low",
"perfdata", "port", "procedure" ],
+ optional_keys = [ "levels", "levels_low",
"perfdata", "port", "procedure", "host" ],
elements = [
( "description",
TextUnicode(
@@ -550,8 +550,14 @@ register_rule(group,
title = _("Performance Data"),
totext =_("Store output value into RRD database"),
value = True,
- ),
- )
+ )
+ ),
+ ( "host",
+ TextAscii(
+ title = _("Host to connect to"),
+ help = _("This defaults to the host for which the active check
is configured."),
+ )
+ ),
]
),
match = 'all'