sensu-plugins-elasticsearch 1.1.3 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4cf660c00d0f12fd0495a16b3bae4720b6116ff1
4
- data.tar.gz: 8ada34c80777d6f0ec07b17a22de21f9d34721f1
3
+ metadata.gz: 07a6752410931a8f63c7de143df9c84cae249b41
4
+ data.tar.gz: c2d1771cde187e3b7f5b4d225428238d18f7966d
5
5
  SHA512:
6
- metadata.gz: 57480b7dc012d422bbf3bd6a306e257a9139cded4c7ab93465244c3e5ff53cae8cdd034f6e03100c9257d35467a7b01b199522f02765e1987b2c28debe34f0a5
7
- data.tar.gz: 8ee4b65d749dc139685b940487ec05cfab072e211c7d0d6e03db220f3cb9b30d74ffa23f86da2772070d43e2be440f596ef6446a07c75b3b3ab5da653b2bbac2
6
+ metadata.gz: d39482790fdcc0ded89b8f05b5c04ea20cdad77d35926806c3b2adeae691c835f64d2c3a5ae36b49656857038ac7352d5363ac3d45af8f80ce91d96ffcbc7d77
7
+ data.tar.gz: 8bce7fd56da1cbf025560a7f4b5a64f7e874166635631304242bbcb52346550e585443c2b581bb82e1feeef934f1c3a470af8c38a68e875da43e2a683c8d272f
data/CHANGELOG.md CHANGED
@@ -4,6 +4,12 @@ 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.2.0] - 2017-05-03
8
+ ### Fixed
9
+ - metrics-es-cluster.rb: Check to see if cluster key exists in transient_settings before trying to use it. (@RAR)
10
+ ### Added
11
+ - Add option to run check-es-shard-allocation-status.rb on non master nodes (@Evesy)
12
+ - Fixed check-es-shard-allocation-status.rb for Elasticsearch 5.x compatibility (@Evesy)
7
13
 
8
14
  ## [1.1.3] - 2017-01-04
9
15
  ### Fixed
@@ -135,7 +141,8 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
135
141
  ### Added
136
142
  - initial release
137
143
 
138
- [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-elasticsearch/compare/1.1.3...HEAD
144
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-elasticsearch/compare/1.2.0...HEAD
145
+ [1.2.0]: https://github.com/sensu-plugins/sensu-plugins-elasticsearch/compare/1.1.3...1.2.0
139
146
  [1.1.3]: https://github.com/sensu-plugins/sensu-plugins-elasticsearch/compare/1.1.2...1.1.3
140
147
  [1.1.2]: https://github.com/sensu-plugins/sensu-plugins-elasticsearch/compare/1.1.1...1.1.2
141
148
  [1.1.1]: https://github.com/sensu-plugins/sensu-plugins-elasticsearch/compare/1.1.0...1.1.1
@@ -52,8 +52,14 @@ class ESShardAllocationStatus < Sensu::Plugin::Check::CLI
52
52
  long: '--port PORT',
53
53
  default: '9200'
54
54
 
55
+ option :allow_non_master,
56
+ description: 'Allow check to run on non-master nodes',
57
+ short: '-a',
58
+ long: '--allow-non-master',
59
+ default: false
60
+
55
61
  def get_es_resource(resource)
56
- r = RestClient::Resource.new("#{config[:scheme]}://#{config[:server]}:#{config[:port]}/#{resource}", timeout: 45)
62
+ r = RestClient::Resource.new("#{config[:scheme]}://#{config[:server]}:#{config[:port]}#{resource}", timeout: 45)
57
63
  JSON.parse(r.get)
58
64
  rescue Errno::ECONNREFUSED
59
65
  warning 'Connection refused'
@@ -62,7 +68,7 @@ class ESShardAllocationStatus < Sensu::Plugin::Check::CLI
62
68
  end
63
69
 
64
70
  def master?
65
- state = get_es_resource('/_cluster/state?filter_routing_table=true&filter_metadata=true&filter_indices=true&filter_blocks=true&filter_nodes=true')
71
+ state = get_es_resource('/_cluster/state/master_node')
66
72
  local = get_es_resource('/_nodes/_local')
67
73
  local['nodes'].keys.first == state['master_node']
68
74
  end
@@ -79,7 +85,7 @@ class ESShardAllocationStatus < Sensu::Plugin::Check::CLI
79
85
  end
80
86
 
81
87
  def run
82
- if master?
88
+ if config[:allow_non_master] || master?
83
89
  transient = get_status('transient')
84
90
  persistent = get_status('persistent')
85
91
 
@@ -177,10 +177,10 @@ class ESClusterMetrics < Sensu::Plugin::Metric::CLI::Graphite
177
177
  def acquire_allocation_status
178
178
  cluster_config = get_es_resource('/_cluster/settings')
179
179
  transient_settings = cluster_config['transient']
180
- if transient_settings.empty?
181
- return nil
182
- else
180
+ if transient_settings.key?('cluster')
183
181
  return %w(none new_primaries primaries all).index(transient_settings['cluster']['routing']['allocation']['enable'])
182
+ else
183
+ return nil
184
184
  end
185
185
  end
186
186
 
@@ -1,8 +1,8 @@
1
1
  module SensuPluginsElasticsearch
2
2
  module Version
3
3
  MAJOR = 1
4
- MINOR = 1
5
- PATCH = 3
4
+ MINOR = 2
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.1.3
4
+ version: 1.2.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-01-04 00:00:00.000000000 Z
11
+ date: 2017-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client