Module: check_mk
Branch: master
Commit: 28bd34ff86216b8d511a3c70eb82646a660961e5
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=28bd34ff86216b…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Apr 26 07:55:44 2019 +0200
Move flap settings ruleset processing to HostConfig/ConfigCache
CMK-2030
Change-Id: If0b606a799cb5584e35c7de6e9247a4ee01e020b
---
cmk_base/config.py | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/cmk_base/config.py b/cmk_base/config.py
index 3af05ac..2294a81 100644
--- a/cmk_base/config.py
+++ b/cmk_base/config.py
@@ -3627,6 +3627,14 @@ class CEEConfigCache(ConfigCache):
# type: (str, Text) -> List[Dict[str, Union[int, str]]]
return self.service_extra_conf(hostname, description,
service_recurring_downtimes)
+ def flap_settings_of_service(self, hostname, description):
+ # type: (str, Text) -> Tuple[float, float, float]
+ values = self.service_extra_conf(hostname, description,
cmc_service_flap_settings)
+ if not values:
+ return cmc_flap_settings
+
+ return values[0]
+
# TODO: Find a clean way to move this to cmk_base.cee. This will be possible once the
# configuration settings are not held in cmk_base.config namespace anymore.
@@ -3645,3 +3653,12 @@ class CEEHostConfig(HostConfig):
def recurring_downtimes(self):
# type: () -> List[Dict[str, Union[int, str]]]
return self._config_cache.host_extra_conf(self.hostname,
host_recurring_downtimes)
+
+ @property
+ def flap_settings(self):
+ # type: () -> Tuple[float, float, float]
+ values = self._config_cache.host_extra_conf(self.hostname,
cmc_host_flap_settings)
+ if not values:
+ return cmc_flap_settings
+
+ return values[0]