summaryrefslogtreecommitdiffstats
path: root/collectors/python.d.plugin/elasticsearch
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2018-11-07 12:22:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2018-11-07 12:22:44 +0000
commit1e6c93250172946eeb38e94a92a1fd12c9d3011e (patch)
tree8ca5e16dfc7ad6b3bf2738ca0a48408a950f8f7e /collectors/python.d.plugin/elasticsearch
parentUpdate watch file (diff)
downloadnetdata-1e6c93250172946eeb38e94a92a1fd12c9d3011e.tar.xz
netdata-1e6c93250172946eeb38e94a92a1fd12c9d3011e.zip
Merging upstream version 1.11.0+dfsg.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--collectors/python.d.plugin/elasticsearch/Makefile.inc13
-rw-r--r--collectors/python.d.plugin/elasticsearch/README.md60
-rw-r--r--collectors/python.d.plugin/elasticsearch/elasticsearch.chart.py (renamed from python.d/elasticsearch.chart.py)220
-rw-r--r--collectors/python.d.plugin/elasticsearch/elasticsearch.conf (renamed from conf.d/python.d/elasticsearch.conf)0
4 files changed, 228 insertions, 65 deletions
diff --git a/collectors/python.d.plugin/elasticsearch/Makefile.inc b/collectors/python.d.plugin/elasticsearch/Makefile.inc
new file mode 100644
index 000000000..15c63c2fa
--- /dev/null
+++ b/collectors/python.d.plugin/elasticsearch/Makefile.inc
@@ -0,0 +1,13 @@
+# SPDX-License-Identifier: GPL-3.0-or-later
+
+# THIS IS NOT A COMPLETE Makefile
+# IT IS INCLUDED BY ITS PARENT'S Makefile.am
+# IT IS REQUIRED TO REFERENCE ALL FILES RELATIVE TO THE PARENT
+
+# install these files
+dist_python_DATA += elasticsearch/elasticsearch.chart.py
+dist_pythonconfig_DATA += elasticsearch/elasticsearch.conf
+
+# do not install these files, but include them in the distribution
+dist_noinst_DATA += elasticsearch/README.md elasticsearch/Makefile.inc
+
diff --git a/collectors/python.d.plugin/elasticsearch/README.md b/collectors/python.d.plugin/elasticsearch/README.md
new file mode 100644
index 000000000..75e17015b
--- /dev/null
+++ b/collectors/python.d.plugin/elasticsearch/README.md
@@ -0,0 +1,60 @@
+# elasticsearch
+
+This module monitors Elasticsearch performance and health metrics.
+
+It produces:
+
+1. **Search performance** charts:
+ * Number of queries, fetches
+ * Time spent on queries, fetches
+ * Query and fetch latency
+
+2. **Indexing performance** charts:
+ * Number of documents indexed, index refreshes, flushes
+ * Time spent on indexing, refreshing, flushing
+ * Indexing and flushing latency
+
+3. **Memory usage and garbace collection** charts:
+ * JVM heap currently in use, committed
+ * Count of garbage collections
+ * Time spent on garbage collections
+
+4. **Host metrics** charts:
+ * Available file descriptors in percent
+ * Opened HTTP connections
+ * Cluster communication transport metrics
+
+5. **Queues and rejections** charts:
+ * Number of queued/rejected threads in thread pool
+
+6. **Fielddata cache** charts:
+ * Fielddata cache size
+ * Fielddata evictions and circuit breaker tripped count
+
+7. **Cluster health API** charts:
+ * Cluster status
+ * Nodes and tasks statistics
+ * Shards statistics
+
+8. **Cluster stats API** charts:
+ * Nodes statistics
+ * Query cache statistics
+ * Docs statistics
+ * Store statistics
+ * Indices and shards statistics
+
+### configuration
+
+Sample:
+
+```yaml
+local:
+ host : 'ipaddress' # Server ip address or hostname
+ port : 'password' # Port on which elasticsearch listed
+ cluster_health : True/False # Calls to cluster health elasticsearch API. Enabled by default.
+ cluster_stats : True/False # Calls to cluster stats elasticsearch API. Enabled by default.
+```
+
+If no configuration is given, module will fail to run.
+
+---
diff --git a/python.d/elasticsearch.chart.py b/collectors/python.d.plugin/elasticsearch/elasticsearch.chart.py
index 9c2c58944..3f431f6e0 100644
--- a/python.d/elasticsearch.chart.py
+++ b/collectors/python.d.plugin/elasticsearch/elasticsearch.chart.py
@@ -1,11 +1,14 @@
# -*- coding: utf-8 -*-
# Description: elastic search node stats netdata python.d module
# Author: l2isbad
+# SPDX-License-Identifier: GPL-3.0-or-later
+
+import json
+import threading
from collections import namedtuple
-from json import loads
from socket import gethostbyname, gaierror
-from threading import Thread
+
try:
from queue import Queue
except ImportError:
@@ -15,8 +18,6 @@ from bases.FrameworkServices.UrlService import UrlService
# default module values (can be overridden per job in `config`)
update_every = 5
-priority = 60000
-retries = 60
METHODS = namedtuple('METHODS', ['get_data', 'url', 'run'])
@@ -63,6 +64,8 @@ NODE_STATS = [
'jvm.buffer_pools.mapped.total_capacity_in_bytes',
'thread_pool.bulk.queue',
'thread_pool.bulk.rejected',
+ 'thread_pool.write.queue',
+ 'thread_pool.write.rejected',
'thread_pool.index.queue',
'thread_pool.index.rejected',
'thread_pool.search.queue',
@@ -107,30 +110,62 @@ HEALTH_STATS = [
]
LATENCY = {
- 'query_latency':
- {'total': 'indices_search_query_total',
- 'spent_time': 'indices_search_query_time_in_millis'},
- 'fetch_latency':
- {'total': 'indices_search_fetch_total',
- 'spent_time': 'indices_search_fetch_time_in_millis'},
- 'indexing_latency':
- {'total': 'indices_indexing_index_total',
- 'spent_time': 'indices_indexing_index_time_in_millis'},
- 'flushing_latency':
- {'total': 'indices_flush_total',
- 'spent_time': 'indices_flush_total_time_in_millis'}
+ 'query_latency': {
+ 'total': 'indices_search_query_total',
+ 'spent_time': 'indices_search_query_time_in_millis'
+ },
+ 'fetch_latency': {
+ 'total': 'indices_search_fetch_total',
+ 'spent_time': 'indices_search_fetch_time_in_millis'
+ },
+ 'indexing_latency': {
+ 'total': 'indices_indexing_index_total',
+ 'spent_time': 'indices_indexing_index_time_in_millis'
+ },
+ 'flushing_latency': {
+ 'total': 'indices_flush_total',
+ 'spent_time': 'indices_flush_total_time_in_millis'
+ }
}
# charts order (can be overridden if you want less charts, or different order)
-ORDER = ['search_performance_total', 'search_performance_current', 'search_performance_time',
- 'search_latency', 'index_performance_total', 'index_performance_current', 'index_performance_time',
- 'index_latency', 'index_translog_operations', 'index_translog_size', 'index_segments_count', 'index_segments_memory_writer',
- 'index_segments_memory', 'jvm_mem_heap', 'jvm_mem_heap_bytes', 'jvm_buffer_pool_count',
- 'jvm_direct_buffers_memory', 'jvm_mapped_buffers_memory', 'jvm_gc_count', 'jvm_gc_time', 'host_metrics_file_descriptors',
- 'host_metrics_http', 'host_metrics_transport', 'thread_pool_queued', 'thread_pool_rejected',
- 'fielddata_cache', 'fielddata_evictions_tripped', 'cluster_health_status', 'cluster_health_nodes',
- 'cluster_health_shards', 'cluster_stats_nodes', 'cluster_stats_query_cache', 'cluster_stats_docs',
- 'cluster_stats_store', 'cluster_stats_indices_shards']
+ORDER = [
+ 'search_performance_total',
+ 'search_performance_current',
+ 'search_performance_time',
+ 'search_latency',
+ 'index_performance_total',
+ 'index_performance_current',
+ 'index_performance_time',
+ 'index_latency',
+ 'index_translog_operations',
+ 'index_translog_size',
+ 'index_segments_count',
+ 'index_segments_memory_writer',
+ 'index_segments_memory',
+ 'jvm_mem_heap',
+ 'jvm_mem_heap_bytes',
+ 'jvm_buffer_pool_count',
+ 'jvm_direct_buffers_memory',
+ 'jvm_mapped_buffers_memory',
+ 'jvm_gc_count',
+ 'jvm_gc_time',
+ 'host_metrics_file_descriptors',
+ 'host_metrics_http',
+ 'host_metrics_transport',
+ 'thread_pool_queued',
+ 'thread_pool_rejected',
+ 'fielddata_cache',
+ 'fielddata_evictions_tripped',
+ 'cluster_health_status',
+ 'cluster_health_nodes',
+ 'cluster_health_shards',
+ 'cluster_stats_nodes',
+ 'cluster_stats_query_cache',
+ 'cluster_stats_docs',
+ 'cluster_stats_store',
+ 'cluster_stats_indices_shards',
+]
CHARTS = {
'search_performance_total': {
@@ -139,27 +174,31 @@ CHARTS = {
'lines': [
['indices_search_query_total', 'queries', 'incremental'],
['indices_search_fetch_total', 'fetches', 'incremental']
- ]},
+ ]
+ },
'search_performance_current': {
'options': [None, 'Queries and Fetches In Progress', 'number of', 'search performance',
'elastic.search_performance_current', 'stacked'],
'lines': [
['indices_search_query_current', 'queries', 'absolute'],
['indices_search_fetch_current', 'fetches', 'absolute']
- ]},
+ ]
+ },
'search_performance_time': {
'options': [None, 'Time Spent On Queries And Fetches', 'seconds', 'search performance',
'elastic.search_performance_time', 'stacked'],
'lines': [
['indices_search_query_time_in_millis', 'query', 'incremental', 1, 1000],
['indices_search_fetch_time_in_millis', 'fetch', 'incremental', 1, 1000]
- ]},
+ ]
+ },
'search_latency': {
'options': [None, 'Query And Fetch Latency', 'ms', 'search performance', 'elastic.search_latency', 'stacked'],
'lines': [
['query_latency', 'query', 'absolute', 1, 1000],
['fetch_latency', 'fetch', 'absolute', 1, 1000]
- ]},
+ ]
+ },
'index_performance_total': {
'options': [None, 'Indexed Documents, Index Refreshes, Index Flushes To Disk', 'number of',
'indexing performance', 'elastic.index_performance_total', 'stacked'],
@@ -167,13 +206,15 @@ CHARTS = {
['indices_indexing_index_total', 'indexed', 'incremental'],
['indices_refresh_total', 'refreshes', 'incremental'],
['indices_flush_total', 'flushes', 'incremental']
- ]},
+ ]
+ },
'index_performance_current': {
'options': [None, 'Number Of Documents Currently Being Indexed', 'currently indexed',
'indexing performance', 'elastic.index_performance_current', 'stacked'],
'lines': [
['indices_indexing_index_current', 'documents', 'absolute']
- ]},
+ ]
+ },
'index_performance_time': {
'options': [None, 'Time Spent On Indexing, Refreshing, Flushing', 'seconds', 'indexing performance',
'elastic.index_performance_time', 'stacked'],
@@ -181,40 +222,46 @@ CHARTS = {
['indices_indexing_index_time_in_millis', 'indexing', 'incremental', 1, 1000],
['indices_refresh_total_time_in_millis', 'refreshing', 'incremental', 1, 1000],
['indices_flush_total_time_in_millis', 'flushing', 'incremental', 1, 1000]
- ]},
+ ]
+ },
'index_latency': {
'options': [None, 'Indexing And Flushing Latency', 'ms', 'indexing performance',
'elastic.index_latency', 'stacked'],
'lines': [
['indexing_latency', 'indexing', 'absolute', 1, 1000],
['flushing_latency', 'flushing', 'absolute', 1, 1000]
- ]},
+ ]
+ },
'index_translog_operations': {
'options': [None, 'Translog Operations', 'count', 'translog',
'elastic.index_translog_operations', 'area'],
'lines': [
['indices_translog_operations', 'total', 'absolute'],
['indices_translog_uncommitted_operations', 'uncommited', 'absolute']
- ]},
+ ]
+ },
'index_translog_size': {
'options': [None, 'Translog Size', 'MB', 'translog',
'elastic.index_translog_size', 'area'],
'lines': [
['indices_translog_size_in_bytes', 'total', 'absolute', 1, 1048567],
['indices_translog_uncommitted_size_in_bytes', 'uncommited', 'absolute', 1, 1048567]
- ]},
+ ]
+ },
'index_segments_count': {
'options': [None, 'Total Number Of Indices Segments', 'count', 'indices segments',
'elastic.index_segments_count', 'line'],
'lines': [
['indices_segments_count', 'segments', 'absolute']
- ]},
+ ]
+ },
'index_segments_memory_writer': {
'options': [None, 'Index Writer Memory Usage', 'MB', 'indices segments',
'elastic.index_segments_memory_writer', 'area'],
'lines': [
['indices_segments_index_writer_memory_in_bytes', 'total', 'absolute', 1, 1048567]
- ]},
+ ]
+ },
'index_segments_memory': {
'options': [None, 'Indices Segments Memory Usage', 'MB', 'indices segments',
'elastic.index_segments_memory', 'stacked'],
@@ -227,84 +274,98 @@ CHARTS = {
['indices_segments_doc_values_memory_in_bytes', 'doc values', 'absolute', 1, 1048567],
['indices_segments_version_map_memory_in_bytes', 'version map', 'absolute', 1, 1048567],
['indices_segments_fixed_bit_set_memory_in_bytes', 'fixed bit set', 'absolute', 1, 1048567]
- ]},
+ ]
+ },
'jvm_mem_heap': {
'options': [None, 'JVM Heap Percentage Currently in Use', 'percent', 'memory usage and gc',
'elastic.jvm_heap', 'area'],
'lines': [
['jvm_mem_heap_used_percent', 'inuse', 'absolute']
- ]},
+ ]
+ },
'jvm_mem_heap_bytes': {
'options': [None, 'JVM Heap Commit And Usage', 'MB', 'memory usage and gc',
'elastic.jvm_heap_bytes', 'area'],
'lines': [
['jvm_mem_heap_committed_in_bytes', 'commited', 'absolute', 1, 1048576],
['jvm_mem_heap_used_in_bytes', 'used', 'absolute', 1, 1048576]
- ]},
+ ]
+ },
'jvm_buffer_pool_count': {
'options': [None, 'JVM Buffers', 'count', 'memory usage and gc',
'elastic.jvm_buffer_pool_count', 'line'],
'lines': [
['jvm_buffer_pools_direct_count', 'direct', 'absolute'],
['jvm_buffer_pools_mapped_count', 'mapped', 'absolute']
- ]},
+ ]
+ },
'jvm_direct_buffers_memory': {
'options': [None, 'JVM Direct Buffers Memory', 'MB', 'memory usage and gc',
'elastic.jvm_direct_buffers_memory', 'area'],
'lines': [
['jvm_buffer_pools_direct_used_in_bytes', 'used', 'absolute', 1, 1048567],
['jvm_buffer_pools_direct_total_capacity_in_bytes', 'total capacity', 'absolute', 1, 1048567]
- ]},
+ ]
+ },
'jvm_mapped_buffers_memory': {
'options': [None, 'JVM Mapped Buffers Memory', 'MB', 'memory usage and gc',
'elastic.jvm_mapped_buffers_memory', 'area'],
'lines': [
['jvm_buffer_pools_mapped_used_in_bytes', 'used', 'absolute', 1, 1048567],
['jvm_buffer_pools_mapped_total_capacity_in_bytes', 'total capacity', 'absolute', 1, 1048567]
- ]},
+ ]
+ },
'jvm_gc_count': {
'options': [None, 'Garbage Collections', 'counts', 'memory usage and gc', 'elastic.gc_count', 'stacked'],
'lines': [
['jvm_gc_collectors_young_collection_count', 'young', 'incremental'],
['jvm_gc_collectors_old_collection_count', 'old', 'incremental']
- ]},
+ ]
+ },
'jvm_gc_time': {
'options': [None, 'Time Spent On Garbage Collections', 'ms', 'memory usage and gc',
'elastic.gc_time', 'stacked'],
'lines': [
['jvm_gc_collectors_young_collection_time_in_millis', 'young', 'incremental'],
['jvm_gc_collectors_old_collection_time_in_millis', 'old', 'incremental']
- ]},
+ ]
+ },
'thread_pool_queued': {
'options': [None, 'Number Of Queued Threads In Thread Pool', 'queued threads', 'queues and rejections',
'elastic.thread_pool_queued', 'stacked'],
'lines': [
['thread_pool_bulk_queue', 'bulk', 'absolute'],
+ ['thread_pool_write_queue', 'write', 'absolute'],
['thread_pool_index_queue', 'index', 'absolute'],
['thread_pool_search_queue', 'search', 'absolute'],
['thread_pool_merge_queue', 'merge', 'absolute']
- ]},
+ ]
+ },
'thread_pool_rejected': {
'options': [None, 'Rejected Threads In Thread Pool', 'rejected threads', 'queues and rejections',
'elastic.thread_pool_rejected', 'stacked'],
'lines': [
['thread_pool_bulk_rejected', 'bulk', 'absolute'],
+ ['thread_pool_write_rejected', 'write', 'absolute'],
['thread_pool_index_rejected', 'index', 'absolute'],
['thread_pool_search_rejected', 'search', 'absolute'],
['thread_pool_merge_rejected', 'merge', 'absolute']
- ]},
+ ]
+ },
'fielddata_cache': {
'options': [None, 'Fielddata Cache', 'MB', 'fielddata cache', 'elastic.fielddata_cache', 'line'],
'lines': [
['indices_fielddata_memory_size_in_bytes', 'cache', 'absolute', 1, 1048576]
- ]},
+ ]
+ },
'fielddata_evictions_tripped': {
'options': [None, 'Fielddata Evictions And Circuit Breaker Tripped Count', 'number of events',
'fielddata cache', 'elastic.fielddata_evictions_tripped', 'line'],
'lines': [
['indices_fielddata_evictions', 'evictions', 'incremental'],
['indices_fielddata_tripped', 'tripped', 'incremental']
- ]},
+ ]
+ },
'cluster_health_nodes': {
'options': [None, 'Nodes And Tasks Statistics', 'units', 'cluster health API',
'elastic.cluster_health_nodes', 'stacked'],
@@ -313,7 +374,8 @@ CHARTS = {
['number_of_data_nodes', 'data_nodes', 'absolute'],
['number_of_pending_tasks', 'pending_tasks', 'absolute'],
['number_of_in_flight_fetch', 'in_flight_fetch', 'absolute']
- ]},
+ ]
+ },
'cluster_health_status': {
'options': [None, 'Cluster Status', 'status', 'cluster health API',
'elastic.cluster_health_status', 'area'],
@@ -324,7 +386,8 @@ CHARTS = {
['status_foo2', None, 'absolute'],
['status_foo3', None, 'absolute'],
['status_yellow', 'yellow', 'absolute']
- ]},
+ ]
+ },
'cluster_health_shards': {
'options': [None, 'Shards Statistics', 'shards', 'cluster health API',
'elastic.cluster_health_shards', 'stacked'],
@@ -335,7 +398,8 @@ CHARTS = {
['delayed_unassigned_shards', 'delayed_unassigned', 'absolute'],
['initializing_shards', 'initializing', 'absolute'],
['active_shards_percent_as_number', 'active_percent', 'absolute']
- ]},
+ ]
+ },
'cluster_stats_nodes': {
'options': [None, 'Nodes Statistics', 'nodes', 'cluster stats API',
'elastic.cluster_nodes', 'stacked'],
@@ -345,52 +409,60 @@ CHARTS = {
['nodes_count_total', 'total', 'absolute'],
['nodes_count_master_only', 'master_only', 'absolute'],
['nodes_count_client', 'client', 'absolute']
- ]},
+ ]
+ },
'cluster_stats_query_cache': {
'options': [None, 'Query Cache Statistics', 'queries', 'cluster stats API',
'elastic.cluster_query_cache', 'stacked'],
'lines': [
['indices_query_cache_hit_count', 'hit', 'incremental'],
['indices_query_cache_miss_count', 'miss', 'incremental']
- ]},
+ ]
+ },
'cluster_stats_docs': {
'options': [None, 'Docs Statistics', 'count', 'cluster stats API',
'elastic.cluster_docs', 'line'],
'lines': [
['indices_docs_count', 'docs', 'absolute']
- ]},
+ ]
+ },
'cluster_stats_store': {
'options': [None, 'Store Statistics', 'MB', 'cluster stats API',
'elastic.cluster_store', 'line'],
'lines': [
['indices_store_size_in_bytes', 'size', 'absolute', 1, 1048567]
- ]},
+ ]
+ },
'cluster_stats_indices_shards': {
'options': [None, 'Indices And Shards Statistics', 'count', 'cluster stats API',
'elastic.cluster_indices_shards', 'stacked'],
'lines': [
['indices_count', 'indices', 'absolute'],
['indices_shards_total', 'shards', 'absolute']
- ]},
+ ]
+ },
'host_metrics_transport': {
'options': [None, 'Cluster Communication Transport Metrics', 'kilobit/s', 'host metrics',
'elastic.host_transport', 'area'],
'lines': [
['transport_rx_size_in_bytes', 'in', 'incremental', 8, 1000],
['transport_tx_size_in_bytes', 'out', 'incremental', -8, 1000]
- ]},
+ ]
+ },
'host_metrics_file_descriptors': {
'options': [None, 'Available File Descriptors In Percent', 'percent', 'host metrics',
'elastic.host_descriptors', 'area'],
'lines': [
['file_descriptors_used', 'used', 'absolute', 1, 10]
- ]},
+ ]
+ },
'host_metrics_http': {
'options': [None, 'Opened HTTP Connections', 'connections', 'host metrics',
'elastic.host_http_connections', 'line'],
'lines': [
['http_current_open', 'opened', 'absolute', 1, 1]
- ]}
+ ]
+ }
}
@@ -444,8 +516,8 @@ class Service(UrlService):
for method in self.methods:
if not method.run:
continue
- th = Thread(target=method.get_data,
- args=(queue, method.url))
+ th = threading.Thread(target=method.get_data,
+ args=(queue, method.url))
th.start()
threads.append(th)
@@ -466,7 +538,11 @@ class Service(UrlService):
if not raw_data:
return queue.put(dict())
- data = loads(raw_data)
+ data = self.json_reply(raw_data)
+
+ if not data:
+ return queue.put(dict())
+
to_netdata = fetch_data_(raw_data=data,
metrics=HEALTH_STATS)
@@ -488,7 +564,11 @@ class Service(UrlService):
if not raw_data:
return queue.put(dict())
- data = loads(raw_data)
+ data = self.json_reply(raw_data)
+
+ if not data:
+ return queue.put(dict())
+
to_netdata = fetch_data_(raw_data=data,
metrics=CLUSTER_STATS)
@@ -505,7 +585,10 @@ class Service(UrlService):
if not raw_data:
return queue.put(dict())
- data = loads(raw_data)
+ data = self.json_reply(raw_data)
+
+ if not data:
+ return queue.put(dict())
node = list(data['nodes'].keys())[0]
to_netdata = fetch_data_(raw_data=data['nodes'][node],
@@ -525,6 +608,13 @@ class Service(UrlService):
return queue.put(to_netdata)
+ def json_reply(self, reply):
+ try:
+ return json.loads(reply)
+ except ValueError as err:
+ self.error(err)
+ return None
+
def find_avg(self, total, spent_time, key):
if key not in self.latency:
self.latency[key] = dict(total=total,
diff --git a/conf.d/python.d/elasticsearch.conf b/collectors/python.d.plugin/elasticsearch/elasticsearch.conf
index 213843bf9..213843bf9 100644
--- a/conf.d/python.d/elasticsearch.conf
+++ b/collectors/python.d.plugin/elasticsearch/elasticsearch.conf