Module: check_mk
Branch: master
Commit: d841e0e38357fdba7fe09ba0dc582ff1ff903921
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d841e0e38357fd…
Author: Florian Kromer <fk(a)mathias-kettner.de>
Date: Tue Mar 12 16:11:13 2019 +0100
7048 mem.linux: Optional levels for corrupted memory
Previously the check status was either OK in case no RAM was corrupted or a
custom check status (default: CRIT) in case RAM was corrupted dependent on the
configuration of WATO rule Memory Swap usage on Linux, value Handle Hardware
Corrupted Error. Now it is possible to configure the WARN and CRIT levels
for the corrupted memory with the renamed WATO value Hardware Corrupted.
Existing configurations of WATO rule value Handle Hardware Corrupted Error are
converted to WATO rule value Hardware Corrupted (1, 1) for consistent behaviour.
CMK-1365
Change-Id: I209123dc2c436ec3d6181c27f1f6cfd3cd0f00c8
---
.werks/7048 | 16 +++
checkman/mem.linux | 12 ++-
checks/mem | 14 ++-
.../plugins/wato/check_parameters/memory_linux.py | 79 ++++++++-------
.../unit/checks/generictests/datasets/mem_linux.py | 111 +++++++++++++++++++++
5 files changed, 191 insertions(+), 41 deletions(-)
Diff: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commitdiff;h=d841e0e383…
Module: check_mk
Branch: master
Commit: fc503afa6b3ca18e2ea4d0be800680858fda9d35
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=fc503afa6b3ca1…
Author: Florian Kromer <fk(a)mathias-kettner.de>
Date: Thu Apr 4 14:59:35 2019 +0200
fix freeze of current time during regression test creation
Change-Id: Icd5ac310d251a5320665ee3a91c4a512566e827b
---
tests/unit/checks/generictests/__init__.py | 5 +++--
tests/unit/checks/generictests/regression.py | 6 +++++-
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/tests/unit/checks/generictests/__init__.py b/tests/unit/checks/generictests/__init__.py
index 8566940..6dc0abf 100644
--- a/tests/unit/checks/generictests/__init__.py
+++ b/tests/unit/checks/generictests/__init__.py
@@ -38,8 +38,9 @@ check function(s)). In the following, 'sc-dict' refers to a dictionary with
Some more advanced ones are
* `freeze_time` : [str] Mocked time.
- If present, its value are passed to
- `freezegun.freeze_time`
+ If present its value is passed to `freezegun.freeze_time`.
+ If you specify the empty string it will be replaced by the
+ current time if processed by generictests.regression.
* `extra_sections` : [sc-dict] Extra sections that are appended to the info
/ parsed variable.
If present, its values are extra sections (the actual
diff --git a/tests/unit/checks/generictests/regression.py b/tests/unit/checks/generictests/regression.py
index ce1d580..5672aa0 100644
--- a/tests/unit/checks/generictests/regression.py
+++ b/tests/unit/checks/generictests/regression.py
@@ -39,6 +39,7 @@ Make sure the file(s name) is a valid python module:
import os
import sys
import pprint
+import time
from importlib import import_module
import generictests.run
@@ -61,7 +62,10 @@ class WritableDataset(object):
)
self.checkname = init_dict.get('checkname', None)
self.info = init_dict.get('info', None)
- self.freeze_time = init_dict.get('freeze_time', None)
+ freeze_time = init_dict.get('freeze_time', None)
+ if freeze_time == "":
+ freeze_time = time.strftime("%Y-%m-%d %H:%M:%S")
+ self.freeze_time = freeze_time
self.parsed = init_dict.get('parsed', None)
self.discovery = init_dict.get('discovery', {})
self.checks = {}
Module: check_mk
Branch: master
Commit: 4669f0b44c2cd857fa5aaf2f69bf5f6e77649f9a
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4669f0b44c2cd8…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Thu Apr 4 10:07:14 2019 +0200
7362 FIX AWS/RDS services: Use DB identifier instead of DB name as item; DB name may be missing or not set
You have to perform a re-discovery in order to create new items
and remove old items. Configured rules for these services must
also be adapted.
Change-Id: Ib2aba8a4e5181f76465a3b4bdb5d34f1258caf77
---
.werks/7362 | 13 +++++++++++++
checks/aws_rds | 6 +++---
checks/aws_rds_summary | 8 ++++----
3 files changed, 20 insertions(+), 7 deletions(-)
diff --git a/.werks/7362 b/.werks/7362
new file mode 100644
index 0000000..6a37b29
--- /dev/null
+++ b/.werks/7362
@@ -0,0 +1,13 @@
+Title: AWS/RDS services: Use DB identifier instead of DB name as item; DB name may be missing or not set
+Level: 1
+Component: checks
+Class: fix
+Compatible: incomp
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1554365041
+
+You have to perform a re-discovery in order to create new items
+and remove old items. Configured rules for these services must
+also be adapted.
diff --git a/checks/aws_rds b/checks/aws_rds
index 66194ce..3644373 100644
--- a/checks/aws_rds
+++ b/checks/aws_rds
@@ -57,7 +57,7 @@ def parse_aws_rds(info):
"AllocatedStorage",
],
parse_aws(info),
- extra_keys=['DBName']).itervalues():
+ extra_keys=['DBInstanceIdentifier']).itervalues():
for key, factor in [
('AllocatedStorage', 1.074e+9),
@@ -69,7 +69,7 @@ def parse_aws_rds(info):
metrics[key] *= factor
except KeyError:
pass
- parsed.setdefault(metrics['DBName'], metrics)
+ parsed.setdefault(metrics['DBInstanceIdentifier'], metrics)
return parsed
@@ -194,7 +194,7 @@ def check_aws_rds_network_io(item, params, metrics):
"",
"",
"",
- metrics.get('DBName', item),
+ metrics.get('DBInstanceIdentifier', item),
"",
]]
return check_if_common_single(item, params, interfaces)
diff --git a/checks/aws_rds_summary b/checks/aws_rds_summary
index a93b66c..2e3aec8 100644
--- a/checks/aws_rds_summary
+++ b/checks/aws_rds_summary
@@ -27,7 +27,7 @@
def parse_aws_rds_summary(info):
try:
- return {instance['DBName']: instance for instance in parse_aws(info)}
+ return {instance['DBInstanceIdentifier']: instance for instance in parse_aws(info)}
except IndexError:
return {}
@@ -75,10 +75,10 @@ check_info['aws_rds_summary'] = {
@get_parsed_item_data
def check_aws_rds_summary_db(item, params, data):
- db_id = data['DBInstanceIdentifier']
+ db_name = data.get('DBName')
pre_info = ""
- if db_id is not None:
- pre_info = "[%s] " % db_id
+ if db_name is not None:
+ pre_info = "[%s] " % db_name
yield 0, '%sStatus: %s' % (pre_info, data['DBInstanceStatus'])
multi_az = data.get('MultiAZ')