Module: check_mk
Branch: master
Commit: 9ab6370466c63351a619218c46b565fbf655c1c1
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9ab6370466c633…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Apr 26 16:27:20 2019 +0200
Fix handling of not existing active checks
Change-Id: I592314bbef48d9436e1b8eed60411f75b274bae4
---
cmk_base/automations/check_mk.py | 30 +++++++++++++++++-------------
1 file changed, 17 insertions(+), 13 deletions(-)
diff --git a/cmk_base/automations/check_mk.py b/cmk_base/automations/check_mk.py
index 94e416a..e76b1c3 100644
--- a/cmk_base/automations/check_mk.py
+++ b/cmk_base/automations/check_mk.py
@@ -1320,22 +1320,26 @@ class AutomationActiveCheck(Automation):
return self._execute_check_plugin(command_line)
return -1, "Passive check - cannot be executed"
- else:
+
+ try:
act_info = config.active_check_info[plugin]
- # Set host name for host_name()-function (part of the Check API)
- # (used e.g. by check_http)
- check_api_utils.set_hostname(hostname)
+ except KeyError:
+ return None
- for params in dict(host_config.active_checks).get(plugin, []):
- description = config.active_check_service_description(hostname, plugin,
params)
- if description != item:
- continue
+ # Set host name for host_name()-function (part of the Check API)
+ # (used e.g. by check_http)
+ check_api_utils.set_hostname(hostname)
+
+ for params in dict(host_config.active_checks).get(plugin, []):
+ description = config.active_check_service_description(hostname, plugin,
params)
+ if description != item:
+ continue
- args = core_config.active_check_arguments(hostname, description,
-
act_info["argument_function"](params))
- command_line = self._replace_core_macros(
- hostname,
act_info["command_line"].replace("$ARG1$", args))
- return self._execute_check_plugin(command_line)
+ args = core_config.active_check_arguments(hostname, description,
+
act_info["argument_function"](params))
+ command_line = self._replace_core_macros(
+ hostname, act_info["command_line"].replace("$ARG1$",
args))
+ return self._execute_check_plugin(command_line)
def _load_resource_file(self, macros):
try: