sensu-plugins-elasticsearch 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +1 -2
- data/CHANGELOG.md +9 -1
- data/README.md +3 -2
- data/bin/check-es-circuit-breakers.rb +113 -0
- data/bin/check-es-file-descriptors.rb +10 -1
- data/bin/check-es-node-status.rb +4 -4
- data/bin/metrics-es-node-graphite.rb +23 -16
- data/lib/sensu-plugins-elasticsearch/version.rb +1 -1
- metadata +7 -5
- metadata.gz.sig +4 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df9596b9f751d85dd0f774ad4d356b41dfa3cb16
|
4
|
+
data.tar.gz: 80c0c997e2b2cf195e3062794e5c19c1d8175c4b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 042ccabd49cc993b4d114bd8e287b3a534f493c83067fe7f6274517a42f867ae248fb82480741c5455388e6ace45f626c0726b5a7e89e3148935ecf69a773f4f
|
7
|
+
data.tar.gz: db0f1701b0f3a1008b5a9d1cc319967351c5e86906d6683a8a7a964d9fef8362e8e36a3dfb81054c6895532ec6944e7550823953269b7a53a9a791de6e8931cf
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
�
|
2
|
-
�-����/������X��z%���h1vF�A^oD�t�ӓ
|
1
|
+
K��r�v��\�&a^��h�D���O�2����X�t��G������qө��IN3�'S���C���Ό�n�����ňE�b#�����:|3��f�г����Sw�&|*9�<�&4,���4�'#���3���@�ྐྵ�jk�>0�;4�`#�?���Yt��!q>>u��w�{̹�ac��g�������2v��U/F����E梊=��5?q����� ݁l?�� 镂��j�D& �j� �NUq
|
data/CHANGELOG.md
CHANGED
@@ -3,7 +3,15 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
3
3
|
|
4
4
|
This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
|
5
5
|
|
6
|
-
##
|
6
|
+
## Unreleased
|
7
|
+
|
8
|
+
## [0.3.0] - 2015-11-18
|
9
|
+
### Changed
|
10
|
+
- Update metrics-es-node-graphite.rb, check-es-node-status.rb, and check-es-file-descriptors.rb for Elasticsearch 2.0
|
11
|
+
- Update elasticsearch gem to 1.0.14
|
12
|
+
|
13
|
+
### Added
|
14
|
+
- Add check-es-circuit-breakers.rb, to alert when circuit breakers have been tripped
|
7
15
|
|
8
16
|
## [0.2.0] - 2015-10-15
|
9
17
|
### Changed
|
data/README.md
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
## Sensu-Plugins-elasticsearch
|
2
2
|
|
3
|
-
[
|
3
|
+
[![Build Status](https://travis-ci.org/sensu-plugins/sensu-plugins-elasticsearch.svg?branch=master)](https://travis-ci.org/sensu-plugins/sensu-plugins-elasticsearch)
|
4
4
|
[![Gem Version](https://badge.fury.io/rb/sensu-plugins-elasticsearch.svg)](http://badge.fury.io/rb/sensu-plugins-elasticsearch)
|
5
5
|
[![Code Climate](https://codeclimate.com/github/sensu-plugins/sensu-plugins-elasticsearch/badges/gpa.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-elasticsearch)
|
6
6
|
[![Test Coverage](https://codeclimate.com/github/sensu-plugins/sensu-plugins-elasticsearch/badges/coverage.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-elasticsearch)
|
7
7
|
[![Dependency Status](https://gemnasium.com/sensu-plugins/sensu-plugins-elasticsearch.svg)](https://gemnasium.com/sensu-plugins/sensu-plugins-elasticsearch)
|
8
|
-
[
|
8
|
+
[![Codeship Status for sensu-plugins/sensu-plugins-elasticsearch](https://codeship.com/projects/926f1e90-db39-0132-e370-5ad94843e341/status?branch=master)](https://codeship.com/projects/79569)
|
9
9
|
|
10
10
|
## Functionality
|
11
11
|
|
@@ -16,6 +16,7 @@
|
|
16
16
|
* /bin/check-es-node-status.rb
|
17
17
|
* /bin/check-es-query-count.rb
|
18
18
|
* /bin/check-es-query-exists.rb
|
19
|
+
* /bin/check-es-circuit-breakers.rb
|
19
20
|
* /bin/metrics-es-cluster.rb
|
20
21
|
* /bin/metrics-es-node.rb
|
21
22
|
* /bin/metrics-es-node-graphite.rb
|
@@ -0,0 +1,113 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# check-es-circuit-breakers
|
4
|
+
#
|
5
|
+
# DESCRIPTION:
|
6
|
+
# This plugin checks whether the ElasticSearch circuit breakers have been tripped,
|
7
|
+
# using the node stats API.
|
8
|
+
# Works with ES 0.9x and ES 1.x
|
9
|
+
#
|
10
|
+
# OUTPUT:
|
11
|
+
# plain text
|
12
|
+
#
|
13
|
+
# PLATFORMS:
|
14
|
+
# Linux
|
15
|
+
#
|
16
|
+
# DEPENDENCIES:
|
17
|
+
# gem: sensu-plugin
|
18
|
+
# gem: rest-client
|
19
|
+
#
|
20
|
+
# USAGE:
|
21
|
+
# check-es-circuit-breakers --help
|
22
|
+
#
|
23
|
+
# NOTES:
|
24
|
+
#
|
25
|
+
# LICENSE:
|
26
|
+
# Copyright 2012 Sonian, Inc <chefs@sonian.net>
|
27
|
+
# Released under the same terms as Sensu (the MIT license); see LICENSE
|
28
|
+
# for details.
|
29
|
+
#
|
30
|
+
|
31
|
+
require 'sensu-plugin/check/cli'
|
32
|
+
require 'rest-client'
|
33
|
+
require 'json'
|
34
|
+
require 'base64'
|
35
|
+
|
36
|
+
class ESCircuitBreaker < Sensu::Plugin::Check::CLI
|
37
|
+
option :host,
|
38
|
+
description: 'Elasticsearch host',
|
39
|
+
short: '-h HOST',
|
40
|
+
long: '--host HOST',
|
41
|
+
default: 'localhost'
|
42
|
+
|
43
|
+
option :port,
|
44
|
+
description: 'Elasticsearch port',
|
45
|
+
short: '-p PORT',
|
46
|
+
long: '--port PORT',
|
47
|
+
proc: proc(&:to_i),
|
48
|
+
default: 9200
|
49
|
+
|
50
|
+
option :timeout,
|
51
|
+
description: 'Sets the connection timeout for REST client',
|
52
|
+
short: '-t SECS',
|
53
|
+
long: '--timeout SECS',
|
54
|
+
proc: proc(&:to_i),
|
55
|
+
default: 30
|
56
|
+
|
57
|
+
option :user,
|
58
|
+
description: 'Elasticsearch User',
|
59
|
+
short: '-u USER',
|
60
|
+
long: '--user USER'
|
61
|
+
|
62
|
+
option :password,
|
63
|
+
description: 'Elasticsearch Password',
|
64
|
+
short: '-P PASS',
|
65
|
+
long: '--password PASS'
|
66
|
+
|
67
|
+
def get_es_resource(resource)
|
68
|
+
headers = {}
|
69
|
+
if config[:user] && config[:password]
|
70
|
+
auth = 'Basic ' + Base64.encode64("#{config[:user]}:#{config[:password]}").chomp
|
71
|
+
headers = { 'Authorization' => auth }
|
72
|
+
end
|
73
|
+
r = RestClient::Resource.new("http://#{config[:host]}:#{config[:port]}#{resource}", timeout: config[:timeout], headers: headers)
|
74
|
+
JSON.parse(r.get)
|
75
|
+
rescue Errno::ECONNREFUSED
|
76
|
+
critical 'Connection refused'
|
77
|
+
rescue RestClient::RequestTimeout
|
78
|
+
critical 'Connection timed out'
|
79
|
+
rescue Errno::ECONNRESET
|
80
|
+
critical 'Connection reset by peer'
|
81
|
+
end
|
82
|
+
|
83
|
+
def breaker_status
|
84
|
+
breakers = {}
|
85
|
+
status = get_es_resource('/_nodes/stats/breaker')
|
86
|
+
status['nodes'].each_pair do |_node, stat|
|
87
|
+
host = stat['host']
|
88
|
+
breakers[host] = {}
|
89
|
+
breakers[host]['breakers'] = []
|
90
|
+
stat.each_pair do |key, val|
|
91
|
+
if key == 'breakers'
|
92
|
+
val.each_pair do |bk, bv|
|
93
|
+
if bv['tripped'] != 0
|
94
|
+
breakers[host]['breakers'] << bk
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
breakers
|
101
|
+
end
|
102
|
+
|
103
|
+
def run
|
104
|
+
breakers = breaker_status
|
105
|
+
tripped = false
|
106
|
+
breakers.each_pair { |_k, v| tripped = true unless v['breakers'].empty? }
|
107
|
+
if tripped
|
108
|
+
critical "Circuit Breakers: #{breakers.each_pair { |k, _v| k }} trippped!"
|
109
|
+
else
|
110
|
+
ok 'All circuit breakers okay'
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
@@ -91,6 +91,11 @@ class ESFileDescriptors < Sensu::Plugin::Check::CLI
|
|
91
91
|
warning 'Connection timed out'
|
92
92
|
end
|
93
93
|
|
94
|
+
def acquire_es_version
|
95
|
+
info = get_es_resource('/')
|
96
|
+
info['version']['number']
|
97
|
+
end
|
98
|
+
|
94
99
|
def acquire_open_fds
|
95
100
|
stats = get_es_resource('/_nodes/_local/stats?process=true')
|
96
101
|
begin
|
@@ -102,7 +107,11 @@ class ESFileDescriptors < Sensu::Plugin::Check::CLI
|
|
102
107
|
end
|
103
108
|
|
104
109
|
def acquire_max_fds
|
105
|
-
|
110
|
+
if Gem::Version.new(acquire_es_version) >= Gem::Version.new('2.0.0')
|
111
|
+
info = get_es_resource('/_nodes/_local/stats?process=true')
|
112
|
+
else
|
113
|
+
info = get_es_resource('/_nodes/_local?process=true')
|
114
|
+
end
|
106
115
|
begin
|
107
116
|
keys = info['nodes'].keys
|
108
117
|
info['nodes'][keys[0]]['process']['max_file_descriptors'].to_i
|
data/bin/check-es-node-status.rb
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
#
|
5
5
|
# DESCRIPTION:
|
6
6
|
# This plugin checks the ElasticSearch node status, using its API.
|
7
|
-
# Works with ES 0.9x and ES
|
7
|
+
# Works with ES 0.9x, ES 1.x, and ES 2.x
|
8
8
|
#
|
9
9
|
# OUTPUT:
|
10
10
|
# plain text
|
@@ -70,7 +70,7 @@ class ESNodeStatus < Sensu::Plugin::Check::CLI
|
|
70
70
|
headers = { 'Authorization' => auth }
|
71
71
|
end
|
72
72
|
r = RestClient::Resource.new("http://#{config[:host]}:#{config[:port]}#{resource}", timeout: config[:timeout], headers: headers)
|
73
|
-
|
73
|
+
r.get
|
74
74
|
rescue Errno::ECONNREFUSED
|
75
75
|
critical 'Connection refused'
|
76
76
|
rescue RestClient::RequestTimeout
|
@@ -80,8 +80,8 @@ class ESNodeStatus < Sensu::Plugin::Check::CLI
|
|
80
80
|
end
|
81
81
|
|
82
82
|
def acquire_status
|
83
|
-
|
84
|
-
|
83
|
+
status = get_es_resource('/').code
|
84
|
+
status
|
85
85
|
end
|
86
86
|
|
87
87
|
def run
|
@@ -154,7 +154,7 @@ class ESNodeGraphiteMetrics < Sensu::Plugin::Metric::CLI::Graphite
|
|
154
154
|
].join('&')
|
155
155
|
end
|
156
156
|
|
157
|
-
if
|
157
|
+
if es_version >= Gem::Version.new('1.0.0')
|
158
158
|
stats = get_es_resource("/_nodes/_local/stats?#{stats_query_string}")
|
159
159
|
else
|
160
160
|
stats = get_es_resource("/_cluster/nodes/_local/stats?#{stats_query_string}")
|
@@ -166,13 +166,17 @@ class ESNodeGraphiteMetrics < Sensu::Plugin::Metric::CLI::Graphite
|
|
166
166
|
metrics = {}
|
167
167
|
|
168
168
|
if os_stat
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
169
|
+
if es_version >= Gem::Version.new('2.0.0')
|
170
|
+
metrics['os.load_average'] = node['os']['load_average']
|
171
|
+
else
|
172
|
+
metrics['os.load_average'] = node['os']['load_average'][0]
|
173
|
+
metrics['os.load_average.1'] = node['os']['load_average'][0]
|
174
|
+
metrics['os.load_average.5'] = node['os']['load_average'][1]
|
175
|
+
metrics['os.load_average.15'] = node['os']['load_average'][2]
|
176
|
+
end
|
173
177
|
metrics['os.mem.free_in_bytes'] = node['os']['mem']['free_in_bytes']
|
174
178
|
# ... Process uptime in millis?
|
175
|
-
metrics['os.uptime'] = node['os']['uptime_in_millis']
|
179
|
+
metrics['os.uptime'] = node['os']['uptime_in_millis'] if node['os']['uptime_in_millis']
|
176
180
|
end
|
177
181
|
|
178
182
|
if process_stats
|
@@ -205,6 +209,7 @@ class ESNodeGraphiteMetrics < Sensu::Plugin::Metric::CLI::Graphite
|
|
205
209
|
|
206
210
|
metrics['jvm.threads.count'] = node['jvm']['threads']['count']
|
207
211
|
metrics['jvm.threads.peak_count'] = node['jvm']['threads']['peak_count']
|
212
|
+
metrics['jvm.uptime'] = node['jvm']['uptime_in_millis']
|
208
213
|
end
|
209
214
|
|
210
215
|
node['indices'].each do |type, index|
|
@@ -226,18 +231,20 @@ class ESNodeGraphiteMetrics < Sensu::Plugin::Metric::CLI::Graphite
|
|
226
231
|
metrics['http.current_open'] = node['http']['current_open']
|
227
232
|
metrics['http.total_opened'] = node['http']['total_opened']
|
228
233
|
|
229
|
-
|
230
|
-
|
234
|
+
if node['network']
|
235
|
+
metrics['network.tcp.active_opens'] = node['network']['tcp']['active_opens']
|
236
|
+
metrics['network.tcp.passive_opens'] = node['network']['tcp']['passive_opens']
|
231
237
|
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
+
metrics['network.tcp.in_segs'] = node['network']['tcp']['in_segs']
|
239
|
+
metrics['network.tcp.out_segs'] = node['network']['tcp']['out_segs']
|
240
|
+
metrics['network.tcp.retrans_segs'] = node['network']['tcp']['retrans_segs']
|
241
|
+
metrics['network.tcp.attempt_fails'] = node['network']['tcp']['attempt_fails']
|
242
|
+
metrics['network.tcp.in_errs'] = node['network']['tcp']['in_errs']
|
243
|
+
metrics['network.tcp.out_rsts'] = node['network']['tcp']['out_rsts']
|
238
244
|
|
239
|
-
|
240
|
-
|
245
|
+
metrics['network.tcp.curr_estab'] = node['network']['tcp']['curr_estab']
|
246
|
+
metrics['network.tcp.estab_resets'] = node['network']['tcp']['estab_resets']
|
247
|
+
end
|
241
248
|
|
242
249
|
if tp_stats
|
243
250
|
node['thread_pool'].each do |pool, stat|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-plugins-elasticsearch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sensu Plugins and contributors
|
@@ -30,7 +30,7 @@ cert_chain:
|
|
30
30
|
8sHuVruarogxxKPBzlL2is4EUb6oN/RdpGx2l4254+nyR+abg//Ed27Ym0PkB4lk
|
31
31
|
HP0m8WSjZmFr109pE/sVsM5jtOCvogyujQOjNVGN4gz1wwPr
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date: 2015-
|
33
|
+
date: 2015-11-19 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: rest-client
|
@@ -52,14 +52,14 @@ dependencies:
|
|
52
52
|
requirements:
|
53
53
|
- - '='
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: 1.0.
|
55
|
+
version: 1.0.14
|
56
56
|
type: :runtime
|
57
57
|
prerelease: false
|
58
58
|
version_requirements: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
60
|
- - '='
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: 1.0.
|
62
|
+
version: 1.0.14
|
63
63
|
- !ruby/object:Gem::Dependency
|
64
64
|
name: sensu-plugin
|
65
65
|
requirement: !ruby/object:Gem::Requirement
|
@@ -215,12 +215,14 @@ executables:
|
|
215
215
|
- check-es-heap.rb
|
216
216
|
- check-es-file-descriptors.rb
|
217
217
|
- check-es-cluster-status.rb
|
218
|
+
- check-es-circuit-breakers.rb
|
218
219
|
extensions: []
|
219
220
|
extra_rdoc_files: []
|
220
221
|
files:
|
221
222
|
- CHANGELOG.md
|
222
223
|
- LICENSE
|
223
224
|
- README.md
|
225
|
+
- bin/check-es-circuit-breakers.rb
|
224
226
|
- bin/check-es-cluster-status.rb
|
225
227
|
- bin/check-es-file-descriptors.rb
|
226
228
|
- bin/check-es-heap.rb
|
@@ -238,7 +240,7 @@ homepage: https://github.com/sensu-plugins/sensu-plugins-elasticsearch
|
|
238
240
|
licenses:
|
239
241
|
- MIT
|
240
242
|
metadata:
|
241
|
-
maintainer:
|
243
|
+
maintainer: sensu-plugin
|
242
244
|
development_status: active
|
243
245
|
production_status: unstable - testing recommended
|
244
246
|
release_draft: 'false'
|
metadata.gz.sig
CHANGED
@@ -1 +1,4 @@
|
|
1
|
-
|
1
|
+
+{
|
2
|
+
�v�0�G*��o�!���\-:Q`������{kK��PTp��,v�oj��z��\�R�����s������iݺ��]?��+{��~?Xځ���hCi��t��m�>����5�I����M$i9t�
|
3
|
+
N���f���CG�g)?E�����`Na�'V�D��ii`�>��x����uS�Yo�:,�p�m���1�����c�,^�u$
|
4
|
+
nHM���R�z����A����U:ZqLpȑ;����I����
|