Module: check_mk
Branch: master
Commit: 2f6885a55ae1aa0a5c3317cb21db242be02cfd3f
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=2f6885a55ae1aa…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri May 25 09:42:39 2018 +0200
6170 FIX Raw Edition: Fixed monitoring using special agents
When trying to monitor hosts using special agents as data sources with nagios, this
failed with an error like this:
"UNKN - [special_vsphere] 'vsphere'UNKN, Got no information from host,
execution time 0.0 sec"
Change-Id: I9748eeba8106c5c330220a714a3f7b4e4cbaedcb
---
.werks/6170 | 14 ++++++++++++++
cmk_base/core_nagios.py | 8 ++++++++
cmk_base/data_sources/programs.py | 5 +++++
3 files changed, 27 insertions(+)
diff --git a/.werks/6170 b/.werks/6170
new file mode 100644
index 0000000..de7c1db
--- /dev/null
+++ b/.werks/6170
@@ -0,0 +1,14 @@
+Title: Raw Edition: Fixed monitoring using special agents
+Level: 2
+Component: core
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1527233679
+
+When trying to monitor hosts using special agents as data sources with nagios, this
+failed with an error like this:
+
+"UNKN - [special_vsphere] 'vsphere'UNKN, Got no information from host,
execution time 0.0 sec"
diff --git a/cmk_base/core_nagios.py b/cmk_base/core_nagios.py
index 68719bf..edaa0f4 100644
--- a/cmk_base/core_nagios.py
+++ b/cmk_base/core_nagios.py
@@ -42,6 +42,7 @@ import cmk_base.checks as checks
import cmk_base.rulesets as rulesets
import cmk_base.core_config as core_config
import cmk_base.ip_lookup as ip_lookup
+import cmk_base.data_sources as data_sources
def do_check_nagiosconfig():
@@ -1022,6 +1023,13 @@ if '-d' in sys.argv:
needed_check_plugin_names = set([])
+ # In case the host is monitored as special agent, the check plugin for the special
agent needs
+ # to be loaded
+ sources = data_sources.DataSources(hostname, ipaddress=None)
+ for source in sources.get_data_sources():
+ if isinstance(source, data_sources.programs.SpecialAgentDataSource):
+ needed_check_plugin_names.add(source.special_agent_plugin_file_name)
+
# Collect the needed check plugin names using the host check table
for check_plugin_name, _unused_item, _unused_param, descr in host_check_table:
if check_plugin_name not in checks.check_info:
diff --git a/cmk_base/data_sources/programs.py b/cmk_base/data_sources/programs.py
index e3f49e4..4dcf381 100644
--- a/cmk_base/data_sources/programs.py
+++ b/cmk_base/data_sources/programs.py
@@ -169,6 +169,11 @@ class SpecialAgentDataSource(ProgramDataSource):
return "special_%s" % self._special_agent_id
+ @property
+ def special_agent_plugin_file_name(self):
+ return "agent_%s" % self._special_agent_id
+
+
def _get_individual_exit_code_spec(self, exit_code_spec):
return exit_code_spec["individual"]["special"]