Module: check_mk
Branch: master
Commit: 12d6172cafda8a73856b436fd716532bddd8afa2
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=12d6172cafda8a…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Wed Jan 13 10:35:33 2016 +0100
#2825 FIX Parameter overview page no longer raises an exception in certain scenarios
The parameter overview page raised an exception when the host in question never
got a service discovery and had an active check configured.
It also crashed for any "Classical active and passive Monitoring checks" check
with configured rule options, e.g a comment was set or the rule was deactivated.
---
.werks/2825 | 13 +++++++++++
ChangeLog | 1 +
modules/automation.py | 59 +++++++++++++++++++++++++++----------------------
3 files changed, 47 insertions(+), 26 deletions(-)
diff --git a/.werks/2825 b/.werks/2825
new file mode 100644
index 0000000..b97cc30
--- /dev/null
+++ b/.werks/2825
@@ -0,0 +1,13 @@
+Title: Parameter overview page no longer raises an exception in certain scenarios
+Level: 1
+Component: wato
+Compatible: compat
+Version: 1.2.7i4
+Date: 1452677246
+Class: fix
+
+The parameter overview page raised an exception when the host in question never
+got a service discovery and had an active check configured.
+
+It also crashed for any "Classical active and passive Monitoring checks" check
+with configured rule options, e.g a comment was set or the rule was deactivated.
diff --git a/ChangeLog b/ChangeLog
index 32c20d9..28e5c20 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -238,6 +238,7 @@
* 2793 FIX: Parameter Overview: Prevent python unicode warnings for services with
umlauts...
* 2845 FIX: LDAP: Fixed exception in connection test on complain issue during
connection creation
* 2779 FIX: Fix moving of folders...
+ * 2825 FIX: Parameter overview page no longer raises an exception in certain
scenarios...
Notifications:
* 2811 Mail notifications: Now able to add Host/Service Notes Url...
diff --git a/modules/automation.py b/modules/automation.py
index 84d9420..1944d3d 100644
--- a/modules/automation.py
+++ b/modules/automation.py
@@ -309,39 +309,46 @@ def automation_analyse_service(args):
# our service there
try:
path = "%s/%s.mk" % (autochecksdir, hostname)
- for entry in eval(file(path).read()):
- if len(entry) == 4: # old format
- hn, ct, item, params = entry
- else:
- ct, item, params = entry # new format without host name
- hn = hostname
-
- if (ct, item) not in check_table:
- continue # this is a removed duplicate or clustered service
- descr = service_description(ct, item)
- if hn == hostname and descr == servicedesc:
- dlv = check_info[ct].get("default_levels_variable")
- if dlv:
- fs = factory_settings.get(dlv, None)
+ if os.path.exists(path):
+ for entry in eval(file(path).read()):
+ if len(entry) == 4: # old format
+ hn, ct, item, params = entry
else:
- fs = None
-
- return {
- "origin" : "auto",
- "checktype" : ct,
- "checkgroup" :
check_info[ct].get("group"),
- "item" : item,
- "inv_parameters" : params,
- "factory_settings" : fs,
- "parameters" : compute_check_parameters(hostname, ct,
item, params),
- }
+ ct, item, params = entry # new format without host name
+ hn = hostname
+
+ if (ct, item) not in check_table:
+ continue # this is a removed duplicate or clustered service
+ descr = service_description(ct, item)
+ if hn == hostname and descr == servicedesc:
+ dlv = check_info[ct].get("default_levels_variable")
+ if dlv:
+ fs = factory_settings.get(dlv, None)
+ else:
+ fs = None
+
+ return {
+ "origin" : "auto",
+ "checktype" : ct,
+ "checkgroup" :
check_info[ct].get("group"),
+ "item" : item,
+ "inv_parameters" : params,
+ "factory_settings" : fs,
+ "parameters" : compute_check_parameters(hostname,
ct, item, params),
+ }
except:
if opt_debug:
raise
# 3. Classical checks
for nr, entry in enumerate(custom_checks):
- rule, tags, hosts = entry
+ if len(entry) == 4:
+ rule, tags, hosts, options = entry
+ if options.get("disabled"):
+ continue
+ else:
+ rule, tags, hosts = entry
+
matching_hosts = all_matching_hosts(tags, hosts, with_foreign_hosts = True)
if hostname in matching_hosts:
desc = rule["service_description"]