Module: check_mk
Branch: master
Commit: 466fcfcef04b6eae6f8df1e93344da7f736e2e77
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=466fcfcef04b6e…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Nov 14 12:02:21 2017 +0100
Made special agent selection deterministic
When only a single special agent is used for a host, the selection
of the special agent to be executed is now deterministic in case
multiple special agent rules match for a host.
Change-Id: I4fa5c3536e1bdac1789feacd77c9fa8cb2247060
---
cmk_base/data_sources/__init__.py | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/cmk_base/data_sources/__init__.py b/cmk_base/data_sources/__init__.py
index 6b60086..ba17f5b 100644
--- a/cmk_base/data_sources/__init__.py
+++ b/cmk_base/data_sources/__init__.py
@@ -332,11 +332,16 @@ class DataSources(object):
return TCPDataSource()
- # TODO: It's not defined in which order the special agent rules overwrite
eachother.
def _get_special_agent_data_sources(self):
special_agents = []
- for agentname, ruleset in config.special_agents.items():
+ # Previous to 1.5.0 it was not defined in which order the special agent
+ # rules overwrite eachother. When multiple special agents were configured
+ # for a single host a "random" one was picked (depending on the
iteration
+ # over config.special_agents.
+ # We now sort the matching special agents by their name to at least get
+ # a deterministic order of the special agents.
+ for agentname, ruleset in sorted(config.special_agents.items()):
params = rulesets.host_extra_conf(self._hostname, ruleset)
if params:
source = SpecialAgentDataSource(agentname, params[0])