Module: check_mk
Branch: master
Commit: 346c4b85c76f6de1f839bb9054ac6725f22911e7
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=346c4b85c76f6d…
Author: Tom Baerwinkel <tb(a)mathias-kettner.de>
Date: Thu Mar 28 14:32:11 2019 +0100
agent_kubernetes: ensure uniqueness of piggyback hostnames
Change-Id: I804e5746e44bb3db2d6c41f616c7368b8f3cd1ed
---
cmk/special_agents/agent_kubernetes.py | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/cmk/special_agents/agent_kubernetes.py b/cmk/special_agents/agent_kubernetes.py
index 641cec6..aa93b47 100644
--- a/cmk/special_agents/agent_kubernetes.py
+++ b/cmk/special_agents/agent_kubernetes.py
@@ -778,11 +778,18 @@ class Group(object):
section.insert(data)
return self
- def output(self):
- # type: () -> List[str]
+ def output(self, piggyback_prefix=""):
+ # type: (str) -> List[str]
+ # The names of elements may not be unique. Kubernetes guarantees e.g. that
+ # only one object of a given kind can have one one name at a time. I.e.
+ # there may only be one deployment with the name "foo", but there may exist
+ # a service with name "foo" as well.
+ # To obtain unique names for piggyback hosts it is therefore possible to
+ # specify a name prefix.
+ # see: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#na…
data = []
for name, element in self.elements.iteritems():
- data.append('<<<<%s>>>>' % name)
+ data.append('<<<<%s>>>>' % (piggyback_prefix + name))
data.extend(element.output())
data.append('<<<<>>>>')
return data
@@ -972,7 +979,7 @@ class ApiData(object):
g.join('k8s_resources', self.pods.pods_per_node())
g.join('k8s_stats', self.nodes.stats())
g.join('k8s_conditions', self.nodes.conditions())
- return '\n'.join(g.output())
+ return '\n'.join(g.output(piggyback_prefix="node_"))
def custom_metrics_section(self):
# type: () -> str
@@ -989,7 +996,7 @@ class ApiData(object):
g.join('k8s_resources', self.pods.resources())
g.join('k8s_pod_container', self.pods.containers())
g.join('k8s_pod_info', self.pods.info())
- return '\n'.join(g.output())
+ return '\n'.join(g.output(piggyback_prefix="pod_"))
def service_sections(self):
logging.info('Output service sections')
@@ -997,14 +1004,14 @@ class ApiData(object):
g.join('labels', self.services.labels())
g.join('k8s_service_info', self.services.infos())
g.join('k8s_service_ports', self.services.ports())
- return '\n'.join(g.output())
+ return '\n'.join(g.output(piggyback_prefix="service_"))
def deployment_sections(self):
logging.info('Output node sections')
g = Group()
g.join('labels', self.deployments.labels())
g.join('k8s_replicas', self.deployments.replicas())
- return '\n'.join(g.output())
+ return '\n'.join(g.output(piggyback_prefix="deployment_"))
def get_api_client(arguments):
Module: check_mk
Branch: master
Commit: 85726ac224710112bbaf0ebbf1c0e1eab3e456cb
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=85726ac2247101…
Author: Ronny Bruska <rb(a)mathias-kettner.de>
Date: Wed Mar 20 20:53:21 2019 +0100
7202 Elasticsearch Monitoring
A special agent and first checks to support monitoring of Elasticsearch cluster, nodes and indices.
With this werk it is possible to monitor the cluster and node states of an elasticsearch instance.
LI: elasticsearch_cluster_health: State of the cluster (eg. green/yellow/red), Name, Number of nodes, Number of data nodes
LI: elasticsearch_cluster_health.shards: Number of shards in different states
LI: elasticsearch_cluster_health.tasks: Pending tasks, Task max waiting, Time out of tasks
LI: elasticsearch_nodes: Total virtual memory, CPU usage, Number of open file descriptors of nodes
For each check it is possible to set parameter in the associated WATO rule.
Checks for Cluster, Indices and Shard statistics follow soon.
Thanks to Fabian Binder for creating the initial version of the agent and checks!
Change-Id: I69b2e1c3653265b3645fdc8d8d9f059eae974079
---
.werks/7202 | 24 +++
agents/special/agent_elasticsearch | 182 ++++++++++++++++
checkman/elasticsearch_cluster_health | 15 ++
checkman/elasticsearch_cluster_health.info | 12 ++
checkman/elasticsearch_cluster_health.shards | 13 ++
checkman/elasticsearch_cluster_health.tasks | 12 ++
checkman/elasticsearch_nodes | 16 ++
checks/agent_elasticsearch | 53 +++++
checks/elasticsearch_cluster_health | 206 ++++++++++++++++++
checks/elasticsearch_nodes | 102 +++++++++
cmk/gui/plugins/metrics/check_mk.py | 97 +++++++++
.../elasticsearch_cluster_health.py | 232 +++++++++++++++++++++
.../wato/check_parameters/elasticsearch_nodes.py | 86 ++++++++
cmk/gui/plugins/wato/datasource_programs.py | 76 +++++++
cmk/utils/man_pages.py | 1 +
.../datasets/elasticsearch_cluster_health.py | 79 +++++++
.../generictests/datasets/elasticsearch_nodes.py | 150 +++++++++++++
17 files changed, 1356 insertions(+)
Diff: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commitdiff;h=85726ac224…