sensu-plugins-elasticsearch 1.9.0 → 1.10.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
  SHA256:
3
- metadata.gz: 6b22a38f736dceb2b5f955a7fe3905e049e76f5c4bbf9a3936b33442a049f921
4
- data.tar.gz: 8f7a784cf59a113268d6d74cec17bb9ed1d54fff32aa1bdcb9e8ceedfe52cab4
3
+ metadata.gz: 5642696a8f37d54e95e2be913af5fb1694dee4c86e73e700cc1bb14c4ebdec14
4
+ data.tar.gz: 253b4e9aaf0a44a6aa1d8224644343b9f5d27d6cadbdb4de73a36e2cb6dfbfb9
5
5
  SHA512:
6
- metadata.gz: 941aa2d8224ee7a2da2c1b7095363c30c24dcfd0921830ac379379640179e78c3ccb89172cce9e3b41d43ad5a5cd4009dee26dd727ad7f08addf9151dd67d848
7
- data.tar.gz: 539cb8886f527d092fa7dd8a5a9021649c5477612b1bca9f617574aa5cc1f9a69ade798f9561cb0da4249df26cd4f17ac8570e8f2f0b4522ff98bc6f9ca8117a
6
+ metadata.gz: 1c8299a54b50656ac4da0a7682694024586cda2d9228af287de7a83d6579b14155c8aacf01656b170a91ac1728ff1358d55eab3be4621f7146dbff8e843fbd8c
7
+ data.tar.gz: 519e411301630fcfb1e40af4af6b369f4f08ff2aea3308287aba2f5a9981444fdaea84aa4e348b6c26431797fc794b6d0b5b05f3b6bef50b2d631a91bbe19f0c
data/CHANGELOG.md CHANGED
@@ -5,6 +5,10 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [1.10.0] - 2018-02-19
9
+ ### Added
10
+ - 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)
11
+
8
12
  ## [1.9.0] - 2018-02-19
9
13
  ### Changed
10
14
  - bin/check-es-node-status.rb: updated to check the status of all nodes in a cluster (@cihangirbesiktas)
@@ -213,8 +217,9 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
213
217
  - initial release
214
218
 
215
219
 
