Module: check_mk
Branch: master
Commit: 320b6c709d68d07a330370f6e9be490623491851
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=320b6c709d68d0…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Tue Apr 16 14:12:16 2019 +0200
7372 FIX agent_aws: Fixed restriction of services by tags
Wow, what a rookie mistake... :(
Change-Id: I0740ab3d80b36fc59e6ba37af14c1cfd5eab3abd
---
.werks/7372 | 13 +++++++++++++
cmk/special_agents/agent_aws.py | 23 +++++++++++++++++------
2 files changed, 30 insertions(+), 6 deletions(-)
diff --git a/.werks/7372 b/.werks/7372
new file mode 100644
index 0000000..89f1bd7
--- /dev/null
+++ b/.werks/7372
@@ -0,0 +1,13 @@
+Title: agent_aws: Fixed restriction of services by tags
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.6.0i1
+Date: 1555416683
+Class: fix
+
+If tags were configured in the special agent {{Amazon Web Services (AWS)}}
+and began or ended with 't', 'a', 'g' or ':' in the related tag key, the
+special agent stripped these characters away. These tagged AWS resources
+were not discovered.
diff --git a/cmk/special_agents/agent_aws.py b/cmk/special_agents/agent_aws.py
index 6db2ef1..6845a72 100644
--- a/cmk/special_agents/agent_aws.py
+++ b/cmk/special_agents/agent_aws.py
@@ -678,7 +678,15 @@ class AWSSection(object):
"""
if not tags:
return
- return [{'Key': e['Name'].strip("tag:"), 'Value': v} for e in tags for v in e['Values']]
+ prepared_tags = []
+ for tag in tags:
+ tag_name = tag['Name']
+ if tag_name.startswith('tag:'):
+ tag_key = tag_name[4:]
+ else:
+ tag_key = tag_name
+ prepared_tags.extend([{'Key': tag_key, 'Value': v} for v in tag['Values']])
+ return prepared_tags
class AWSSectionLimits(AWSSection):
@@ -2708,6 +2716,14 @@ class AWSConfig(object):
self.service_config = {}
def add_service_tags(self, tags_key, tags):
+ """Convert commandline input
+ from
+ ([['foo'], ['aaa'], ...], [['bar', 'baz'], ['bbb', 'ccc'], ...])
+ to
+ Filters=[{'Name': 'tag:foo', 'Values': ['bar', 'baz']},
+ {'Name': 'tag:aaa', 'Values': ['bbb', 'ccc']}, ...]
+ as we need in API methods if and only if keys AND values are set.
+ """
self.service_config.setdefault(tags_key, None)
if tags != (None, None):
self.service_config[tags_key] = self._prepare_tags(tags)
@@ -2715,11 +2731,6 @@ class AWSConfig(object):
self.service_config[tags_key] = self._overall_tags
def _prepare_tags(self, tags):
- """
- Prepare tags format as needed in API methods:
- Filters=[{'Name': 'tag:KEY', 'Values': [VAL,...]}, ...]
- Keys AND values must be set for filtering.
- """
keys, values = tags
if keys and values:
return [{
Module: check_mk
Branch: master
Commit: 6b57bc2d11f5fa28285a082cee1dd373a308b4a5
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6b57bc2d11f5fa…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Tue Apr 16 10:13:05 2019 +0200
Thread an addition long output field from the monitoring log through to Livestatus.
This adds a "long_plugin_output" column to the "log" table and a
"long_log_output" column to the "statehist" table. These columns are filled
from an additional field at the end of the following monitoring log entries:
INITIAL HOST STATE
INITIAL SERVICE STATE
CURRENT HOST STATE
CURRENT SERVICE STATE
HOST ALERT
SERVICE ALERT
HOST NOTIFICATION
SERVICE NOTIFICATION
Line breaks in the long output are represented as "\n" (i.e. a backslash
followed by the letter "n") in the monitoring log. This is the same
encoding as is used for e.g. the UPDATE_SHADOW_HOST_STATE command.
CMK-1364
Change-Id: Idbaf12ed0d50611a9b9d70b6ad60f15310d3c4f4
---
livestatus/src/HostServiceState.h | 1 +
livestatus/src/LogEntry.cc | 58 ++++++++++++++++++++++++-------------
livestatus/src/LogEntry.h | 7 +++--
livestatus/src/StringUtils.cc | 9 ++++++
livestatus/src/StringUtils.h | 3 ++
livestatus/src/TableLog.cc | 5 ++++
livestatus/src/TableStateHistory.cc | 17 ++++++-----
7 files changed, 71 insertions(+), 29 deletions(-)
Diff: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commitdiff;h=6b57bc2d11…