sensu-plugins-elasticsearch 1.12.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -1
- data/bin/check-es-heap.rb +2 -2
- data/bin/check-es-indices-sizes.rb +4 -2
- data/bin/check-es-shard-allocation-status.rb +1 -1
- data/bin/metrics-es-cluster.rb +3 -3
- data/bin/metrics-es-node-graphite.rb +2 -2
- data/lib/sensu-plugins-elasticsearch/version.rb +2 -2
- metadata +25 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e319f3f86c9601175dd3491e2f4b6c5b2d6964c647ddfb9acd6bf889c561cdc4
|
4
|
+
data.tar.gz: af563071f38a129d3c4e54a5e80984b393ea1bc4f8ab842b1435cb51c4a9d56c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da453a880f287c0d2e5b6a88ebacb128c7ecd6cfec6fd9e6a9147910c00c7b1853f8a9c3bd33fe3d21f03aca4ac01f0b7bb232ce214ba10b015fe0d2d2304c73
|
7
|
+
data.tar.gz: 98f68c296f471556369ebef348410f12a30e9a039b11944249c501ed5bf790e618effe062c355ca55895975f18c7edf1cdbd4b3dfa9303af1d325c79255ff297
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,18 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
|
|
5
5
|
|
6
6
|
## [Unreleased]
|
7
7
|
|
8
|
+
## [2.0.0] - 2018-03-07
|
9
|
+
|
10
|
+
### Security
|
11
|
+
- updated rubocop dependency to `~> 0.51.0` per: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-8418. (@majormoses)
|
12
|
+
|
13
|
+
### Breaking Changes
|
14
|
+
- removed ruby `< 2.1` support @majormoses
|
15
|
+
|
16
|
+
### Changes
|
17
|
+
- added explicit dependency on `mixlib-shellout` to keep compatibility with ruby `2.1` (@majormoses)
|
18
|
+
- appeased the cops and created TODOs (@majormoses)
|
19
|
+
|
8
20
|
## [1.12.0] - 2018-03-01
|
9
21
|
### Added
|
10
22
|
- check-es-indices-field-number.rb: check if the number of fields in index(es) is approaching limit (default to 1000 in ES) (@huynt1979)
|
@@ -236,7 +248,8 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
|
|
236
248
|
- initial release
|
237
249
|
|
238
250
|
|
239
|
-
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-elasticsearch/compare/
|
251
|
+
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-elasticsearch/compare/2.0.0...HEAD
|
252
|
+
[2.0.0]: https://github.com/sensu-plugins/sensu-plugins-elasticsearch/compare/1.12.0...2.0.0
|
240
253
|
[1.12.0]: https://github.com/sensu-plugins/sensu-plugins-elasticsearch/compare/1.11.1...1.12.0
|
241
254
|
[1.11.1]: https://github.com/sensu-plugins/sensu-plugins-elasticsearch/compare/1.11.0...1.11.1
|
242
255
|
[1.11.0]: https://github.com/sensu-plugins/sensu-plugins-elasticsearch/compare/1.10.0...1.11.0
|
data/bin/check-es-heap.rb
CHANGED
@@ -142,7 +142,7 @@ class ESHeap < Sensu::Plugin::Check::CLI
|
|
142
142
|
|
143
143
|
def acquire_heap_data(node)
|
144
144
|
return node['jvm']['mem']['heap_used_in_bytes'], node['jvm']['mem']['heap_max_in_bytes']
|
145
|
-
rescue
|
145
|
+
rescue StandardError
|
146
146
|
warning 'Failed to obtain heap used in bytes'
|
147
147
|
end
|
148
148
|
|
@@ -166,7 +166,7 @@ class ESHeap < Sensu::Plugin::Check::CLI
|
|
166
166
|
status = { crit: '', warn: '', ok: '' }
|
167
167
|
|
168
168
|
# Check all the nodes in the cluster, alert if any of the nodes have heap usage above thresholds
|
169
|
-
stats['nodes'].
|
169
|
+
stats['nodes'].each_value do |node|
|
170
170
|
heap_used, heap_max = acquire_heap_data(node)
|
171
171
|
heap_usage, output = acquire_heap_usage(heap_used, heap_max, node['name'])
|
172
172
|
if heap_usage >= config[:crit]
|
@@ -108,6 +108,8 @@ class ESCheckIndicesSizes < Sensu::Plugin::Check::CLI
|
|
108
108
|
|
109
109
|
def get_indices_to_delete(starting_date, total_bytes_to_delete, indices_with_sizes)
|
110
110
|
total_bytes_deleted = 0
|
111
|
+
|
112
|
+
# TODO: switch from `DateTime` to `Time` or `Date`
|
111
113
|
curr_date = DateTime.now
|
112
114
|
|
113
115
|
indices_to_delete = []
|
@@ -161,10 +163,10 @@ class ESCheckIndicesSizes < Sensu::Plugin::Check::CLI
|
|
161
163
|
nodes_being_used = node_fs_stats['nodes'].values.select { |node| node['indices']['store']['size_in_bytes'] > 0 }
|
162
164
|
|
163
165
|
# TODO: come back and cleanup all these rubocop disables with a little refactor
|
164
|
-
# rubocop:disable
|
166
|
+
# rubocop:disable Metrics/LineLength
|
165
167
|
used_in_bytes = nodes_being_used.map { |node| node['fs']['data'].map { |data| data['total_in_bytes'] - data['available_in_bytes'] }.flatten }.flatten.inject { |sum, x| sum + x }
|
166
168
|
total_in_bytes = nodes_being_used.map { |node| node['fs']['data'].map { |data| data['total_in_bytes'] }.flatten }.flatten.inject { |sum, x| sum + x }
|
167
|
-
# rubocop:enable
|
169
|
+
# rubocop:enable Metrics/LineLength
|
168
170
|
|
169
171
|
if config[:maximum_megabytes] > 0
|
170
172
|
target_bytes_used = config[:maximum_megabytes] * 1_000_000
|
data/bin/metrics-es-cluster.rb
CHANGED
@@ -144,8 +144,8 @@ class ESClusterMetrics < Sensu::Plugin::Metric::CLI::Graphite
|
|
144
144
|
end
|
145
145
|
|
146
146
|
def acquire_health
|
147
|
-
health = get_es_resource('/_cluster/health').reject { |k, _v| %w
|
148
|
-
health['status'] = %w
|
147
|
+
health = get_es_resource('/_cluster/health').reject { |k, _v| %w[cluster_name timed_out].include?(k) }
|
148
|
+
health['status'] = %w[red yellow green].index(health['status'])
|
149
149
|
health
|
150
150
|
end
|
151
151
|
|
@@ -191,7 +191,7 @@ class ESClusterMetrics < Sensu::Plugin::Metric::CLI::Graphite
|
|
191
191
|
cluster_config = get_es_resource('/_cluster/settings')
|
192
192
|
transient_settings = cluster_config['transient']
|
193
193
|
if transient_settings.key?('cluster')
|
194
|
-
return %w
|
194
|
+
return %w[none new_primaries primaries all].index(transient_settings['cluster']['routing']['allocation']['enable'])
|
195
195
|
else
|
196
196
|
return nil
|
197
197
|
end
|
@@ -165,7 +165,7 @@ class ESNodeGraphiteMetrics < Sensu::Plugin::Metric::CLI::Graphite
|
|
165
165
|
es_version = Gem::Version.new(acquire_es_version)
|
166
166
|
|
167
167
|
if es_version >= Gem::Version.new('3.0.0')
|
168
|
-
stats_query_array = %w
|
168
|
+
stats_query_array = %w[indices http transport]
|
169
169
|
stats_query_array.push('jvm') if jvm_stats == true
|
170
170
|
stats_query_array.push('os') if os_stat == true
|
171
171
|
stats_query_array.push('process') if process_stats == true
|
@@ -173,7 +173,7 @@ class ESNodeGraphiteMetrics < Sensu::Plugin::Metric::CLI::Graphite
|
|
173
173
|
stats_query_array.push('fs') if fs_stats == true
|
174
174
|
stats_query_string = stats_query_array.join(',')
|
175
175
|
elsif es_version >= Gem::Version.new('1.0.0')
|
176
|
-
stats_query_array = %w
|
176
|
+
stats_query_array = %w[indices http network transport thread_pool]
|
177
177
|
stats_query_array.push('jvm') if jvm_stats == true
|
178
178
|
stats_query_array.push('os') if os_stat == true
|
179
179
|
stats_query_array.push('process') if process_stats == true
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-plugins-elasticsearch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sensu Plugins and contributors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-03-
|
11
|
+
date: 2018-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-es-transport
|
@@ -148,6 +148,26 @@ dependencies:
|
|
148
148
|
- - "~>"
|
149
149
|
- !ruby/object:Gem::Version
|
150
150
|
version: '2.6'
|
151
|
+
- !ruby/object:Gem::Dependency
|
152
|
+
name: mixlib-shellout
|
153
|
+
requirement: !ruby/object:Gem::Requirement
|
154
|
+
requirements:
|
155
|
+
- - "<"
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: 2.3.0
|
158
|
+
- - "~>"
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: '2.2'
|
161
|
+
type: :development
|
162
|
+
prerelease: false
|
163
|
+
version_requirements: !ruby/object:Gem::Requirement
|
164
|
+
requirements:
|
165
|
+
- - "<"
|
166
|
+
- !ruby/object:Gem::Version
|
167
|
+
version: 2.3.0
|
168
|
+
- - "~>"
|
169
|
+
- !ruby/object:Gem::Version
|
170
|
+
version: '2.2'
|
151
171
|
- !ruby/object:Gem::Dependency
|
152
172
|
name: pry
|
153
173
|
requirement: !ruby/object:Gem::Requirement
|
@@ -210,14 +230,14 @@ dependencies:
|
|
210
230
|
requirements:
|
211
231
|
- - "~>"
|
212
232
|
- !ruby/object:Gem::Version
|
213
|
-
version: 0.
|
233
|
+
version: 0.51.0
|
214
234
|
type: :development
|
215
235
|
prerelease: false
|
216
236
|
version_requirements: !ruby/object:Gem::Requirement
|
217
237
|
requirements:
|
218
238
|
- - "~>"
|
219
239
|
- !ruby/object:Gem::Version
|
220
|
-
version: 0.
|
240
|
+
version: 0.51.0
|
221
241
|
- !ruby/object:Gem::Dependency
|
222
242
|
name: test-kitchen
|
223
243
|
requirement: !ruby/object:Gem::Requirement
|
@@ -316,7 +336,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
316
336
|
requirements:
|
317
337
|
- - ">="
|
318
338
|
- !ruby/object:Gem::Version
|
319
|
-
version: 2.
|
339
|
+
version: 2.1.0
|
320
340
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
321
341
|
requirements:
|
322
342
|
- - ">="
|