216
- [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-elasticsearch/compare/1.9.0...HEAD
217
- [1.9.0]: https://github.com/sensu-plugins/sensu-plugins-elasticsearch/compare/1.8.1.9.0
220
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-elasticsearch/compare/1.10.0...HEAD
221
+ [1.10.0]: https://github.com/sensu-plugins/sensu-plugins-elasticsearch/compare/1.9.0...1.10.0
222
+ [1.9.0]: https://github.com/sensu-plugins/sensu-plugins-elasticsearch/compare/1.8.1...1.9.0
218
223
  [1.8.1]: https://github.com/sensu-plugins/sensu-plugins-elasticsearch/compare/1.8.0...1.8.1
219
224
  [1.8.0]: https://github.com/sensu-plugins/sensu-plugins-elasticsearch/compare/1.7.1...1.8.0
220
225
  [1.7.1]: https://github.com/sensu-plugins/sensu-plugins-elasticsearch/compare/1.7.0...1.7.1
@@ -69,6 +69,10 @@ class ESCircuitBreaker < Sensu::Plugin::Check::CLI
69
69
  short: '-e',
70
70
  long: '--https'
71
71
 
72
+ option :cert_file,
73
+ description: 'Cert file to use',
74
+ long: '--cert-file CERT'
75
+
72
76
  option :localhost,
73
77
  description: 'only check local node',
74
78
  short: '-l',
@@ -89,7 +93,16 @@ class ESCircuitBreaker < Sensu::Plugin::Check::CLI
89
93
  'http'
90
94
  end
91
95
 
92
- r = RestClient::Resource.new("#{protocol}://#{config[:host]}:#{config[:port]}#{resource}", timeout: config[:timeout], headers: headers)
96
+ r = if config[:cert_file]
97
+ RestClient::Resource.new("#{protocol}://#{config[:host]}:#{config[:port]}#{resource}",
98
+ ssl_ca_file: config[:cert_file].to_s,
99
+ timeout: config[:timeout],
100
+ headers: headers)
101
+ else
102
+ RestClient::Resource.new("#{protocol}://#{config[:host]}:#{config[:port]}#{resource}",
103
+ timeout: config[:timeout],
104
+ headers: headers)
105
+ end
93
106
  JSON.parse(r.get)
94
107
  rescue Errno::ECONNREFUSED
95
108
  critical 'Connection refused'
@@ -83,6 +83,10 @@ class ESClusterStatus < Sensu::Plugin::Check::CLI
83
83
  short: '-e',
84
84
  long: '--https'
85
85
 
86
+ option :cert_file,
87
+ description: 'Cert file to use',
88
+ long: '--cert-file CERT_FILE'
89
+
86
90
  option :alert_status,
87
91
  description: 'Only alert when status matches given RED/YELLOW/GREEN or if blank all statuses',
88
92
  long: '--alert-status STATUS',
@@ -102,7 +106,16 @@ class ESClusterStatus < Sensu::Plugin::Check::CLI
102
106
  'http'
103
107
  end
104
108
 
105
- r = RestClient::Resource.new("#{protocol}://#{config[:host]}:#{config[:port]}#{resource}", timeout: config[:timeout], headers: headers)
109
+ r = if config[:cert_file]
110
+ RestClient::Resource.new("#{protocol}://#{config[:host]}:#{config[:port]}#{resource}",
111
+ ssl_ca_file: config[:cert_file].to_s,
112
+ timeout: config[:timeout],
113
+ headers: headers)
114
+ else
115
+ RestClient::Resource.new("#{protocol}://#{config[:host]}:#{config[:port]}#{resource}",
116
+ timeout: config[:timeout],
117
+ headers: headers)
118
+ end
106
119
  JSON.parse(r.get)
107
120
  rescue Errno::ECONNREFUSED
108
121
  critical 'Connection refused'
@@ -159,12 +159,11 @@ class ESCheckIndicesSizes < Sensu::Plugin::Check::CLI
159
159
  def run
160
160
  node_fs_stats = client.nodes.stats metric: 'fs,indices'
161
161
  nodes_being_used = node_fs_stats['nodes'].values.select { |node| node['indices']['store']['size_in_bytes'] > 0 }
162
- # rubocop:disable SingleLineBlockParams
163
- # rubocop:disable LineLength
164
- 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 }
165
- # rubocop:enable LineLength
162
+ # TODO: come back and cleanup all these rubocop disables with a little refactor
163
+ # rubocop:disable Style/SingleLineBlockParams
164
+ 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 } # rubocop:disable LineLength
166
165
  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 SingleLineBlockParams
166
+ # rubocop:enable Style/SingleLineBlockParams LineLength
168
167
 
169
168
  if config[:maximum_megabytes] > 0
170
169
  target_bytes_used = config[:maximum_megabytes] * 1_000_000
@@ -68,6 +68,10 @@ class ESNodeStatus < Sensu::Plugin::Check::CLI
68
68
  short: '-e',
69
69
  long: '--https'
70
70
 
71
+ option :cert_file,
72
+ description: 'Cert file to use',
73
+ long: '--cert-file CERT_FILE'
74
+
71
75
  option :all,
72
76
  description: 'Check all nodes in the ES cluster',
73
77
  short: '-a',
@@ -87,7 +91,16 @@ class ESNodeStatus < Sensu::Plugin::Check::CLI
87
91
  'http'
88
92
  end
89
93
 
90
- r = RestClient::Resource.new("#{protocol}://#{config[:host]}:#{config[:port]}#{resource}", timeout: config[:timeout], headers: headers)
94
+ r = if config[:cert_file]
95
+ RestClient::Resource.new("#{protocol}://#{config[:host]}:#{config[:port]}#{resource}",
96
+ ssl_ca_file: config[:cert_file].to_s,
97
+ timeout: config[:timeout],
98
+ headers: headers)
99
+ else
100
+ RestClient::Resource.new("#{protocol}://#{config[:host]}:#{config[:port]}#{resource}",
101
+ timeout: config[:timeout],
102
+ headers: headers)
103
+ end
91
104
  r.get
