Module: check_mk
Branch: master
Commit: 522908a0c5dd572d331e254ce43f7253e87042f2
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=522908a0c5dd57…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon May 30 08:46:41 2016 +0200
3580 The macro $HOSTNAME$ is now available for host checks which are based on service
states
---
.werks/3580 | 9 +++++++++
ChangeLog | 1 +
modules/check_mk.py | 4 +++-
web/plugins/wato/check_mk_configuration.py | 2 ++
4 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/.werks/3580 b/.werks/3580
new file mode 100644
index 0000000..d307958
--- /dev/null
+++ b/.werks/3580
@@ -0,0 +1,9 @@
+Title: The macro $HOSTNAME$ is now available for host checks which are based on service
states
+Level: 1
+Component: core
+Compatible: compat
+Version: 1.2.9i1
+Date: 1464590736
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index 2d938a2..ca6847f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,7 @@
* 3342 MKP: local/lib and local/bin of sites can now be packed...
* 3114 linux and windows agent can now be configured to directly encrypt their
output. For real-time updates encryption is now optional (but active per default)...
* 3531 Reduced Check_MK helper size for certain dists/python versions...
+ * 3580 The macro $HOSTNAME$ is now available for host checks which are based on
service states
* 3193 FIX: Fixed fake check results for hosts...
* 3214 FIX: Removing SNMP checks for non SNMP hosts and agent based checks for non
agent hosts...
* 3220 FIX: Check_MK HW/SW Inventory is now always disabled for "No Agent"
hosts
diff --git a/modules/check_mk.py b/modules/check_mk.py
index 1d0762d..c5c1de1 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -1200,7 +1200,9 @@ def host_check_command(hostname, ip, is_clust):
return "check-mk-host-service!" + service
command = "check-mk-host-custom-%d" %
(len(hostcheck_commands_to_define) + 1)
hostcheck_commands_to_define.append((command,
- 'echo "$SERVICEOUTPUT:%s:%s$" && exit
$SERVICESTATEID:%s:%s$' % (hostname, service, hostname, service)))
+ 'echo "$SERVICEOUTPUT:%s:%s$" && exit
$SERVICESTATEID:%s:%s$' %
+ (hostname, service.replace('$HOSTNAME$', hostname),
+ hostname, service.replace('$HOSTNAME$', hostname))))
return command
elif value[0] == "tcp":
diff --git a/web/plugins/wato/check_mk_configuration.py
b/web/plugins/wato/check_mk_configuration.py
index d613ff9..8497233 100644
--- a/web/plugins/wato/check_mk_configuration.py
+++ b/web/plugins/wato/check_mk_configuration.py
@@ -1499,6 +1499,8 @@ register_rule(
size = 45,
allow_empty = False,
attrencode = True,
+ help = _("You can use the macro <tt>$HOSTNAME$</tt>
here. It will be replaced "
+ "with the name of the current host."),
)),
( "custom", _("Use a custom check plugin..."),
PluginCommandLine() ),
],