sensu-plugins-elasticsearch 1.10.0 → 1.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5642696a8f37d54e95e2be913af5fb1694dee4c86e73e700cc1bb14c4ebdec14
4
- data.tar.gz: 253b4e9aaf0a44a6aa1d8224644343b9f5d27d6cadbdb4de73a36e2cb6dfbfb9
3
+ metadata.gz: 3e6d8d406b64519a41b89611e55d812b206e846897f981208b97b4c8bd632ef9
4
+ data.tar.gz: a2c9523a27c183d831c4d846e8fa5087fdca790414a3f1234e87abece5098a68
5
5
  SHA512:
6
- metadata.gz: 1c8299a54b50656ac4da0a7682694024586cda2d9228af287de7a83d6579b14155c8aacf01656b170a91ac1728ff1358d55eab3be4621f7146dbff8e843fbd8c
7
- data.tar.gz: 519e411301630fcfb1e40af4af6b369f4f08ff2aea3308287aba2f5a9981444fdaea84aa4e348b6c26431797fc794b6d0b5b05f3b6bef50b2d631a91bbe19f0c
6
+ metadata.gz: ff0e1e1efc65008d3fcd2235a4bc54682319a20ac5457c83a9e49d30e1b519a6d734678c5004f09ec27d12f749261c1e2870f655dfbcb73b051af130db8ddb06
7
+ data.tar.gz: 1d0bc776c389b430a758b0f5df0fd9803cda7d04725814491e73d7b8ef4f20cb9c05a3c5835d409b7bbb239ca8ba1a31be2e8efd4a8a97fa2830eb24ca9f2b79
data/CHANGELOG.md CHANGED
@@ -5,6 +5,15 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [1.11.0] - 2018-02-23
9
+ ### Added
10
+ - bin/check-es-query-average.rb: added flag of '--headers' so that headers can be passed to the elasticsearch http client (@alexandrustaetu)
11
+ - bin/check-es-query-average.rb: added flag of '--headers' so that headers can be passed to the elasticsearch http client (@alexandrustaetu)
12
+ - bin/check-es-query-average.rb: added flag of '--headers' so that headers can be passed to the elasticsearch http client (@alexandrustaetu)
13
+ - bin/check-es-query-average.rb: added flag of '--headers' so that headers can be passed to the elasticsearch http client (@alexandrustaetu)
14
+ - lib/sensu-plugins-elasticsearch/elasticsearch-common.rb: collect headers originating from query commands and pass them to the elasticsearch client (@alexandrustaetu)
15
+ - integration testing with es6 (@alexandrustaetu) (@majormoses)
16
+
8
17
  ## [1.10.0] - 2018-02-19
9
18
  ### Added
10
19
  - check-es-circuit-breakers.rb, check-es-cluster-status.rb, check-es-indices-sizes.rb, check-es-node-status.rb, metrics-es-cluster.rb, metrics-es-node-graphite.rb, metrics-es-node.rb: added `--cert-file` option which allows you to specify a ca-cert to be used to verify TLS (@csoleimani) (@majormoses)
@@ -217,7 +226,8 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
217
226
  - initial release
218
227
 
219
228
 
