Module: check_mk
Branch: master
Commit: 04f67dbfa287f53a346588576430b5a035d6eb0e
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=04f67dbfa287f5…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Apr 25 09:26:04 2019 +0200
Cleanup unnecessary host_extra_conf() call
CMK-2030
Change-Id: I16134ced4c635d4fa112b48eb4fab4e0694e5fbf
---
cmk_base/config.py | 7 ++++++-
cmk_base/core_nagios.py | 10 ++++------
2 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/cmk_base/config.py b/cmk_base/config.py
index abd9951..4b40161 100644
--- a/cmk_base/config.py
+++ b/cmk_base/config.py
@@ -2333,12 +2333,17 @@ class HostConfig(object):
# TODO: Move cluster/node parent handling to this function
def _get_parents(self):
# type: () -> List[str]
- """Use only those parents which are defined and active in all_hosts"""
+ """Returns the parents of a host configured via ruleset "parents"
+
+ Use only those parents which are defined and active in all_hosts"""
used_parents = []
+
+ # Respect the ancient parents ruleset. This can not be configured via WATO and should be removed one day
for parent_names in self._config_cache.host_extra_conf(self.hostname, parents):
for parent_name in parent_names.split(","):
if parent_name in self._config_cache.all_active_realhosts():
used_parents.append(parent_name)
+
return used_parents
def _get_host_labels(self):
diff --git a/cmk_base/core_nagios.py b/cmk_base/core_nagios.py
index 7676802..dc96647 100644
--- a/cmk_base/core_nagios.py
+++ b/cmk_base/core_nagios.py
@@ -223,12 +223,9 @@ def _create_nagios_host_spec(cfg, config_cache, hostname, attrs):
if not host_config.is_cluster:
# Parents for non-clusters
- # Get parents manually defined via extra_host_conf["parents"]. Only honor
- # variable "parents" and implicit parents if this setting is empty
- extra_conf_parents = config_cache.host_extra_conf(hostname,
- config.extra_host_conf.get("parents", []))
-
- if not extra_conf_parents:
+ # Get parents explicitly defined for host/folder via extra_host_conf["parents"]. Only honor
+ # the ruleset "parents" in case no explicit parents are set
+ if not attrs.get("parents", []):
parents_list = host_config.parents
if parents_list:
host_spec["parents"] = ",".join(parents_list)
@@ -241,6 +238,7 @@ def _create_nagios_host_spec(cfg, config_cache, hostname, attrs):
host_spec.update(
_extra_host_conf_of(
config_cache, hostname, exclude=["parents"] if host_config.is_cluster else []))
+
return host_spec
Module: check_mk
Branch: master
Commit: 5f904fec4bbe7b709d5bde240dd36933ef0d50d6
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5f904fec4bbe7b…
Author: Moritz Kiemer <mo(a)mathias-kettner.de>
Date: Fri Apr 26 15:03:18 2019 +0200
agent_aws: factor out validation by arguments (again)
Change-Id: Iddb5ec7be536396865749d8d09f0853ee62d38f7
---
cmk/special_agents/agent_aws.py | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/cmk/special_agents/agent_aws.py b/cmk/special_agents/agent_aws.py
index 2191e1f..7c5804f 100644
--- a/cmk/special_agents/agent_aws.py
+++ b/cmk/special_agents/agent_aws.py
@@ -624,7 +624,8 @@ class AWSSection(object):
# Cache is only used if the age is lower than section interval AND
# the collected data from colleagues are not newer
self._cache_file_dir.mkdir(parents=True, exist_ok=True)
- if use_cache and self._cache_is_recent_enough(colleague_contents):
+ if (use_cache and self.get_validity_from_args(colleague_contents) and
+ self._cache_is_recent_enough()):
raw_content, cache_timestamp = self._read_from_cache()
else:
raw_content = self._fetch_raw_content(colleague_contents)
@@ -648,20 +649,26 @@ class AWSSection(object):
logging.info("Cannot calculate cache file age: %s", e)
raise
- def _cache_is_recent_enough(self, colleague_contents):
+ def _cache_is_recent_enough(self):
mtime = self.cache_timestamp
if mtime is None:
return False
age = time.time() - mtime
+ if 0 <= age < self.interval:
+ return True
+
if age < 0:
logging.info("Cache file from future considered invalid: %s", self._cache_file)
- return False
-
- if age >= self.interval:
+ else:
logging.info("Cache file %s is outdated", self._cache_file)
+ return False
+
+ def get_validity_from_args(self, colleague_contents):
+ my_cache_timestamp = self.cache_timestamp
+ if my_cache_timestamp is None:
return False
- if colleague_contents.cache_timestamp > mtime:
+ if colleague_contents.cache_timestamp > my_cache_timestamp:
logging.info("Colleague data is newer than cache file %s", self._cache_file)
return False
return True
Module: check_mk
Branch: master
Commit: 1016afdc1fe6a72cebd91f533729c25d50d48ece
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1016afdc1fe6a7…
Author: Tom Baerwinkel <tb(a)mathias-kettner.de>
Date: Mon Apr 1 11:59:11 2019 +0200
7416 k8s_resources: now uses default levels of 90% and 95?%
Change-Id: I76627a65d1ba47888ee2de145d91834b31efce48
---
.werks/7416 | 9 +++++++++
checkman/k8s_resources.cpu | 4 ++--
checkman/k8s_resources.memory | 4 ++--
checkman/k8s_resources.pods | 4 ++--
checks/k8s_resources | 9 +++++++++
5 files changed, 24 insertions(+), 6 deletions(-)
diff --git a/.werks/7416 b/.werks/7416
new file mode 100644
index 0000000..f694180
--- /dev/null
+++ b/.werks/7416
@@ -0,0 +1,9 @@
+Title: k8s_resources: now uses default levels of 90% and 95?%
+Level: 1
+Component: checks
+Compatible: incomp
+Edition: cre
+Version: 1.6.0i1
+Date: 1556108625
+Class: feature
+
diff --git a/checkman/k8s_resources.cpu b/checkman/k8s_resources.cpu
index 7f3940d..0fb5eb1 100644
--- a/checkman/k8s_resources.cpu
+++ b/checkman/k8s_resources.cpu
@@ -8,8 +8,8 @@ description:
a Kubernetes entity. If at least one container running on a node does not specify
limits, the node has no applicable limits.
- By default the check always returns {OK}. Optionally levels can be defined
- for the CPU usage, i.e. the ratio between requested and allocatable CPU.
+ The check returns {OK} if the used CPU is below 90%. Below 95% {WARN}
+ is returned and otherwise {CRIT}. Custom levels can be defined in WATO.
inventory:
One service is created.
diff --git a/checkman/k8s_resources.memory b/checkman/k8s_resources.memory
index 62bb2b9..a44f4c9 100644
--- a/checkman/k8s_resources.memory
+++ b/checkman/k8s_resources.memory
@@ -8,8 +8,8 @@ description:
of a Kubernetes entity. If at least one container running on a node does not specify
limits, the node has no applicable limits.
- By default the check always returns {OK}. Optionally levels can be defined
- for the Memory usage, i.e. the ratio between requested and allocatable Memory.
+ The check returns {OK} if the used Memroy is below 90%. Below 95% {WARN}
+ is returned and otherwise {CRIT}. Custom levels can be defined in WATO.
inventory:
One service is created.
diff --git a/checkman/k8s_resources.pods b/checkman/k8s_resources.pods
index e2028e4..24eb474 100644
--- a/checkman/k8s_resources.pods
+++ b/checkman/k8s_resources.pods
@@ -6,8 +6,8 @@ distribution: check_mk
description:
This check monitors the pods of Kubernetes nodes and clusters.
- By default the check always returns {OK}. Optionally levels can be defined
- for the Pod usage, i.e. the ratio between used and allocatable Pods.
+ The check returns {OK} if the used Pods are below 90%. Below 95% {WARN}
+ is returned and otherwise {CRIT}. Custom levels can be defined in WATO.
inventory:
One service is created.
diff --git a/checks/k8s_resources b/checks/k8s_resources
index 45b6161..08246f7 100644
--- a/checks/k8s_resources
+++ b/checks/k8s_resources
@@ -24,6 +24,12 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
+factory_settings['k8s_resources_default_levels'] = {
+ 'cpu': (90.0, 95.0),
+ 'memory': (90.0, 95.0),
+ 'pods': (90.0, 95.0),
+}
+
def get_k8s_resources_inventory_function(name):
def inventory_function(parsed):
@@ -77,6 +83,7 @@ check_info['k8s_resources.pods'] = {
'service_description': 'Pod resources',
'has_perfdata': True,
'group': 'k8s_resources',
+ 'default_levels_variable': 'k8s_resources_default_levels',
}
check_info['k8s_resources.cpu'] = {
@@ -85,6 +92,7 @@ check_info['k8s_resources.cpu'] = {
'service_description': 'CPU resources',
'has_perfdata': True,
'group': 'k8s_resources',
+ 'default_levels_variable': 'k8s_resources_default_levels',
}
check_info['k8s_resources.memory'] = {
@@ -93,4 +101,5 @@ check_info['k8s_resources.memory'] = {
'service_description': 'Memory resources',
'has_perfdata': True,
'group': 'k8s_resources',
+ 'default_levels_variable': 'k8s_resources_default_levels',
}
Module: check_mk
Branch: master
Commit: adcb1a91fee0045998f35b8addce86b363128414
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=adcb1a91fee004…
Author: Tom Baerwinkel <tb(a)mathias-kettner.de>
Date: Wed Apr 24 14:23:26 2019 +0200
7415 Extensions for the Kubernetes special agent and checks
This werk introduces multiple extensions for the Kubernetes special
agent, new checks and inventory plugins:
- The special agent now provides piggyback data for Pods, Deployments and Services.
- The piggyback output is optional and can be configured via the rule for the special agent.
- The special agent now outputs the Kubernetes labels for piggyback hosts. They are shown
in the HW/SW invenotry and on the host detail page of the hosts. You can add the labels to
other views and use the labels to filter your views. The labels will be used in more
upcoming features in the future.
- The check k8s_resouces is now used for Pods as well.
- The new summary check k8s_pod_container for the Pods of a container is added.
- The new inventory plugin k8s_pod_info shows Pod information in the HW/SW inventory.
- The new check k8s_replicas monitors the replica sets of Deployments.
- The new inventory plugin k8s_service_info shows information about Kubernetes Services.
- The new inventory plugin k8s_selector shows the selectors of Kubernetes Services.
- The new check k8s_service_port monitors the Ports defined for Kubernetes Services.
Change-Id: I3cf7545bc2680b6f536a00999a2df53c91a99242
---
.werks/7415 | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/.werks/7415 b/.werks/7415
new file mode 100644
index 0000000..cc79df5
--- /dev/null
+++ b/.werks/7415
@@ -0,0 +1,25 @@
+Title: Extensions for the Kubernetes special agent and checks
+Level: 2
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.6.0i1
+Date: 1556096926
+Class: feature
+
+This werk introduces multiple extensions for the Kubernetes special
+agent, new checks and inventory plugins:
+
+- The special agent now provides piggyback data for Pods, Deployments and Services.
+- The piggyback output is optional and can be configured via the rule for the special agent.
+- The special agent now outputs the Kubernetes labels for piggyback hosts. They are shown
+ in the HW/SW invenotry and on the host detail page of the hosts. You can add the labels to
+ other views and use the labels to filter your views. The labels will be used in more
+ upcoming features in the future.
+- The check k8s_resouces is now used for Pods as well.
+- The new summary check k8s_pod_container for the Pods of a container is added.
+- The new inventory plugin k8s_pod_info shows Pod information in the HW/SW inventory.
+- The new check k8s_replicas monitors the replica sets of Deployments.
+- The new inventory plugin k8s_service_info shows information about Kubernetes Services.
+- The new inventory plugin k8s_selector shows the selectors of Kubernetes Services.
+- The new check k8s_service_port monitors the Ports defined for Kubernetes Services.