Module: check_mk
Branch: master
Commit: 6e7143369733fcbecc5d1d7c8cf9341c2ae2fb8a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6e7143369733fc…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Nov 29 11:58:05 2016 +0100
active checks: Fixed handling of hosts with non resolvable IP addresses during runtime
---
modules/nagios.py | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/modules/nagios.py b/modules/nagios.py
index 1effcc0..f6d891f 100644
--- a/modules/nagios.py
+++ b/modules/nagios.py
@@ -498,7 +498,14 @@ define service {
template = has_perfdata and "check_mk_perf," or ""
extraconf = extra_service_conf_of(hostname, description)
- command = "check_mk_active-%s!%s" % (acttype, args)
+
+ if host_attrs["address"] in [ "0.0.0.0", "::"
]:
+ command_name = "check-mk-custom"
+ command = command_name + "!echo \"Failed to lookup IP address
and no explicit IP address configured\" && exit 3"
+ custom_commands_to_define.add(command_name)
+ else:
+ command = "check_mk_active-%s!%s" % (acttype, args)
+
outfile.write("""
define service {
use\t\t\t\t%scheck_mk_default