Module: check_mk
Branch: master
Commit: b686d5e963e28ec09a9985ba22722d7980c53d6d
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b686d5e963e28e…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Aug 29 15:11:20 2018 +0200
Add AC test for alert handlers being configured to handle each check execution
Change-Id: Ifc8cfcb159c1b4baf4182c26a392d8338ce833f5
---
cmk/gui/plugins/wato/ac_tests.py | 66 +++++++++++++++++++++++++++++-----------
1 file changed, 48 insertions(+), 18 deletions(-)
diff --git a/cmk/gui/plugins/wato/ac_tests.py b/cmk/gui/plugins/wato/ac_tests.py
index 2e53182..d170205 100644
--- a/cmk/gui/plugins/wato/ac_tests.py
+++ b/cmk/gui/plugins/wato/ac_tests.py
@@ -427,6 +427,26 @@ class ACMicrocoreTest(object):
return version.startswith("Check_MK")
+ def _get_effective_global_setting(self, varname):
+ global_settings = watolib.load_configuration_settings()
+ default_values = watolib.ConfigDomain().get_all_default_globals()
+
+ if watolib.is_wato_slave_site():
+ current_settings = watolib.load_configuration_settings(site_specific=True)
+ else:
+ sites = watolib.SiteManagementFactory.factory().load_sites()
+ current_settings = sites[config.omd_site()].get("globals", {})
+
+ if varname in current_settings:
+ value = current_settings[varname]
+ elif varname in global_settings:
+ value = global_settings[varname]
+ else:
+ value = default_values[varname]
+
+ return value
+
+
class ACApacheTest(object):
"""Abstract base class for apache related tests"""
@@ -643,29 +663,39 @@ class ACTestCheckMKHelperUsage(ACTest, ACMicrocoreTest):
yield cls(_("The current Check_MK helper usage is %.2f%%. The Check_MK
services have an "
"average check latency of %.3fs.") % (helper_usage_perc,
check_latecy_cmk))
+ # Only report this as warning in case the user increased the default helper
configuration
default_values = watolib.ConfigDomain().get_all_default_globals()
- def get_effective_global_setting(varname):
- global_settings = watolib.load_configuration_settings()
+ if self._get_effective_global_setting("cmc_cmk_helpers") >
default_values["cmc_cmk_helpers"] and helper_usage_perc < 50:
+ yield ACResultWARN(_("The helper usage is below 50%, you may decrease
the number of "
+ "Check_MK helpers to reduce the memory
consumption."))
- if watolib.is_wato_slave_site():
- current_settings =
watolib.load_configuration_settings(site_specific=True)
- else:
- sites = watolib.SiteManagementFactory.factory().load_sites()
- current_settings = sites[config.omd_site()].get("globals", {})
- if varname in current_settings:
- value = current_settings[varname]
- elif varname in global_settings:
- value = global_settings[varname]
- else:
- value = default_values[varname]
- return value
+class ACTestAlertHandlerEventTypes(ACTest, ACMicrocoreTest):
+ def category(self):
+ return ACTestCategories.performance
- # Only report this as warning in case the user increased the default helper
configuration
- if get_effective_global_setting("cmc_cmk_helpers") >
default_values["cmc_cmk_helpers"] and helper_usage_perc < 50:
- yield ACResultWARN(_("The helper usage is below 50%, you may decrease
the number of "
- "Check_MK helpers to reduce the memory
consumption."))
+
+ def title(self):
+ return _("Alert handler: Don't handle all check executions")
+
+
+ def help(self):
+ return _("In general it will result in a significantly increased load when
alert handlers are "
+ "configured to handle all check executions. It is highly recommended
to "
+ "<a
href=\"wato.py?mode=edit_configvar&varname=alert_handler_event_types\">disable
"
+ "this</a> in most cases.")
+
+
+ def is_relevant(self):
+ return self._uses_microcore()
+
+
+ def execute(self):
+ if "checkresult" in
self._get_effective_global_setting("alert_handler_event_types"):
+ yield ACResultCRIT(_("Alert handler are configured to handle all check
execution."))
+ else:
+ yield ACResultOK(_("Alert handlers will handle state changes."))