Module: check_mk
Branch: master
Commit: 489b72d507543d62fefa7f63249dbf26db2db5b5
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=489b72d507543d…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Fri Apr 27 13:53:52 2018 +0200
Simplification: Just use a lambda instead of separate func/args.
Change-Id: Iaf6a17a0a683974144d0e742a16fd1082bddb18d
---
cmk/ec/main.py | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/cmk/ec/main.py b/cmk/ec/main.py
index f89e551..3fca07b 100644
--- a/cmk/ec/main.py
+++ b/cmk/ec/main.py
@@ -1566,11 +1566,10 @@ class EventServer(ECServerThread):
# Receives an incoming SNMP trap from the socket and hands it over to PySNMP for parsing
# and processing. PySNMP is calling self.handle_snmptrap back.
- def process_snmptrap(self, data):
- whole_msg, sender_address = data
+ def process_snmptrap(self, message, sender_address):
self.logger.verbose("Trap received from %s:%d. Checking for acceptance now." % sender_address)
g_snmp_trap_engine.snmp_engine.setUserContext(sender_address=sender_address)
- g_snmp_trap_engine.snmp_engine.msgAndPduDsp.receiveMessage(g_snmp_trap_engine.snmp_engine, (), (), whole_msg)
+ g_snmp_trap_engine.snmp_engine.msgAndPduDsp.receiveMessage(g_snmp_trap_engine.snmp_engine, (), (), message)
def handle_snmptrap(self, snmp_engine, state_reference, context_engine_id, context_name,
var_binds, cb_ctx):
@@ -1740,8 +1739,8 @@ class EventServer(ECServerThread):
# Read events from builtin snmptrap server
if self._snmptrap is not None and self._snmptrap.fileno() in readable:
try:
- data = self._snmptrap.recvfrom(65535)
- self.process_raw_data(self.process_snmptrap, data)
+ message, sender_address = self._snmptrap.recvfrom(65535)
+ self.process_raw_data(lambda: self.process_snmptrap(message, sender_address))
except Exception:
self.logger.exception('Exception handling a SNMP trap from "%s". Skipping this one' %
(data[1][0]))
@@ -1757,12 +1756,12 @@ class EventServer(ECServerThread):
# Processes incoming data, just a wrapper between the real data and the
# handler function to record some statistics etc.
- def process_raw_data(self, handler_func, data):
+ def process_raw_data(self, handler):
self._perfcounters.count("messages")
before = time.time()
# In replication slave mode (when not took over), ignore all events
if not is_replication_slave(self._config) or self._slave_status["mode"] != "sync":
- handler_func(data)
+ handler()
elif self.settings.options.debug:
self.logger.info("Replication: we are in slave mode, ignoring event")
elapsed = time.time() - before
@@ -1775,7 +1774,7 @@ class EventServer(ECServerThread):
line = scrub_and_decode(line.rstrip())
if line:
try:
- self.process_raw_data(self.process_line, (line, address))
+ self.process_raw_data(lambda: self.process_line(line, address))
except Exception as e:
self.logger.exception('Exception handling a log line (skipping this one): %s' % e)
@@ -2176,8 +2175,7 @@ class EventServer(ECServerThread):
(100.0 * count / float(total_count))
))
- def process_line(self, data):
- line, address = data
+ def process_line(self, line, address):
line = line.rstrip()
if self._config["debug_rules"]:
if address:
Module: check_mk
Branch: master
Commit: 4c28582697ae2940c83720a16a19ba5cea3f8261
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4c28582697ae29…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Apr 27 08:16:13 2018 +0200
6036 FIX Fixed broken IP lookup in Check_MK service when using Nagios core
The "Check_MK" services of hosts were not doing IP resolution correctly,
leading to messages like "(No output returned from plugin)" and non working
checking for these hosts.
Change-Id: I0c21093b1c9b96a76a8692882728c6c12c513f8c
---
.werks/6036 | 13 +++++++++++++
cmk_base/core_nagios.py | 1 -
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/.werks/6036 b/.werks/6036
new file mode 100644
index 0000000..c5b1496
--- /dev/null
+++ b/.werks/6036
@@ -0,0 +1,13 @@
+Title: Fixed broken IP lookup in Check_MK service when using Nagios core
+Level: 2
+Component: core
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1524809608
+
+The "Check_MK" services of hosts were not doing IP resolution correctly,
+leading to messages like "(No output returned from plugin)" and non working
+checking for these hosts.
diff --git a/cmk_base/core_nagios.py b/cmk_base/core_nagios.py
index faa5273..30a9a6c 100644
--- a/cmk_base/core_nagios.py
+++ b/cmk_base/core_nagios.py
@@ -1094,7 +1094,6 @@ if '-d' in sys.argv:
nodes = [ (hostname, ipaddress) ]
output.write("config.ipaddresses = %r\n\n" % needed_ipaddresses)
- output.write("ip_lookup.lookup_ip_address = lambda hostname: config.ipaddresses.get(hostname)\n\n");
# datasource programs. Is this host relevant?