Module: check_mk
Branch: master
Commit: 6b35b8ac3f79514b9db1ff6b74b84e6b8ebe96fd
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6b35b8ac3f7951…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu May 24 18:29:44 2018 +0200
6169 FIX Discovery page: Fixed incompatibility with central 1.4 and remote 1.5 site
An error "ValueError: could not convert string to float:" was shown when
performing
the service discovery on a host that is monitored by a 1.5 site while the central
WATO site is a 1.4 site.
Change-Id: I5e760cffcee6aaab5d556b20fef33e80be17532b
---
.werks/6169 | 13 +++++++++++++
cmk_base/automations/check_mk.py | 15 ++++++++++++---
2 files changed, 25 insertions(+), 3 deletions(-)
diff --git a/.werks/6169 b/.werks/6169
new file mode 100644
index 0000000..f850c38
--- /dev/null
+++ b/.werks/6169
@@ -0,0 +1,13 @@
+Title: Discovery page: Fixed incompatibility with central 1.4 and remote 1.5 site
+Level: 1
+Component: wato
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1527179297
+
+An error "ValueError: could not convert string to float:" was shown when
performing
+the service discovery on a host that is monitored by a 1.5 site while the central
+WATO site is a 1.4 site.
diff --git a/cmk_base/automations/check_mk.py b/cmk_base/automations/check_mk.py
index 0901dc4..a24f75a 100644
--- a/cmk_base/automations/check_mk.py
+++ b/cmk_base/automations/check_mk.py
@@ -1032,8 +1032,16 @@ class AutomationDiagHost(Automation):
hostname, test, ipaddress, snmp_community = args[:4]
agent_port, snmp_timeout, snmp_retries = map(int, args[4:7])
- tcp_connect_timeout = float(args[7])
- cmd = args[8]
+
+ # In 1.5 the tcp connect timeout has been added. The automation may
+ # be called from a remote site with an older version. For this reason
+ # we need to deal with the old args.
+ if len(args) == 14:
+ tcp_connect_timeout = None
+ cmd = args[7]
+ else:
+ tcp_connect_timeout = float(args[7])
+ cmd = args[8]
snmpv3_use = None
snmpv3_auth_proto = None
@@ -1078,7 +1086,8 @@ class AutomationDiagHost(Automation):
source = data_sources.DSProgramDataSource(hostname, ipaddress,
cmd)
elif isinstance(source, data_sources.TCPDataSource):
source.set_port(agent_port)
- source.set_timeout(tcp_connect_timeout)
+ if tcp_connect_timeout is not None:
+ source.set_timeout(tcp_connect_timeout)
output += source.run_raw()