Module: check_mk
Branch: master
Commit: d9916d70c47b3efa189b2e48a8ab34b4bed5da5d
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d9916d70c47b3e…
Author: Tom Baerwinkel <tb(a)mathias-kettner.de>
Date: Mon Jun 4 16:40:50 2018 +0200
6114 Add a analyze configuration rule for ESX
A deprecation warning will be shown if The datasource program agent_vsphere
queries the Check_MK agent directly. This option will be removed in a future
release. The option 'Contact Check_MK agent and all enabled datasource
programs' should be configured for the affected hosts instead.
Change-Id: I3235684204e9f46d049fe48e11e47af57d3e4c20
---
.werks/6114 | 13 +++++++++++++
web/htdocs/watolib.py | 2 ++
web/plugins/wato/ac_tests.py | 37 +++++++++++++++++++++++++++++++++++++
3 files changed, 52 insertions(+)
diff --git a/.werks/6114 b/.werks/6114
new file mode 100644
index 0000000..50bc4fd
--- /dev/null
+++ b/.werks/6114
@@ -0,0 +1,13 @@
+Title: Add a analyze configuration rule for ESX
+Level: 1
+Component: multisite
+Compatible: compat
+Edition: cre
+Version: 1.6.0i1
+Date: 1528122978
+Class: feature
+
+A deprecation warning will be shown if The datasource program agent_vsphere
+queries the Check_MK agent directly. This option will be removed in a future
+release. The option 'Contact Check_MK agent and all enabled datasource
+programs' should be configured for the affected hosts instead.
diff --git a/web/htdocs/watolib.py b/web/htdocs/watolib.py
index bcb18b7..b9181cd 100644
--- a/web/htdocs/watolib.py
+++ b/web/htdocs/watolib.py
@@ -9627,6 +9627,7 @@ class ACTestCategories(object):
performance = "performance"
security = "security"
reliability = "reliability"
+ deprecations = "deprecations"
@classmethod
@@ -9636,6 +9637,7 @@ class ACTestCategories(object):
"performance" : _("Performance"),
"security" : _("Security"),
"reliability" : _("Reliability"),
+ "deprecations" : _("Deprecations"),
}[ident]
diff --git a/web/plugins/wato/ac_tests.py b/web/plugins/wato/ac_tests.py
index 7c662b5..6541a0c 100644
--- a/web/plugins/wato/ac_tests.py
+++ b/web/plugins/wato/ac_tests.py
@@ -668,3 +668,40 @@ class ACTestSizeOfExtensions(ACTest):
def _size_of_extensions(self):
return int(subprocess.check_output(["du", "-sb",
"%s/local" % cmk.paths.omd_root]).split()[0])
+
+
+class ACTestESXDatasources(ACTest):
+ def category(self):
+ return ACTestCategories.deprecations
+
+ def title(self):
+ return _("The Check_MK agent is queried via the ESX datasource
program")
+
+ def help(self):
+ return _("The Check_MK agent is queried via the datasource program for ESX
systems. "
+ "This is option will be deleted in a future release. Please
configure the "
+ "host to contact the Check_MK agent and the configured datasource
programs "
+ "instead.")
+
+ def _get_rules(self):
+ collection = watolib.SingleRulesetRecursively('special_agents:vsphere')
+ collection.load()
+
+ ruleset = collection.get('special_agents:vsphere')
+ return ruleset.get_rules()
+
+ def is_relevant(self):
+ return self._get_rules()
+
+ def execute(self):
+ all_rules_ok = True
+ for folder, rule_index, rule in self._get_rules():
+ rule_config = rule.to_dict_config()
+ vsphere_queries_agent = (rule_config['value'].get('direct')
+ in ['agent', 'hostsystem_agent'])
+ if vsphere_queries_agent:
+ all_rules_ok = False
+ yield ACResultCRIT("Rule %d in Folder %s is affected" %
(rule_index + 1, folder.title()))
+
+ if all_rules_ok:
+ yield ACResultOK(_("No configured rules are affected"))