Module: check_mk
Branch: master
Commit: a29f048f5bda06cffecb1609e9cf31c319de4b19
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a29f048f5bda06…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Apr 9 14:14:22 2019 +0200
7335 FIX Fixed broken regex based hostname translation in EC
The hostname translation of the EC was broken since release of
Check_MK 1.4.0 (caused by #3687). This issue lead to dropped events
once the translation has been condifgured. The problem was visible
in the mkeventd.log in the following form:
C+:
2019-04-04 11:36:24,286 [40] [cmk.mkeventd.EventServer] Unable to parse host "HOST" ('tuple' object has no attribute 'endswith')
Traceback (most recent call last):
File "/omd/sites/snmp/lib/python/cmk/ec/main.py", line 2787, in do_translate_hostname
event["host"] = self.translate_hostname(event["host"])
File "/omd/sites/snmp/lib/python/cmk/ec/main.py", line 2768, in translate_hostname
if not regex.endswith('$'):
AttributeError: 'tuple' object has no attribute 'endswith'
C-:
Change-Id: I5d8b8dee696c02ac29d8118e66104338b91fbdea
---
.werks/7335 | 24 ++++++++++++++++++++++++
cmk/ec/export.py | 5 +++++
cmk/ec/main.py | 19 ++++++++++---------
3 files changed, 39 insertions(+), 9 deletions(-)
diff --git a/.werks/7335 b/.werks/7335
new file mode 100644
index 0000000..80e0add
--- /dev/null
+++ b/.werks/7335
@@ -0,0 +1,24 @@
+Title: Fixed broken regex based hostname translation in EC
+Level: 1
+Component: ec
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1554805735
+
+The hostname translation of the EC was broken since release of
+Check_MK 1.4.0 (caused by #3687). This issue lead to dropped events
+once the translation has been condifgured. The problem was visible
+in the mkeventd.log in the following form:
+
+C+:
+ 2019-04-04 11:36:24,286 [40] [cmk.mkeventd.EventServer] Unable to parse host "HOST" ('tuple' object has no attribute 'endswith')
+Traceback (most recent call last):
+ File "/omd/sites/snmp/lib/python/cmk/ec/main.py", line 2787, in do_translate_hostname
+ event["host"] = self.translate_hostname(event["host"])
+ File "/omd/sites/snmp/lib/python/cmk/ec/main.py", line 2768, in translate_hostname
+ if not regex.endswith('$'):
+AttributeError: 'tuple' object has no attribute 'endswith'
+C-:
diff --git a/cmk/ec/export.py b/cmk/ec/export.py
index f3b1f35..147e3bb 100644
--- a/cmk/ec/export.py
+++ b/cmk/ec/export.py
@@ -250,6 +250,11 @@ def load_config(settings):
levels["cmk.mkeventd.lock"] = levels["cmk.mkeventd"]
config["log_level"] = levels
+ # Convert pre 1.4 hostname translation config
+ translation = config["hostname_translation"]
+ if "regex" in translation and not isinstance(translation["regex"], list):
+ translation["regex"] = [translation["regex"]]
+
return config
diff --git a/cmk/ec/main.py b/cmk/ec/main.py
index 2a16fb1..71d7add 100644
--- a/cmk/ec/main.py
+++ b/cmk/ec/main.py
@@ -1750,15 +1750,16 @@ class EventServer(ECServerThread):
# 3. Regular expression conversion
if "regex" in translation:
- regex, subst = translation.get("regex")
- if not regex.endswith('$'):
- regex += '$'
- rcomp = cmk.utils.regex.regex(regex)
- mo = rcomp.match(backedhost)
- if mo:
- backedhost = subst
- for nr, text in enumerate(mo.groups()):
- backedhost = backedhost.replace("\\%d" % (nr + 1), text)
+ for regex, subst in translation["regex"]:
+ if not regex.endswith('$'):
+ regex += '$'
+ rcomp = cmk.utils.regex.regex(regex)
+ mo = rcomp.match(backedhost)
+ if mo:
+ backedhost = subst
+ for nr, text in enumerate(mo.groups()):
+ backedhost = backedhost.replace("\\%d" % (nr + 1), text)
+ break
# 4. Explicity mapping
for from_host, to_host in translation.get("mapping", []):
Module: check_mk
Branch: master
Commit: cd02de8fd8b10d07b8c825da2d6efa1647c76046
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=cd02de8fd8b10d…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Tue Apr 9 11:56:23 2019 +0200
aws_*_limits: Fixed inventory section text
Change-Id: I4894d8d543fccd308a3a69a5a3c00a8fec677744
---
checkman/aws_ebs_limits | 2 +-
checkman/aws_ec2_limits | 2 +-
checkman/aws_elb_limits | 2 +-
checkman/aws_rds_limits | 2 +-
checkman/aws_s3_limits | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/checkman/aws_ebs_limits b/checkman/aws_ebs_limits
index 4c91e1a..3ebd059 100644
--- a/checkman/aws_ebs_limits
+++ b/checkman/aws_ebs_limits
@@ -28,4 +28,4 @@ description:
possibly configured restriction to names or tags.
inventory:
- One service per bucket will be created.
+ One service will be created.
diff --git a/checkman/aws_ec2_limits b/checkman/aws_ec2_limits
index ca58c89..72f441a 100644
--- a/checkman/aws_ec2_limits
+++ b/checkman/aws_ec2_limits
@@ -41,4 +41,4 @@ description:
additionally fetched.
inventory:
- One service per bucket will be created.
+ One service will be created.
diff --git a/checkman/aws_elb_limits b/checkman/aws_elb_limits
index 3b3ad88..500b1c0 100644
--- a/checkman/aws_elb_limits
+++ b/checkman/aws_elb_limits
@@ -21,4 +21,4 @@ description:
possibly configured restriction to names or tags.
inventory:
- One service per bucket will be created.
+ One service will be created.
diff --git a/checkman/aws_rds_limits b/checkman/aws_rds_limits
index af58481..7418d02 100644
--- a/checkman/aws_rds_limits
+++ b/checkman/aws_rds_limits
@@ -37,4 +37,4 @@ description:
additionally fetched.
inventory:
- One service per bucket will be created.
+ One service will be created.
diff --git a/checkman/aws_s3_limits b/checkman/aws_s3_limits
index 2e17390..34419f4 100644
--- a/checkman/aws_s3_limits
+++ b/checkman/aws_s3_limits
@@ -16,4 +16,4 @@ description:
possibly configured restriction to names or tags.
inventory:
- One service per bucket will be created.
+ One service will be created.
Module: check_mk
Branch: master
Commit: 866210246d31180947ccb753ccb1ad92d89cad2c
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=866210246d3118…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Apr 8 12:54:37 2019 +0200
DCD: Improve removal of vanished piggyback hosts
The DCD now uses the piggyback data processing logic of Check_MK base
to invalidate outdated piggyback data. This makes the DCD able to remove
vanished piggyback hosts as soon as they are not relevant anymore for
Check_MK base.
CMK-1944
Change-Id: Ic7acca696fd80c2933a0e712178abb73bd756069
---
cmk_base/piggyback.py | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/cmk_base/piggyback.py b/cmk_base/piggyback.py
index 48b7feb..5379c82 100644
--- a/cmk_base/piggyback.py
+++ b/cmk_base/piggyback.py
@@ -47,8 +47,8 @@ def get_piggyback_raw_data(piggyback_max_cachefile_age, hostname):
return []
piggyback_data = []
- for source_host, piggyback_file_path in _get_piggyback_files(piggyback_max_cachefile_age,
- hostname):
+ for source_host, piggyback_file_path in get_piggyback_files(piggyback_max_cachefile_age,
+ hostname):
try:
raw_data = file(piggyback_file_path).read()
except IOError as e:
@@ -62,14 +62,14 @@ def get_piggyback_raw_data(piggyback_max_cachefile_age, hostname):
def has_piggyback_raw_data(piggyback_max_cachefile_age, hostname):
- return _get_piggyback_files(piggyback_max_cachefile_age, hostname) != []
+ return get_piggyback_files(piggyback_max_cachefile_age, hostname) != []
-def _get_piggyback_files(piggyback_max_cachefile_age, hostname):
+def get_piggyback_files(piggyback_max_cachefile_age, hostname):
"""Gather a list of piggyback files to read for further processing.
Please note that there may be multiple parallel calls executing the
- _get_piggyback_files(), store_piggyback_raw_data() or cleanup_piggyback_files()
+ get_piggyback_files(), store_piggyback_raw_data() or cleanup_piggyback_files()
functions. Therefor all these functions needs to deal with suddenly vanishing or
updated files/directories.
"""
@@ -215,7 +215,7 @@ def cleanup_piggyback_files(piggyback_max_cachefile_age):
# Cleanup empty backed host directories below "piggyback"
Please note that there may be multiple parallel calls executing the
- _get_piggyback_files(), store_piggyback_raw_data() or cleanup_piggyback_files()
+ get_piggyback_files(), store_piggyback_raw_data() or cleanup_piggyback_files()
functions. Therefor all these functions needs to deal with suddenly vanishing or
updated files/directories.
"""
@@ -245,7 +245,7 @@ def _cleanup_old_source_status_files(piggyback_max_cachefile_age):
def _cleanup_old_piggybacked_files(piggyback_max_cachefile_age):
"""Remove piggyback data that is not needed anymore
- The monitoring (_get_piggyback_files()) is already skipping these files,
+ The monitoring (get_piggyback_files()) is already skipping these files,
but we need some cleanup mechanism.
- Remove all piggyback files created by sources without status file