Module: check_mk
Branch: master
Commit: 15bc8b37123e403894f1c9a986856bb0b349ab80
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=15bc8b37123e40…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Sun Apr 14 19:54:53 2019 +0200
Extracted some code from _execute_discovery()
Change-Id: Ic3bd8e465846718413b589dd1d0f071bac0c3a0e
---
cmk_base/discovery.py | 112 ++++++++++++++++++++++++++++----------------------
1 file changed, 62 insertions(+), 50 deletions(-)
diff --git a/cmk_base/discovery.py b/cmk_base/discovery.py
index 6b36a98..3ca66c2 100644
--- a/cmk_base/discovery.py
+++ b/cmk_base/discovery.py
@@ -801,14 +801,8 @@ def _execute_discovery(multi_host_sections, hostname, ipaddress, check_plugin_na
console.vverbose(" Skip ignored check plugin name '%s'\n" % check_plugin_name)
return []
- try:
- discovery_function = config.check_info[check_plugin_name]["inventory_function"]
- if discovery_function is None:
- discovery_function = check_api_utils.no_discovery_possible
- except KeyError:
- raise MKGeneralException("No such check type '%s'" % check_plugin_name)
+ discovery_function = _get_discovery_function_of(check_plugin_name)
- # Now do the actual discovery
try:
# TODO: There is duplicate code with checking.execute_check(). Find a common place!
try:
@@ -841,58 +835,76 @@ def _execute_discovery(multi_host_sections, hostname, ipaddress, check_plugin_na
and not config.check_info[check_plugin_name]["handle_empty_info"]:
return []
- discovered_items = discovery_function(section_content)
+ # Now do the actual discovery
+ discovered_items = _execute_discovery_function(discovery_function, section_content)
+ return _validate_discovered_items(hostname, check_plugin_name, discovered_items)
+ except Exception as e:
+ if on_error == "warn":
+ console.warning(
+ " Exception in discovery function of check type '%s': %s" % (check_plugin_name, e))
+ elif on_error == "raise":
+ raise
+ return []
- # tolerate function not explicitely returning []
- if discovered_items is None:
- discovered_items = []
- # New yield based api style
- elif not isinstance(discovered_items, list):
- discovered_items = list(discovered_items)
+def _get_discovery_function_of(check_plugin_name):
+ try:
+ discovery_function = config.check_info[check_plugin_name]["inventory_function"]
+ except KeyError:
+ raise MKGeneralException("No such check type '%s'" % check_plugin_name)
- result = []
- for entry in discovered_items:
- if not isinstance(entry, tuple):
- console.error(
- "%s: Check %s returned invalid discovery data (entry not a tuple): %r\n" %
- (hostname, check_plugin_name, repr(entry)))
- continue
+ if discovery_function is None:
+ return check_api_utils.no_discovery_possible
- if len(entry) == 2: # comment is now obsolete
- item, paramstring = entry
- elif len(entry) == 3: # allow old school
- item, __, paramstring = entry
- else: # we really don't want longer tuples (or 1-tuples).
- console.error(
- "%s: Check %s returned invalid discovery data (not 2 or 3 elements): %r\n" %
- (hostname, check_plugin_name, repr(entry)))
- continue
+ return discovery_function
- # Check_MK 1.2.7i3 defines items to be unicode strings. Convert non unicode
- # strings here seamless. TODO remove this conversion one day and replace it
- # with a validation that item needs to be of type unicode
- if isinstance(item, str):
- item = config.decode_incoming_string(item)
- description = config.service_description(hostname, check_plugin_name, item)
- # make sanity check
- if len(description) == 0:
- console.error("%s: Check %s returned empty service description - ignoring it.\n" %
- (hostname, check_plugin_name))
- continue
+def _execute_discovery_function(discovery_function, section_content):
+ discovered_items = discovery_function(section_content)
- result.append((item, paramstring))
+ # tolerate function not explicitely returning []
+ if discovered_items is None:
+ discovered_items = []
- except Exception as e:
- if on_error == "warn":
- console.warning(
- " Exception in discovery function of check type '%s': %s" % (check_plugin_name, e))
- elif on_error == "raise":
- raise
- return []
+ # New yield based api style
+ elif not isinstance(discovered_items, list):
+ discovered_items = list(discovered_items)
+
+ return discovered_items
+
+
+def _validate_discovered_items(hostname, check_plugin_name, discovered_items):
+ results = []
+ for entry in discovered_items:
+ if not isinstance(entry, tuple):
+ console.error("%s: Check %s returned invalid discovery data (entry not a tuple): %r\n" %
+ (hostname, check_plugin_name, repr(entry)))
+ continue
+
+ if len(entry) == 2: # comment is now obsolete
+ item, paramstring = entry
+ elif len(entry) == 3: # allow old school
+ item, __, paramstring = entry
+ else: # we really don't want longer tuples (or 1-tuples).
+ console.error("%s: Check %s returned invalid discovery data (not 2 or 3 elements): %r\n"
+ % (hostname, check_plugin_name, repr(entry)))
+ continue
+
+ # Check_MK 1.2.7i3 defines items to be unicode strings. Convert non unicode
+ # strings here seamless. TODO remove this conversion one day and replace it
+ # with a validation that item needs to be of type unicode
+ if isinstance(item, str):
+ item = config.decode_incoming_string(item)
+
+ description = config.service_description(hostname, check_plugin_name, item)
+ # make sanity check
+ if len(description) == 0:
+ console.error("%s: Check %s returned empty service description - ignoring it.\n" %
+ (hostname, check_plugin_name))
+ continue
- return result
+ results.append((item, paramstring))
+ return results
# Creates a table of all services that a host has or could have according
Module: check_mk
Branch: master
Commit: d9b68ef2d4d7d868b88d1251cd0eebd7ab5f873e
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d9b68ef2d4d7d8…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Apr 10 13:48:07 2019 +0200
Start new rule set matching implementation
* New rules will be represented as dictionaries in the future.
The conditions are stored in the "conditions" element.
* The new conditions itself are based on the MongoDB query syntax and
implement the subset of operations we need for our rule matching.
* This commit contains the rule condition matching code. Have a look
at the tests to see how it works.
The next step will be to implement the layer above for processing
whole rulesets.
CMK-1941
Change-Id: I2fc4382b4efd88706902e1c79cdc20b051a65d38
---
cmk/utils/rulesets/__init__.py | 25 ++++
cmk/utils/rulesets/rule_matcher.py | 189 ++++++++++++++++++++++++++
tests/unit/cmk/utils/test_cmk_rulesets.py | 217 ++++++++++++++++++++++++++++++
3 files changed, 431 insertions(+)
Diff: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commitdiff;h=d9b68ef2d4…
Module: check_mk
Branch: master
Commit: 52ee51bcb2e027ab6f823372dab53cb69d7d0c15
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=52ee51bcb2e027…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Fri Apr 12 10:37:41 2019 +0200
7370 Linux agent now delievers output of 'ip address'
Previously the Linux agent delievered the output of 'ip link' which is a subset
of 'ip address'. Now the agent uses 'ip address'. The inventory plugin
{{mk_inventory}} also executed 'ip address'. This has been removed from the
agent plugin {{mk_inventory}}. The related inventory plugin 'lnx_if_a' has also
been removed. Instead the inventory plugin 'lnx_if' processes the IP addresses.
In order to use this feature you have to deploy the Linux agent and
{{mk_inventory}} agent plugin.
Notes:
- Add regression test
- Refactored parse function of 'lnx_if'; can now processes 'ip address'
instead of 'ip link'
- Agent delievers output of 'ip address' instead of 'ip link'
- Removed 'lnx_ip_a' section from 'mk_inventory' plugin
- Cleaned up obsolete 'lnx_ip_a' inventory plugin
- 'lnx_if' processes IP addresses for HW/SW inventory
Change-Id: I9b0c85ba8eee2dc28289947cd8cb258584b80697
---
.werks/7370 | 17 ++
agents/check_mk_agent.linux | 2 +-
agents/plugins/mk_inventory.linux | 2 -
checks/lnx_if | 295 +++++++++++----------
inventory/lnx_if | 26 +-
inventory/lnx_ip_a | 62 -----
.../generictests/datasets/lnx_if_regression.py | 118 +++++++++
7 files changed, 318 insertions(+), 204 deletions(-)
Diff: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commitdiff;h=52ee51bcb2…
Module: check_mk
Branch: master
Commit: dcc53fc89e6e91da78e29c3b8304e63d79266022
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=dcc53fc89e6e91…
Author: Moritz Kiemer <mo(a)mathias-kettner.de>
Date: Fri Apr 12 11:58:35 2019 +0200
apache_status: fix werk 7387
The ssl.create_default_context function is only introduced
in python 2.7.
Only call it, it it absolutely necessary.
Change-Id: Ic6fe9176dffb3c9992126972903dcd8ae6aee5d8
---
.werks/7387 | 6 ++++--
agents/plugins/apache_status | 20 ++++++++------------
2 files changed, 12 insertions(+), 14 deletions(-)
diff --git a/.werks/7387 b/.werks/7387
index a817abb..cf309bb 100644
--- a/.werks/7387
+++ b/.werks/7387
@@ -12,6 +12,8 @@ local hosts were handled correctly, which could lead to missing
data for that host.
Instead of handling all cases of invalid certificates we now
omit certificate verification for local addresses entirely.
-This only affects the addresses "127.0.0.1", "[::1]", and
-"localhost".
+Note that this will fail for python versions before 2.7.
+
+This only applies if one of the addresses "127.0.0.1", "[::1]", and
+"localhost" is queried using https.
diff --git a/agents/plugins/apache_status b/agents/plugins/apache_status
index a861619..45e9361 100755
--- a/agents/plugins/apache_status
+++ b/agents/plugins/apache_status
@@ -46,7 +46,6 @@ import re
import socket
import sys
import urllib2
-import ssl
# We have to deal with socket timeouts. Python > 2.6
# supports timeout parameter for the urllib2.urlopen method
@@ -126,26 +125,23 @@ def _unpack_server(server):
server.get('page', 'server-status'))
-def get_ssl_context(address):
- """return the appropriate SSL context
-
- * for local addresses ignore the Certificate
- """
+def get_ssl_no_verify_context():
+ import ssl
context = ssl.create_default_context()
- is_local = address in ("127.0.0.1", "[::1]", "localhost")
- if is_local:
- context.check_hostname = False
- context.verify_mode = ssl.CERT_NONE
+ context.check_hostname = False
+ context.verify_mode = ssl.CERT_NONE
return context
def get_response(proto, address, portspec, page):
url = '%s://%s%s/%s?auto' % (proto, address, portspec, page)
request = urllib2.Request(url, headers={"Accept": "text/plain"})
- ssl_context = get_ssl_context(address)
+ is_local = address in ("127.0.0.1", "[::1]", "localhost")
# Try to fetch the status page for each server
try:
- return urllib2.urlopen(request, context=ssl_context)
+ if proto == "https" and is_local:
+ return urllib2.urlopen(request, context=get_ssl_no_verify_context())
+ return urllib2.urlopen(request)
except urllib2.URLError as exc:
if 'unknown protocol' in str(exc):
# HACK: workaround misconfigurations where port 443 is used for
Module: check_mk
Branch: master
Commit: 79cd7899f522516ce9a7fe9667e4f3e980ffd9a2
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=79cd7899f52251…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Mon Apr 15 09:05:36 2019 +0200
Removed superfluous decorator redefinition.
This basically reverts 6f48926edb.
Change-Id: I98167e8eb654c6c2a76509b81102165818daaae7
---
checks/docker_container_status | 36 ------------------------------------
checks/docker_node_disk_usage | 36 ------------------------------------
checks/docker_node_info | 36 ------------------------------------
checks/legacy_docker.include | 2 +-
4 files changed, 1 insertion(+), 109 deletions(-)
diff --git a/checks/docker_container_status b/checks/docker_container_status
index e5cd0fb..69649fa 100644
--- a/checks/docker_container_status
+++ b/checks/docker_container_status
@@ -25,42 +25,6 @@
# Boston, MA 02110-1301 USA.
-# TODO: see why it's not enough to have it in legacy_docker.include
-def append_deprecation_warning(check_function): # pylint: disable=function-redefined
- '''A wrapper to WARN if legacy code is used
-
- If the parse result is of one of the legacy Types the decorated
- check function will yield an additional WARNING state.
-
- These legacy parse results correspond to agents/plugins from version
- 1.5.0b1 to 1.5.0p12
- '''
-
- @functools.wraps(check_function)
- def wrapper(item, params, parsed):
-
- is_deprecated = isinstance(parsed, (DeprecatedDict, DeprecatedList))
- catch_these = Exception if is_deprecated else ()
-
- try:
- results = check_function(item, params, parsed)
- if isinstance(results, tuple):
- yield results
- else:
- for result in results:
- yield result
- except catch_these:
- yield 3, "Could not handle data"
- finally:
- if is_deprecated:
- yield 1, ("Deprecated plugin/agent (see long output)(!)\n"
- "You are using legacy code, which may lead to crashes and/or"
- " incomplete information. Please upgrade the monitored host to"
- " use the plugin 'mk_docker.py'.")
-
- return wrapper
-
-
def parse_docker_container_status(info):
'''process the first line to a JSON object
diff --git a/checks/docker_node_disk_usage b/checks/docker_node_disk_usage
index 7b564f0..d5355e2 100644
--- a/checks/docker_node_disk_usage
+++ b/checks/docker_node_disk_usage
@@ -25,42 +25,6 @@
# Boston, MA 02110-1301 USA.
-# TODO: see why it's not enough to have it in legacy_docker.include
-def append_deprecation_warning(check_function): # pylint: disable=function-redefined
- '''A wrapper to WARN if legacy code is used
-
- If the parse result is of one of the legacy Types the decorated
- check function will yield an additional WARNING state.
-
- These legacy parse results correspond to agents/plugins from version
- 1.5.0b1 to 1.5.0p12
- '''
-
- @functools.wraps(check_function)
- def wrapper(item, params, parsed):
-
- is_deprecated = isinstance(parsed, (DeprecatedDict, DeprecatedList))
- catch_these = Exception if is_deprecated else ()
-
- try:
- results = check_function(item, params, parsed)
- if isinstance(results, tuple):
- yield results
- else:
- for result in results:
- yield result
- except catch_these:
- yield 3, "Could not handle data"
- finally:
- if is_deprecated:
- yield 1, ("Deprecated plugin/agent (see long output)(!)\n"
- "You are using legacy code, which may lead to crashes and/or"
- " incomplete information. Please upgrade the monitored host to"
- " use the plugin 'mk_docker.py'.")
-
- return wrapper
-
-
def parse_docker_node_disk_usage(info):
version = docker_get_version(info) # pylint: disable=undefined-variable
diff --git a/checks/docker_node_info b/checks/docker_node_info
index 56a4324..c1614f0 100644
--- a/checks/docker_node_info
+++ b/checks/docker_node_info
@@ -25,42 +25,6 @@
# Boston, MA 02110-1301 USA.
-# TODO: see why it's not enough to have it in legacy_docker.include
-def append_deprecation_warning(check_function): # pylint: disable=function-redefined
- '''A wrapper to WARN if legacy code is used
-
- If the parse result is of one of the legacy Types the decorated
- check function will yield an additional WARNING state.
-
- These legacy parse results correspond to agents/plugins from version
- 1.5.0b1 to 1.5.0p12
- '''
-
- @functools.wraps(check_function)
- def wrapper(item, params, parsed):
-
- is_deprecated = isinstance(parsed, (DeprecatedDict, DeprecatedList))
- catch_these = Exception if is_deprecated else ()
-
- try:
- results = check_function(item, params, parsed)
- if isinstance(results, tuple):
- yield results
- else:
- for result in results:
- yield result
- except catch_these:
- yield 3, "Could not handle data"
- finally:
- if is_deprecated:
- yield 1, ("Deprecated plugin/agent (see long output)(!)\n"
- "You are using legacy code, which may lead to crashes and/or"
- " incomplete information. Please upgrade the monitored host to"
- " use the plugin 'mk_docker.py'.")
-
- return wrapper
-
-
def parse_docker_node_info(info):
version = docker_get_version(info) # pylint: disable=undefined-variable
if version is None:
diff --git a/checks/legacy_docker.include b/checks/legacy_docker.include
index 365f621..e114f63 100644
--- a/checks/legacy_docker.include
+++ b/checks/legacy_docker.include
@@ -36,7 +36,7 @@ class DeprecatedList(list):
pass
-def append_deprecation_warning(check_function): # pylint: disable=function-redefined
+def append_deprecation_warning(check_function):
'''A wrapper to WARN if legacy code is used
If the parse result is of one of the legacy Types the decorated
Module: check_mk
Branch: master
Commit: 3648f7716976fbcfb9a3fbf26334c6a48dc1a770
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3648f7716976fb…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Fri Apr 12 11:11:09 2019 +0200
Removed global pylint pragmas from a few files.
These files glued together before checking, so global pragmas have
unpredictable and unintentional side effects. The pragmas are now more
local. TODO: Check if we can remove them by doing things differently.
Change-Id: I62d2b824672739a1aeedbdfa76781b05dcb92485
---
checks/aws_s3 | 2 +-
checks/aws_s3_limits | 2 +-
checks/aws_s3_requests | 2 +-
checks/bdtms_tape_info | 4 ++--
checks/bdtms_tape_status | 4 ++--
checks/df.include | 2 +-
checks/docker_container_status | 2 +-
checks/docker_node_disk_usage | 2 +-
checks/docker_node_info | 2 +-
checks/filestats | 1 -
checks/legacy_docker.include | 2 +-
checks/size_trend.include | 3 +--
cmk_base/check_api.py | 19 +++++++++----------
inventory/docker_container_labels | 2 --
14 files changed, 22 insertions(+), 27 deletions(-)
diff --git a/checks/aws_s3 b/checks/aws_s3
index 76295b7..c81704b 100644
--- a/checks/aws_s3
+++ b/checks/aws_s3
@@ -25,7 +25,7 @@
# Boston, MA 02110-1301 USA.
-def parse_aws_s3(info):
+def parse_aws_s3(info): # pylint: disable=function-redefined
parsed = {}
for row in parse_aws(info):
bucket = parsed.setdefault(row['Label'], {})
diff --git a/checks/aws_s3_limits b/checks/aws_s3_limits
index b88158c..b857398 100644
--- a/checks/aws_s3_limits
+++ b/checks/aws_s3_limits
@@ -29,7 +29,7 @@ factory_settings['aws_s3_limits_default_levels'] = {
}
-def parse_aws_s3_limits(info):
+def parse_aws_s3_limits(info): # pylint: disable=function-redefined
return [(resource_key, resource_title, limit, amount, None)
for resource_key, resource_title, limit, amount in parse_aws(info)]
diff --git a/checks/aws_s3_requests b/checks/aws_s3_requests
index ac94b5b..3250f71 100644
--- a/checks/aws_s3_requests
+++ b/checks/aws_s3_requests
@@ -25,7 +25,7 @@
# Boston, MA 02110-1301 USA.
-def parse_aws_s3(info):
+def parse_aws_s3(info): # pylint: disable=function-redefined
parsed = _extract_aws_metrics_by_labels([
"AllRequests",
"GetRequests",
diff --git a/checks/bdtms_tape_info b/checks/bdtms_tape_info
index 6102d6f..9f47a7a 100644
--- a/checks/bdtms_tape_info
+++ b/checks/bdtms_tape_info
@@ -25,11 +25,11 @@
# Boston, MA 02110-1301 USA.
-def inventory_bdtms_tape_info(info):
+def inventory_bdtms_tape_info(info): # pylint: disable=function-redefined
return [(None, None)]
-def check_bdtms_tape_info(_no_item, _no_params, info):
+def check_bdtms_tape_info(_no_item, _no_params, info): # pylint: disable=function-redefined
for name, value in zip(['Vendor', 'Product ID', 'Serial Number', 'Software Revision'], info[0]):
yield 0, "%s: %s" % (name, value)
diff --git a/checks/bdtms_tape_status b/checks/bdtms_tape_status
index d036c6f..c93fb1a 100644
--- a/checks/bdtms_tape_status
+++ b/checks/bdtms_tape_status
@@ -25,11 +25,11 @@
# Boston, MA 02110-1301 USA.
-def inventory_bdtms_tape_info(info):
+def inventory_bdtms_tape_info(info): # pylint: disable=function-redefined
return [(None, None)]
-def check_bdtms_tape_info(_no_item, _no_params, info):
+def check_bdtms_tape_info(_no_item, _no_params, info): # pylint: disable=function-redefined
_activity_id, health_id = info[0]
health = {
diff --git a/checks/df.include b/checks/df.include
index 4ab5af7..dfeed90 100644
--- a/checks/df.include
+++ b/checks/df.include
@@ -29,7 +29,7 @@
# between include files are possible this will not be necessary anymore.
if 'size_trend' not in globals():
- def size_trend(*_args, **_kwargs):
+ def size_trend(*_args, **_kwargs): # pylint: disable=function-redefined
raise MKGeneralException('Function size_trend not found. Please include '
'"size_trend.include" in your check')
diff --git a/checks/docker_container_status b/checks/docker_container_status
index 13e7b3a..e5cd0fb 100644
--- a/checks/docker_container_status
+++ b/checks/docker_container_status
@@ -26,7 +26,7 @@
# TODO: see why it's not enough to have it in legacy_docker.include
-def append_deprecation_warning(check_function):
+def append_deprecation_warning(check_function): # pylint: disable=function-redefined
'''A wrapper to WARN if legacy code is used
If the parse result is of one of the legacy Types the decorated
diff --git a/checks/docker_node_disk_usage b/checks/docker_node_disk_usage
index a4be887..7b564f0 100644
--- a/checks/docker_node_disk_usage
+++ b/checks/docker_node_disk_usage
@@ -26,7 +26,7 @@
# TODO: see why it's not enough to have it in legacy_docker.include
-def append_deprecation_warning(check_function):
+def append_deprecation_warning(check_function): # pylint: disable=function-redefined
'''A wrapper to WARN if legacy code is used
If the parse result is of one of the legacy Types the decorated
diff --git a/checks/docker_node_info b/checks/docker_node_info
index 41766c9..56a4324 100644
--- a/checks/docker_node_info
+++ b/checks/docker_node_info
@@ -26,7 +26,7 @@
# TODO: see why it's not enough to have it in legacy_docker.include
-def append_deprecation_warning(check_function):
+def append_deprecation_warning(check_function): # pylint: disable=function-redefined
'''A wrapper to WARN if legacy code is used
If the parse result is of one of the legacy Types the decorated
diff --git a/checks/filestats b/checks/filestats
index 88e4f8a..ddc441d 100644
--- a/checks/filestats
+++ b/checks/filestats
@@ -168,7 +168,6 @@ def check_filestats(_item, params, data):
yield subresult
-# pylint: disable=undefined-variable
check_info['filestats'] = {
"parse_function": parse_filestats,
"inventory_function": discover(),
diff --git a/checks/legacy_docker.include b/checks/legacy_docker.include
index e114f63..365f621 100644
--- a/checks/legacy_docker.include
+++ b/checks/legacy_docker.include
@@ -36,7 +36,7 @@ class DeprecatedList(list):
pass
-def append_deprecation_warning(check_function):
+def append_deprecation_warning(check_function): # pylint: disable=function-redefined
'''A wrapper to WARN if legacy code is used
If the parse result is of one of the legacy Types the decorated
diff --git a/checks/size_trend.include b/checks/size_trend.include
index 2f0d37b..0a31785 100644
--- a/checks/size_trend.include
+++ b/checks/size_trend.include
@@ -25,8 +25,7 @@
# Boston, MA 02110-1301 USA.
-# pylint: disable=function-redefined
-def size_trend(check, item, resource, levels, used_mb, size_mb, timestamp=None):
+def size_trend(check, item, resource, levels, used_mb, size_mb, timestamp=None): # pylint: disable=function-redefined
"""Trend computation for size related checks of disks, ram, etc.
Trends are computed in two steps. In the first step the delta to
the last check is computed, using a normal check_mk counter.
diff --git a/cmk_base/check_api.py b/cmk_base/check_api.py
index 3258bae..78dd0a7 100644
--- a/cmk_base/check_api.py
+++ b/cmk_base/check_api.py
@@ -91,18 +91,17 @@ Global variables:
# concatenates lots of files, including this one.
# We import several modules here for the checks
-# pylint: disable=unused-import
# TODO: Move imports directly to checks?
-import collections
-import enum
-import fnmatch
+import collections # pylint: disable=unused-import
+import enum # pylint: disable=unused-import
+import fnmatch # pylint: disable=unused-import
import functools
-import math
+import math # pylint: disable=unused-import
import os
-import re
-import socket
-import sys
+import re # pylint: disable=unused-import
+import socket # pylint: disable=unused-import
+import sys # pylint: disable=unused-import
import time
# NOTE: We do not use pprint in this module, but it is part of the check API.
import pprint # pylint: disable=unused-import
@@ -115,7 +114,7 @@ import cmk.utils.debug as _debug
import cmk.utils.defines as _defines
import cmk.utils.paths as _paths
from cmk.utils.exceptions import MKGeneralException
-from cmk.utils.regex import regex
+from cmk.utils.regex import regex # pylint: disable=unused-import
import cmk.utils.render as render
# These imports are not meant for use in the API. So we prefix the names
@@ -123,7 +122,7 @@ import cmk.utils.render as render
# check context.
import cmk_base.utils as _utils
import cmk_base.config as _config
-import cmk_base.console as _console
+import cmk_base.console as _console # pylint: disable=unused-import
import cmk_base.snmp_utils as _snmp_utils
import cmk_base.item_state as _item_state
import cmk_base.prediction as _prediction
diff --git a/inventory/docker_container_labels b/inventory/docker_container_labels
index 197f692..d8b6195 100644
--- a/inventory/docker_container_labels
+++ b/inventory/docker_container_labels
@@ -24,8 +24,6 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
-# pylint: disable=undefined-variable
-
def parse_docker_container_labels(info):
version = docker_get_version(info)