Module: check_mk
Branch: master
Commit: 9ed469e44b43e4a5d99a7d23c094e943a5ed31bc
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9ed469e44b43e4…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Nov 20 13:10:22 2017 +0100
Fixed merging sections from cluster nodes for cluster hosts together
Change-Id: Idd0ba73da88cf7e2411bb28dbfff588281f64198
---
cmk_base/data_sources/__init__.py | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/cmk_base/data_sources/__init__.py b/cmk_base/data_sources/__init__.py
index d8eacb7..de441d4 100644
--- a/cmk_base/data_sources/__init__.py
+++ b/cmk_base/data_sources/__init__.py
@@ -168,23 +168,29 @@ def get_info_for_check(all_host_infos, hostname, ipaddress,
check_type, for_disc
else:
host_entries.append((hostname, ipaddress))
- # Now extract the sections of the relevant hosts and optionally add the node info
- info = None
+ # Now get the section_content from the required hosts and merge them together to
+ # a single section_content. For each host optionally add the node info.
+ section_content = None
for host_entry in host_entries:
try:
- info = all_host_infos[host_entry].info[section_name]
+ host_section_content = all_host_infos[host_entry].info[section_name]
except KeyError:
continue
- info = _update_info_with_node_info(info, check_type, host_entry[0],
for_discovery)
- info = _update_info_with_parse_function(info, section_name)
+ host_section_content = _update_info_with_node_info(host_section_content,
check_type, host_entry[0], for_discovery)
- if info is None:
+ if section_content is None:
+ section_content = []
+
+ section_content += host_section_content
+
+ if section_content is None:
return None
- info = _update_info_with_extra_sections(info, all_host_infos, hostname, ipaddress,
section_name, for_discovery)
+ section_content = _update_info_with_parse_function(section_content, section_name)
+ section_content = _update_info_with_extra_sections(section_content, all_host_infos,
hostname, ipaddress, section_name, for_discovery)
- return info
+ return section_content
def _update_info_with_node_info(info, check_type, hostname, for_discovery):