warning if the time period of a service is active
Message-ID: <5b59b334.24DGgBwKj6kmuJYL%si(a)mathias-kettner.de>
User-Agent: Heirloom mailx 12.5 6/20/10
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Module: check_mk
Branch: master
Commit: 686dfc015e4afa1634fd11cbcf4ec00370e36c81
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=686dfc015e4afa…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Thu Jul 26 11:22:27 2018 +0200
6385 FIX Check_MK service: Fixed 'missing agent sections' warning if the time
period of a service is active
Change-Id: I8d53566cb107abd25b1bc7f7198e0a92a9fd4d4c
---
.werks/6385 | 11 +++++++++++
cmk_base/checking.py | 7 ++++++-
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/.werks/6385 b/.werks/6385
new file mode 100644
index 0000000..e722555
--- /dev/null
+++ b/.werks/6385
@@ -0,0 +1,11 @@
+Title: Check_MK service: Fixed 'missing agent sections' warning if the time
period of a service is active
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1532596851
+
+
diff --git a/cmk_base/checking.py b/cmk_base/checking.py
index 8598ca8..6e36211 100644
--- a/cmk_base/checking.py
+++ b/cmk_base/checking.py
@@ -203,6 +203,11 @@ def _do_all_checks_on_host(sources, hostname, ipaddress,
only_check_plugin_names
success = execute_check(multi_host_sections, hostname, ipaddress,
check_plugin_name, item, params, description)
if success:
num_success += 1
+ elif success is None:
+ # If the service is in any timeperiod we do not want to
+ # - increase num_success or
+ # - add to missing sections
+ continue
else:
missing_sections.add(cmk_base.check_utils.section_name_of(check_plugin_name))
@@ -224,7 +229,7 @@ def execute_check(multi_host_sections, hostname, ipaddress,
check_plugin_name, i
period = config.check_period_of(hostname, description)
if period and not cmk_base.core.check_timeperiod(period):
console.verbose("Skipping service %s: currently not in timeperiod
%s.\n" % (description, period))
- return False
+ return None
elif period:
console.vverbose("Service %s: timeperiod %s is currently active.\n" %
(description, period))