92
105
  rescue Errno::ECONNREFUSED
93
106
  critical 'Connection refused'
@@ -90,6 +90,10 @@ class ESClusterMetrics < Sensu::Plugin::Metric::CLI::Graphite
90
90
  short: '-e',
91
91
  long: '--https'
92
92
 
93
+ option :cert_file,
94
+ description: 'Cert file to use',
95
+ long: '--cert-file CERT_FILE'
96
+
93
97
  def acquire_es_version
94
98
  info = get_es_resource('/')
95
99
  info['version']['number']
@@ -108,7 +112,16 @@ class ESClusterMetrics < Sensu::Plugin::Metric::CLI::Graphite
108
112
  'http'
109
113
  end
110
114
 
111
- r = RestClient::Resource.new("#{protocol}://#{config[:host]}:#{config[:port]}#{resource}", timeout: config[:timeout], headers: headers)
115
+ r = if config[:cert_file]
116
+ RestClient::Resource.new("#{protocol}://#{config[:host]}:#{config[:port]}#{resource}",
117
+ ssl_ca_file: config[:cert_file].to_s,
118
+ timeout: config[:timeout],
119
+ headers: headers)
120
+ else
121
+ RestClient::Resource.new("#{protocol}://#{config[:host]}:#{config[:port]}#{resource}",
122
+ timeout: config[:timeout],
123
+ headers: headers)
124
+ end
112
125
  JSON.parse(r.get)
113
126
  rescue Errno::ECONNREFUSED
114
127
  warning 'Connection refused'
@@ -115,6 +115,10 @@ class ESNodeGraphiteMetrics < Sensu::Plugin::Metric::CLI::Graphite
115
115
  short: '-e',
116
116
  long: '--https'
117
117
 
118
+ option :cert_file,
119
+ description: 'Cert file to use',
120
+ long: '--cert-file CERT_FILE'
121
+
118
122
  def get_es_resource(resource)
119
123
  headers = {}
120
124
  if config[:user] && config[:password]
@@ -128,7 +132,16 @@ class ESNodeGraphiteMetrics < Sensu::Plugin::Metric::CLI::Graphite
128
132
  'http'
129
133
  end
130
134
 
131
- r = RestClient::Resource.new("#{protocol}://#{config[:server]}:#{config[:port]}#{resource}?pretty", timeout: config[:timeout], headers: headers)
135
+ r = if config[:cert_file]
136
+ RestClient::Resource.new("#{protocol}://#{config[:host]}:#{config[:port]}#{resource}",
137
+ ssl_ca_file: config[:cert_file].to_s,
138
+ timeout: config[:timeout],
139
+ headers: headers)
140
+ else
141
+ RestClient::Resource.new("#{protocol}://#{config[:server]}:#{config[:port]}#{resource}?pretty",
142
+ timeout: config[:timeout],
143
+ headers: headers)
144
+ end
132
145
  JSON.parse(r.get)
133
146
  rescue Errno::ECONNREFUSED
134
147
  warning 'Connection refused'
@@ -71,6 +71,10 @@ class ESMetrics < Sensu::Plugin::Metric::CLI::Graphite
71
71
  short: '-e',
72
72
  long: '--https'
73
73
 
74
+ option :cert_file,
75
+ description: 'Cert file to use',
76
+ long: '--cert CERT_FILE'
77
+
74
78
  def acquire_es_version
75
79
  info = get_es_resource('/')
76
80
  info['version']['number']
@@ -89,7 +93,16 @@ class ESMetrics < Sensu::Plugin::Metric::CLI::Graphite
89
93
  'http'
90
94
  end
91
95
 
