sensu-plugins-elasticsearch 1.3.1 → 1.4.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
  SHA1:
3
- metadata.gz: 4bac51cd8c7087847206136cf0c775a995ae95be
4
- data.tar.gz: d8968b335e2cfbfda858281ebee5b30bb9d72374
3
+ metadata.gz: 9b4b7956d75fed10e2ec31b024102d037cb8e43f
4
+ data.tar.gz: 11881f4536d042ec379c0fb92f641cf370628da7
5
5
  SHA512:
6
- metadata.gz: 714b0b5e018601d25a90909aab4530a476691ac24d549b6aaab17496841487c55ef5514b292bfb06ce6b0d49e999b0a975a2f5ccd1c43d2187716867e0223658
7
- data.tar.gz: 50e843b6bb4479014f4ac9d3f6259eea4c3f149262e262e63022e21ee27c45ba96ab12ddcc6d129f73d1071830a6bde0bd0f434bdd72329e856536abb63d94a1
6
+ metadata.gz: 91e3c7d70b0794c9cb27ec934ccaf8e9428ef816f3deb790acb148f30f0c7da0ac0f2f2f410d23ffbc7f15eebf0249f1130ae67329663a2172d6cf16c2ae9f74
7
+ data.tar.gz: b961e207fcb45f66ac6bbceb5a29054c988c620b9d8e9939dae7a63348fe31038545170a0e2d68e24fa19e805eaf9651781f272b0fbb11d37e77929eb5d76db0
data/CHANGELOG.md CHANGED
@@ -4,6 +4,16 @@ This project adheres to [Semantic Versioning](http://semver.org/).
4
4
  This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
5
5
 
6
6
  ## [Unreleased]
7
+ ## [1.4.0] - 2017-07-04
8
+ ### Added
9
+ - added ruby 2.4 testing (@majormoses)
10
+ - check-es-shard-allocation-status.rb: HTTP Basic Auth support added (@cihangirbesiktas)
11
+ - check-es-shard-allocation-status.rb: timeout option for rest calls (@cihangirbesiktas)
12
+
13
+
14
+ ### Fixed
15
+ - PR template spell "compatibility" correctly. (@majormoses)
16
+
7
17
  ## [1.3.1] - 2017-05-22
8
18
  ### Fixed
9
19
  - Conversion of previous_months option to Seconds (@guptaishabh)
@@ -149,7 +159,8 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
149
159
  ### Added
150
160
  - initial release
151
161
 
152
- [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-elasticsearch/compare/1.3.1...HEAD
162
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-elasticsearch/compare/1.4.0...HEAD
163
+ [1.4.0]: https://github.com/sensu-plugins/sensu-plugins-elasticsearch/compare/1.3.1...1.4.0
153
164
  [1.3.1]: https://github.com/sensu-plugins/sensu-plugins-elasticsearch/compare/1.3.0...1.3.1
154
165
  [1.3.0]: https://github.com/sensu-plugins/sensu-plugins-elasticsearch/compare/1.2.0...1.3.0
155
166
  [1.2.0]: https://github.com/sensu-plugins/sensu-plugins-elasticsearch/compare/1.1.3...1.2.0
@@ -30,6 +30,7 @@
30
30
  require 'sensu-plugin/check/cli'
31
31
  require 'rest-client'
32
32
  require 'json'
33
+ require 'base64'
33
34
 
34
35
  #
35
36
  # == Elastic Search Shard Allocation Status
@@ -58,13 +59,40 @@ class ESShardAllocationStatus < Sensu::Plugin::Check::CLI
58
59
  long: '--allow-non-master',
59
60
  default: false
60
61
 
62
+ option :timeout,
63
+ description: 'Sets the connection timeout for REST client',
64
+ short: '-t SECS',
65
+ long: '--timeout SECS',
66
+ proc: proc(&:to_i),
67
+ default: 45
68
+
69
+ option :user,
70
+ description: 'Elasticsearch User',
71
+ short: '-u USER',
72
+ long: '--user USER'
73
+
74
+ option :password,
75
+ description: 'Elasticsearch Password',
76
+ short: '-P PASS',
77
+ long: '--password PASS'
78
+
61
79
  def get_es_resource(resource)
62
- r = RestClient::Resource.new("#{config[:scheme]}://#{config[:server]}:#{config[:port]}#{resource}", timeout: 45)
80
+ headers = {}
81
+ if config[:user] && config[:password]
82
+ auth = 'Basic ' + Base64.strict_encode64("#{config[:user]}:#{config[:password]}").chomp
83
+ headers = { 'Authorization' => auth }
84
+ end
85
+
86
+ r = RestClient::Resource.new("#{config[:scheme]}://#{config[:server]}:#{config[:port]}#{resource}", timeout: config[:timeout], headers: headers)
63
87
  JSON.parse(r.get)
64
88
  rescue Errno::ECONNREFUSED
65
89
  warning 'Connection refused'
66
90
  rescue RestClient::RequestTimeout
67
- warning 'Connection timed out'
91
+ critical 'Connection timed out'
92
+ rescue RestClient::ServiceUnavailable
93
+ critical 'Service is unavailable'
94
+ rescue Errno::ECONNRESET
95
+ critical 'Connection reset by peer'
68
96
  end
69
97
 
70
98
  def master?
@@ -1,8 +1,8 @@
1
1
  module SensuPluginsElasticsearch
2
2
  module Version
3
3
  MAJOR = 1
4
- MINOR = 3
5
- PATCH = 1
4
+ MINOR = 4
5
+ PATCH = 0
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
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.3.1
4
+ version: 1.4.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: 2017-05-23 00:00:00.000000000 Z
11
+ date: 2017-07-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client