220
- [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-elasticsearch/compare/1.10.0...HEAD
229
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-elasticsearch/compare/1.11.0...HEAD
230
+ [1.11.0]: https://github.com/sensu-plugins/sensu-plugins-elasticsearch/compare/1.10.0...1.11.0
221
231
  [1.10.0]: https://github.com/sensu-plugins/sensu-plugins-elasticsearch/compare/1.9.0...1.10.0
222
232
  [1.9.0]: https://github.com/sensu-plugins/sensu-plugins-elasticsearch/compare/1.8.1...1.9.0
223
233
  [1.8.1]: https://github.com/sensu-plugins/sensu-plugins-elasticsearch/compare/1.8.0...1.8.1
data/README.md CHANGED
@@ -33,3 +33,22 @@
33
33
  [Installation and Setup](http://sensu-plugins.io/docs/installation_instructions.html)
34
34
 
35
35
  ## Notes
36
+
37
+ ## Testing
38
+
39
+ This repository uses the [Kitchen](https://kitchen.ci/) suite for it's tests.
40
+
41
+ Note: The test suite uses an elasticsearch instance in order to have passing tests. Execute the following command to create a mock elasticsearch 6 instance:
42
+
43
+ ```bash
44
+ docker run -d --name sensu-elasticsearch-6 docker.elastic.co/elasticsearch/elasticsearch:6.2.2
45
+ ```
46
+
47
+ Running the tests:
48
+
49
+ ```bash
50
+ bundle install --path vendor/bundle
51
+ bundle exec kitchen test
52
+ ```
53
+
54
+ You can find sample output for all tests running successfully in [this gist](https://gist.github.com/alexandrustaetu/d19feea1296d2ce7e367542265252d7a).
@@ -183,6 +183,12 @@ class ESQueryAverage < Sensu::Plugin::Check::CLI
183
183
  short: '-u USER',
184
184
  long: '--user USER'
185
185
 
186
+ option :headers,
187
+ description: 'A comma separated list of headers to pass to elasticsearch http client',
188
+ short: '-H headers',
189
+ long: '--headers headers',
190
+ default: 'Content-Type: application/json'
191
+
186
192
  option :timeout,
187
193
  description: 'Elasticsearch query timeout in seconds',
188
194
  short: '-t TIMEOUT',
@@ -171,6 +171,12 @@ class ESQueryCount < Sensu::Plugin::Check::CLI
171
171
  short: '-u USER',
172
172
  long: '--user USER'
173
173
 
174
+ option :headers,
175
+ description: 'A comma separated list of headers to pass to elasticsearch http client',
176
+ short: '-H headers',
177
+ long: '--headers headers',
178
+ default: 'Content-Type: application/json'
179
+
174
180
  option :timeout,
175
181
  description: 'Elasticsearch query timeout in seconds',
176
182
  short: '-t TIMEOUT',
@@ -157,6 +157,12 @@ class ESQueryExists < Sensu::Plugin::Check::CLI
157
157
  short: '-u USER',
158
158
  long: '--user USER'
159
159
 
160
+ option :headers,
161
+ description: 'A comma separated list of headers to pass to elasticsearch http client',
162
+ short: '-H headers',
163
+ long: '--headers headers',
164
+ default: 'Content-Type: application/json'
165
+
160
166
  option :timeout,
161
167
  description: 'Elasticsearch query timeout in seconds',
162
168
  short: '-t TIMEOUT',
@@ -179,6 +179,12 @@ class ESQueryRatio < Sensu::Plugin::Check::CLI
179
179
  short: '-u USER',
180
180
  long: '--user USER'
181
181
 
182
+ option :headers,
183
+ description: 'A comma separated list of headers to pass to elasticsearch http client',
184
+ short: '-H headers',
185
+ long: '--headers headers',
186
+ default: 'Content-Type: application/json'
187
+
182
188
  option :timeout,
183
189
  description: 'Elasticsearch query timeout in seconds',
184
190
  short: '-t TIMEOUT',
@@ -43,6 +43,21 @@ module ElasticsearchCommon
43
43
  host[:scheme] = 'https' unless config[:scheme]
44
44
  end
45
45
 
46
- @client ||= Elasticsearch::Client.new(transport_class: transport_class, hosts: [host], region: config[:region])
46
+ transport_options = {}
47
+
48
+ if config[:headers]
49
+
50
+ headers = {}
51
+
52
+ config[:headers].split(',').each do |header|
53
+ h, v = header.split(':', 2)
54
+ headers[h.strip] = v.strip
55
+ end
56
+
57
+ transport_options[:headers] = headers
58
+
59
+ end
60
+
61
+ @client ||= Elasticsearch::Client.new(transport_class: transport_class, hosts: [host], region: config[:region], transport_options: transport_options)
47
62
  end
48
63
  end
@@ -1,7 +1,7 @@
1
1
  module SensuPluginsElasticsearch
2
2
  module Version
3
3
  MAJOR = 1
4
- MINOR = 10
4
+ MINOR = 11
5
5
  PATCH = 0
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
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: 1.10.0
4
+ version: 1.11.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-02-20 00:00:00.000000000 Z
11
+ date: 2018-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-es-transport
@@ -134,6 +134,20 @@ dependencies:
134
134
  - - "~>"
135
135
  - !ruby/object:Gem::Version
136
136
  version: '1.3'
137
+ - !ruby/object:Gem::Dependency
138
+ name: kitchen-docker
139
+ requirement: !ruby/object:Gem::Requirement
140
+ requirements:
141
+ - - "~>"
142
+ - !ruby/object:Gem::Version
143
+ version: '2.6'
144
+ type: :development
145
+ prerelease: false
146
+ version_requirements: !ruby/object:Gem::Requirement
147
+ requirements:
148
+ - - "~>"
149
+ - !ruby/object:Gem::Version
150
+ version: '2.6'
137
151
  - !ruby/object:Gem::Dependency
138
152
  name: pry
139
153
  requirement: !ruby/object:Gem::Requirement
@@ -204,6 +218,20 @@ dependencies:
204
218
  - - "~>"
205
219
  - !ruby/object:Gem::Version
206
220
  version: 0.40.0
221
+ - !ruby/object:Gem::Dependency
222
+ name: test-kitchen
223
+ requirement: !ruby/object:Gem::Requirement
224
+ requirements:
225
+ - - "~>"
226
+ - !ruby/object:Gem::Version
227
+ version: 1.16.0
228
+ type: :development
229
+ prerelease: false
230
+ version_requirements: !ruby/object:Gem::Requirement
231
+ requirements:
232
+ - - "~>"
233
+ - !ruby/object:Gem::Version
234
+ version: 1.16.0
207
235
  - !ruby/object:Gem::Dependency
208
236
  name: yard
209
237
  requirement: !ruby/object:Gem::Requirement
@@ -224,23 +252,23 @@ description: |-
224
252
  service health and metrics for cluster, node, and more.
225
253
  email: "<sensu-users@googlegroups.com>"
226
254
  executables:
227
- - check-es-circuit-breakers.rb
255
+ - metrics-es-node.rb
256
+ - metrics-es-cluster.rb
228
257
  - check-es-cluster-health.rb
229
258
  - check-es-cluster-status.rb
230
- - check-es-file-descriptors.rb
231
259
  - check-es-heap.rb
232
260
  - check-es-indexes.rb
261
+ - check-es-query-ratio.rb
233
262
  - check-es-indices-sizes.rb
234
- - check-es-node-status.rb
235
- - check-es-query-average.rb
263
+ - metrics-es-node-graphite.rb
264
+ - check-es-circuit-breakers.rb
236
265
  - check-es-query-count.rb
237
266
  - check-es-query-exists.rb
238
- - check-es-query-ratio.rb
239
267
  - check-es-shard-allocation-status.rb
268
+ - check-es-node-status.rb
269
+ - check-es-query-average.rb
240
270
  - handler-es-delete-indices.rb
241
- - metrics-es-cluster.rb
242
- - metrics-es-node-graphite.rb
243
- - metrics-es-node.rb
271
+ - check-es-file-descriptors.rb
244
272
  extensions: []
245
273
  extra_rdoc_files: []
246
274
  files: