Module: check_mk
Branch: master
Commit: 3cf1a996fabd50f99f2884ed654d36f5f6a2332f
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3cf1a996fabd50…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Fri May 25 12:59:16 2012 +0200
check_http, check_tcp: allow to omit -I
---
ChangeLog | 4 +---
checks/check_http | 10 +++++++++-
checks/check_tcp | 6 +++++-
web/plugins/wato/active_checks.py | 37 +++++++++++++++++++++++++++++--------
4 files changed, 44 insertions(+), 13 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 35107d2..e4fde8e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -65,11 +65,9 @@
* Linux: Modified cluster section to allow pacemaker/corosync clusters without
heartbeat
* AIX: convert NIC check to lnx_if (now being compatible with if/if64)
* AIX: new check for CPU utilization (using section lparstat_aix)
-<<<<<<< HEAD
* ntp checks: Changed default value of time offsets to be 200ms (WARN) / 500ms
(CRIT)
-=======
* aironet_{errors,clients}: detect new kinds of devices (Thanks to Tiago Sousa)
->>>>>>> aa82b76e17247eb3d5af8167ae7153a232c4a9ee
+ * check_http, check_tcp: allow to omit -I and use dynamic DNS name instead
1.2.0b4:
Core:
diff --git a/checks/check_http b/checks/check_http
index 4444a04..e96812c 100644
--- a/checks/check_http
+++ b/checks/check_http
@@ -31,6 +31,12 @@ def check_http_arguments(params):
if "vhost" in settings:
args += ' -H %s' % quote_shell_string(settings["vhost"])
+ if "virthost" in settings:
+ vhost, omit_ip = settings["virthost"]
+ args += ' -H %s' % quote_shell_string(vhost)
+ else:
+ omit_ip = False
+
if "uri" in settings:
args += ' -u %s' % quote_shell_string(settings["uri"])
@@ -95,11 +101,13 @@ def check_http_arguments(params):
if "max_age" in settings:
args += ' -M %d' % settings["max_age"]
+ if not omit_ip:
+ args = " -I $HOSTADDRESS$" + args
return args
active_check_info['http'] = {
- "command_line" : '$USER1$/check_http -I $HOSTADDRESS$
$ARG1$',
+ "command_line" : '$USER1$/check_http $ARG1$',
"argument_function" : check_http_arguments,
"service_description" : lambda params: "HTTP %s" % params[0],
"has_perfdata" : True,
diff --git a/checks/check_tcp b/checks/check_tcp
index cde96a6..c716266 100644
--- a/checks/check_tcp
+++ b/checks/check_tcp
@@ -73,12 +73,16 @@ def check_tcp_arguments(params):
if "quit_string" in settings:
args += ' -q %s' % quote_shell_string(settings["quit_string"])
+ if "hostname" in settings:
+ args += ' -H %s' % quote_shell_string(settings["hostname"])
+ else:
+ args += ' -H $HOSTADDRESS$'
return args
active_check_info['tcp'] = {
- "command_line" : '$USER1$/check_tcp -H $HOSTADDRESS$
$ARG1$',
+ "command_line" : '$USER1$/check_tcp $ARG1$',
"argument_function" : check_tcp_arguments,
"service_description" : lambda args: "TCP Port %d" % args[0],
"has_perfdata" : True,
diff --git a/web/plugins/wato/active_checks.py b/web/plugins/wato/active_checks.py
index 215578f..a231038 100644
--- a/web/plugins/wato/active_checks.py
+++ b/web/plugins/wato/active_checks.py
@@ -40,6 +40,13 @@ register_rule(group,
Dictionary(
title = _("Optional parameters"),
elements = [
+ ( "hostname",
+ TextAscii(
+ title = _("DNS Hostname"),
+ allow_empty = False,
+ help = _("If you specify a hostname here, then a dynamic
DNS lookup "
+ "will be done instead of using the IP address of
the host "
+ "as configured in your host properties."))),
( "response_time",
Tuple(
title = _("Expected response time"),
@@ -177,14 +184,28 @@ register_rule(group,
Dictionary(
title = _("Optional settings"),
elements = [
- ( "vhost",
- TextAscii(
- title = _("Name of the virtual host"),
- help = _("Set this in order to specify the name of the
"
- "virtual host for the query (using HTTP/1.1). When you
"
- "leave this empty, then the IP address of the host "
- "will be used instead."),
- allow_empty = False)
+ ( "virthost",
+ Tuple(
+ title = _("Virtual host"),
+ elements = [
+ TextAscii(
+ title = _("Name of the virtual host"),
+ help = _("Set this in order to specify the name of the
"
+ "virtual host for the query (using HTTP/1.1). When you
"
+ "leave this empty, then the IP address of the host
"
+ "will be used instead."),
+ allow_empty = False),
+ Checkbox(
+ label = _("Omit specifying an IP address"),
+ help = _("Usually Check_MK will nail this check to the
"
+ "IP address of the host it is attached to. With this
"
+ "option you can have the check use the name of the
"
+ "virtual host instead and do a dynamic DNS
lookup."),
+ true_label = _("omit IP address"),
+ false_label = _("specify IP address"),
+ ),
+ ]
+ )
),
( "uri",
TextAscii(