92
- r = RestClient::Resource.new("#{protocol}://#{config[:host]}:#{config[:port]}#{resource}", timeout: config[:timeout], headers: headers)
96
+ r = if config[:cert_file]
97
+ RestClient::Resource.new("#{protocol}://#{config[:host]}:#{config[:port]}#{resource}",
98
+ ssl_ca_file: config[:cert_file].to_s,
99
+ timeout: config[:timeout],
100
+ headers: headers)
101
+ else
102
+ RestClient::Resource.new("#{protocol}://#{config[:host]}:#{config[:port]}#{resource}",
103
+ timeout: config[:timeout],
104
+ headers: headers)
105
+ end
93
106
  JSON.parse(r.get)
94
107
  rescue Errno::ECONNREFUSED
95
108
  warning 'Connection refused'
@@ -1,7 +1,7 @@
1
1
  module SensuPluginsElasticsearch
2
2
  module Version
3
3
  MAJOR = 1
4
- MINOR = 9
4
+ MINOR = 10
5
5
  PATCH = 0
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
metadata CHANGED
@@ -1,43 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-elasticsearch
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.0
4
+ version: 1.10.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-19 00:00:00.000000000 Z
11
+ date: 2018-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: rest-client
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - '='
18
- - !ruby/object:Gem::Version
19
- version: 1.8.0
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - '='
25
- - !ruby/object:Gem::Version
26
- version: 1.8.0
27
- - !ruby/object:Gem::Dependency
28
- name: elasticsearch
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: 1.0.14
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: 1.0.14
41
13
  - !ruby/object:Gem::Dependency
42
14
  name: aws-es-transport
43
15
  requirement: !ruby/object:Gem::Requirement
@@ -78,6 +50,34 @@ dependencies:
78
50
  - - "~>"
79
51
  - !ruby/object:Gem::Version
80
52
  version: '2.1'
53
+ - !ruby/object:Gem::Dependency
54
+ name: elasticsearch
55
+ requirement: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - "~>"
58
+ - !ruby/object:Gem::Version
59
+ version: 1.0.14
60
+ type: :runtime
61
+ prerelease: false
62
+ version_requirements: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - "~>"
65
+ - !ruby/object:Gem::Version
66
+ version: 1.0.14
67
+ - !ruby/object:Gem::Dependency
68
+ name: rest-client
69
+ requirement: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - '='
72
+ - !ruby/object:Gem::Version
73
+ version: 1.8.0
74
+ type: :runtime
75
+ prerelease: false
76
+ version_requirements: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - '='
79
+ - !ruby/object:Gem::Version
80
+ version: 1.8.0
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: sensu-plugin
83
83
  requirement: !ruby/object:Gem::Requirement
@@ -177,33 +177,33 @@ dependencies:
177
177
  - !ruby/object:Gem::Version
178
178
  version: '3.2'
179
179
  - !ruby/object:Gem::Dependency
180
- name: rubocop
180
+ name: rspec
181
181
  requirement: !ruby/object:Gem::Requirement
182
182
  requirements:
183
183
  - - "~>"
184
184
  - !ruby/object:Gem::Version
185
- version: 0.40.0
185
+ version: '3.1'
186
186
  type: :development
187
187
  prerelease: false
188
188
  version_requirements: !ruby/object:Gem::Requirement
189
189
  requirements:
190
190
  - - "~>"
191
191
  - !ruby/object:Gem::Version
192
- version: 0.40.0
192
+ version: '3.1'
193
193
  - !ruby/object:Gem::Dependency
194
- name: rspec
194
+ name: rubocop
195
195
  requirement: !ruby/object:Gem::Requirement
196
196
  requirements:
197
197
  - - "~>"
198
198
  - !ruby/object:Gem::Version
199
- version: '3.1'
199
+ version: 0.40.0
200
200
  type: :development
201
201
  prerelease: false
202
202
  version_requirements: !ruby/object:Gem::Requirement
203
203
  requirements:
204
204
  - - "~>"
205
205
  - !ruby/object:Gem::Version
206
- version: '3.1'
206
+ version: 0.40.0
207
207
  - !ruby/object:Gem::Dependency
208
208
  name: yard
209
209
  requirement: !ruby/object:Gem::Requirement