sensu-plugins-elasticsearch 0.1.1 → 0.1.2
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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/CHANGELOG.md +14 -8
- data/bin/check-es-cluster-status.rb +17 -1
- data/bin/check-es-file-descriptors.rb +18 -2
- data/bin/check-es-heap.rb +19 -3
- data/bin/check-es-node-status.rb +17 -1
- data/bin/metrics-es-cluster.rb +17 -1
- data/bin/metrics-es-node-graphite.rb +19 -3
- data/bin/metrics-es-node.rb +19 -3
- data/lib/sensu-plugins-elasticsearch/version.rb +1 -1
- metadata +5 -5
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ed1e5b2be5e2312ace43d768501b9dc7ee06998
|
4
|
+
data.tar.gz: 247045e2d44a0fdf7e72d9d6ab7fccaf9ec799eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da755db21691233c63e64a7fb51979ccf616e502f8e4935726bae4592258a915d27c4a24eef4f4fbf71d07640efcff82e0d5ce99de7de50b922fbda1de50577d
|
7
|
+
data.tar.gz: 9d29e89be06ab137540eed13ab6e0c753167069b333d3a277ed7e872e468662bb8066e535b5570be19b6b1ad3a7d9438cb814e46f9b0d04daa1ec2555205591d
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.md
CHANGED
@@ -3,14 +3,17 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
3
3
|
|
4
4
|
This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
|
5
5
|
|
6
|
-
## Unreleased][unreleased]
|
6
|
+
## [Unreleased][unreleased]
|
7
|
+
|
8
|
+
## [0.1.2] - 2015-08-11
|
9
|
+
### Added
|
10
|
+
- add parameters for elasticsearch auth
|
7
11
|
|
8
12
|
## [0.1.1] - 2015-07-14
|
9
13
|
### Changed
|
10
14
|
- updated sensu-plugin gem to 1.2.0
|
11
15
|
|
12
16
|
## [0.1.0] - 2015-07-06
|
13
|
-
|
14
17
|
### Added
|
15
18
|
- `check-es-node-status` node status check
|
16
19
|
|
@@ -23,16 +26,19 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
|
|
23
26
|
- put deps in alpha order in gemspec
|
24
27
|
- update documentation links in README and CONTRIBUTING
|
25
28
|
|
26
|
-
## 0.0.1 - 2015-05-21
|
27
|
-
|
28
|
-
### Added
|
29
|
-
- initial release
|
30
|
-
|
31
29
|
## [0.0.2] - 2015-06-02
|
32
|
-
|
33
30
|
### Fixed
|
34
31
|
- added binstubs
|
35
32
|
|
36
33
|
### Changed
|
37
34
|
- removed cruft from /lib
|
38
35
|
|
36
|
+
## 0.0.1 - 2015-05-21
|
37
|
+
### Added
|
38
|
+
- initial release
|
39
|
+
|
40
|
+
[unreleased]: https://github.com/sensu-plugins/sensu-plugins-elasticsearch/compare/0.1.2...HEAD
|
41
|
+
[0.1.2]: https://github.com/sensu-plugins/sensu-plugins-elasticsearch/compare/0.1.1...0.1.2
|
42
|
+
[0.1.1]: https://github.com/sensu-plugins/sensu-plugins-elasticsearch/compare/0.1.0...0.1.1
|
43
|
+
[0.1.0]: https://github.com/sensu-plugins/sensu-plugins-elasticsearch/compare/0.0.2...0.1.0
|
44
|
+
[0.0.2]: https://github.com/sensu-plugins/sensu-plugins-elasticsearch/compare/0.0.1...0.0.2
|
@@ -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
|
# ES Cluster Status
|
@@ -61,8 +62,23 @@ class ESClusterStatus < Sensu::Plugin::Check::CLI
|
|
61
62
|
proc: proc(&:to_i),
|
62
63
|
default: 30
|
63
64
|
|
65
|
+
option :user,
|
66
|
+
description: 'Elasticsearch User',
|
67
|
+
short: '-u USER',
|
68
|
+
long: '--user USER'
|
69
|
+
|
70
|
+
option :password,
|
71
|
+
description: 'Elasticsearch Password',
|
72
|
+
short: '-P PASS',
|
73
|
+
long: '--password PASS'
|
74
|
+
|
64
75
|
def get_es_resource(resource)
|
65
|
-
|
76
|
+
headers = {}
|
77
|
+
if config[:user] && config[:password]
|
78
|
+
auth = 'Basic ' + Base64.encode64("#{config[:user]}:#{config[:password]}").chomp
|
79
|
+
headers = { 'Authorization' => auth }
|
80
|
+
end
|
81
|
+
r = RestClient::Resource.new("http://#{config[:host]}:#{config[:port]}#{resource}", timeout: config[:timeout], headers: headers)
|
66
82
|
JSON.parse(r.get)
|
67
83
|
rescue Errno::ECONNREFUSED
|
68
84
|
critical 'Connection refused'
|
@@ -29,6 +29,7 @@
|
|
29
29
|
require 'sensu-plugin/check/cli'
|
30
30
|
require 'rest-client'
|
31
31
|
require 'json'
|
32
|
+
require 'base64'
|
32
33
|
|
33
34
|
#
|
34
35
|
# ES File Descriptiors
|
@@ -66,8 +67,23 @@ class ESFileDescriptors < Sensu::Plugin::Check::CLI
|
|
66
67
|
proc: proc(&:to_i),
|
67
68
|
default: 80
|
68
69
|
|
70
|
+
option :user,
|
71
|
+
description: 'Elasticsearch User',
|
72
|
+
short: '-u USER',
|
73
|
+
long: '--user USER'
|
74
|
+
|
75
|
+
option :password,
|
76
|
+
description: 'Elasticsearch Password',
|
77
|
+
short: '-P PASS',
|
78
|
+
long: '--password PASS'
|
79
|
+
|
69
80
|
def get_es_resource(resource)
|
70
|
-
|
81
|
+
headers = {}
|
82
|
+
if config[:user] && config[:password]
|
83
|
+
auth = 'Basic ' + Base64.encode64("#{config[:user]}:#{config[:password]}").chomp
|
84
|
+
headers = { 'Authorization' => auth }
|
85
|
+
end
|
86
|
+
r = RestClient::Resource.new("http://#{config[:host]}:#{config[:port]}#{resource}", timeout: config[:timeout], headers: headers)
|
71
87
|
JSON.parse(r.get)
|
72
88
|
rescue Errno::ECONNREFUSED
|
73
89
|
warning 'Connection refused'
|
@@ -95,7 +111,7 @@ class ESFileDescriptors < Sensu::Plugin::Check::CLI
|
|
95
111
|
end
|
96
112
|
end
|
97
113
|
|
98
|
-
def run
|
114
|
+
def run
|
99
115
|
open = acquire_open_fds
|
100
116
|
max = acquire_max_fds
|
101
117
|
used_percent = ((open.to_f / max.to_f) * 100).to_i
|
data/bin/check-es-heap.rb
CHANGED
@@ -29,6 +29,7 @@
|
|
29
29
|
require 'sensu-plugin/check/cli'
|
30
30
|
require 'rest-client'
|
31
31
|
require 'json'
|
32
|
+
require 'base64'
|
32
33
|
|
33
34
|
#
|
34
35
|
# ES Heap
|
@@ -74,13 +75,28 @@ class ESHeap < Sensu::Plugin::Check::CLI
|
|
74
75
|
description: 'Use the WARNING and CRITICAL threshold numbers as percentage indicators of the total heap available',
|
75
76
|
default: false
|
76
77
|
|
78
|
+
option :user,
|
79
|
+
description: 'Elasticsearch User',
|
80
|
+
short: '-u USER',
|
81
|
+
long: '--user USER'
|
82
|
+
|
83
|
+
option :password,
|
84
|
+
description: 'Elasticsearch Password',
|
85
|
+
short: '-W PASS',
|
86
|
+
long: '--password PASS'
|
87
|
+
|
77
88
|
def acquire_es_version
|
78
89
|
info = acquire_es_resource('/')
|
79
90
|
info['version']['number']
|
80
91
|
end
|
81
92
|
|
82
93
|
def acquire_es_resource(resource)
|
83
|
-
|
94
|
+
headers = {}
|
95
|
+
if config[:user] && config[:password]
|
96
|
+
auth = 'Basic ' + Base64.encode64("#{config[:user]}:#{config[:password]}").chomp
|
97
|
+
headers = { 'Authorization' => auth }
|
98
|
+
end
|
99
|
+
r = RestClient::Resource.new("http://#{config[:host]}:#{config[:port]}#{resource}", timeout: config[:timeout], headers: headers)
|
84
100
|
JSON.parse(r.get)
|
85
101
|
rescue Errno::ECONNREFUSED
|
86
102
|
warning 'Connection refused'
|
@@ -90,7 +106,7 @@ class ESHeap < Sensu::Plugin::Check::CLI
|
|
90
106
|
warning 'Elasticsearch API returned invalid JSON'
|
91
107
|
end
|
92
108
|
|
93
|
-
def acquire_heap_data(return_max = false)
|
109
|
+
def acquire_heap_data(return_max = false)
|
94
110
|
if Gem::Version.new(acquire_es_version) >= Gem::Version.new('1.0.0')
|
95
111
|
stats = acquire_es_resource('/_nodes/_local/stats?jvm=true')
|
96
112
|
node = stats['nodes'].keys.first
|
@@ -109,7 +125,7 @@ class ESHeap < Sensu::Plugin::Check::CLI
|
|
109
125
|
end
|
110
126
|
end
|
111
127
|
|
112
|
-
def run
|
128
|
+
def run
|
113
129
|
if config[:percentage]
|
114
130
|
heap_used, heap_max = acquire_heap_data(true)
|
115
131
|
heap_used_ratio = ((100 * heap_used) / heap_max).to_i
|
data/bin/check-es-node-status.rb
CHANGED
@@ -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
|
class ESNodeStatus < Sensu::Plugin::Check::CLI
|
35
36
|
option :host,
|
@@ -52,8 +53,23 @@ class ESNodeStatus < Sensu::Plugin::Check::CLI
|
|
52
53
|
proc: proc(&:to_i),
|
53
54
|
default: 30
|
54
55
|
|
56
|
+
option :user,
|
57
|
+
description: 'Elasticsearch User',
|
58
|
+
short: '-u USER',
|
59
|
+
long: '--user USER'
|
60
|
+
|
61
|
+
option :password,
|
62
|
+
description: 'Elasticsearch Password',
|
63
|
+
short: '-P PASS',
|
64
|
+
long: '--password PASS'
|
65
|
+
|
55
66
|
def get_es_resource(resource)
|
56
|
-
|
67
|
+
headers = {}
|
68
|
+
if config[:user] && config[:password]
|
69
|
+
auth = 'Basic ' + Base64.encode64("#{config[:user]}:#{config[:password]}").chomp
|
70
|
+
headers = { 'Authorization' => auth }
|
71
|
+
end
|
72
|
+
r = RestClient::Resource.new("http://#{config[:host]}:#{config[:port]}#{resource}", timeout: config[:timeout], headers: headers)
|
57
73
|
JSON.parse(r.get)
|
58
74
|
rescue Errno::ECONNREFUSED
|
59
75
|
critical 'Connection refused'
|
data/bin/metrics-es-cluster.rb
CHANGED
@@ -31,6 +31,7 @@
|
|
31
31
|
require 'sensu-plugin/metric/cli'
|
32
32
|
require 'rest-client'
|
33
33
|
require 'json'
|
34
|
+
require 'base64'
|
34
35
|
|
35
36
|
#
|
36
37
|
# ES Cluster Metrics
|
@@ -62,13 +63,28 @@ class ESClusterMetrics < Sensu::Plugin::Metric::CLI::Graphite
|
|
62
63
|
proc: proc(&:to_i),
|
63
64
|
default: 30
|
64
65
|
|
66
|
+
option :user,
|
67
|
+
description: 'Elasticsearch User',
|
68
|
+
short: '-u USER',
|
69
|
+
long: '--user USER'
|
70
|
+
|
71
|
+
option :password,
|
72
|
+
description: 'Elasticsearch Password',
|
73
|
+
short: '-P PASS',
|
74
|
+
long: '--password PASS'
|
75
|
+
|
65
76
|
def acquire_es_version
|
66
77
|
info = get_es_resource('/')
|
67
78
|
info['version']['number']
|
68
79
|
end
|
69
80
|
|
70
81
|
def get_es_resource(resource)
|
71
|
-
|
82
|
+
headers = {}
|
83
|
+
if config[:user] && config[:password]
|
84
|
+
auth = 'Basic ' + Base64.encode64("#{config[:user]}:#{config[:password]}").chomp
|
85
|
+
headers = { 'Authorization' => auth }
|
86
|
+
end
|
87
|
+
r = RestClient::Resource.new("http://#{config[:host]}:#{config[:port]}#{resource}", timeout: config[:timeout], headers: headers)
|
72
88
|
JSON.parse(r.get)
|
73
89
|
rescue Errno::ECONNREFUSED
|
74
90
|
warning 'Connection refused'
|
@@ -38,6 +38,7 @@
|
|
38
38
|
require 'sensu-plugin/metric/cli'
|
39
39
|
require 'rest-client'
|
40
40
|
require 'json'
|
41
|
+
require 'base64'
|
41
42
|
|
42
43
|
#
|
43
44
|
# ES Node Graphite Metrics
|
@@ -93,8 +94,23 @@ class ESNodeGraphiteMetrics < Sensu::Plugin::Metric::CLI::Graphite
|
|
93
94
|
boolean: true,
|
94
95
|
default: false
|
95
96
|
|
97
|
+
option :user,
|
98
|
+
description: 'Elasticsearch User',
|
99
|
+
short: '-u USER',
|
100
|
+
long: '--user USER'
|
101
|
+
|
102
|
+
option :password,
|
103
|
+
description: 'Elasticsearch Password',
|
104
|
+
short: '-P PASS',
|
105
|
+
long: '--password PASS'
|
106
|
+
|
96
107
|
def get_es_resource(resource)
|
97
|
-
|
108
|
+
headers = {}
|
109
|
+
if config[:user] && config[:password]
|
110
|
+
auth = 'Basic ' + Base64.encode64("#{config[:user]}:#{config[:password]}").chomp
|
111
|
+
headers = { 'Authorization' => auth }
|
112
|
+
end
|
113
|
+
r = RestClient::Resource.new("http://#{config[:server]}:#{config[:port]}#{resource}?pretty", timeout: config[:timeout], headers: headers)
|
98
114
|
JSON.parse(r.get)
|
99
115
|
rescue Errno::ECONNREFUSED
|
100
116
|
warning 'Connection refused'
|
@@ -194,7 +210,7 @@ class ESNodeGraphiteMetrics < Sensu::Plugin::Metric::CLI::Graphite
|
|
194
210
|
node['indices'].each do |type, index|
|
195
211
|
index.each do |k, v|
|
196
212
|
# #YELLOW
|
197
|
-
unless k =~ /(_time$)/ || v =~ /\d+/
|
213
|
+
unless k =~ /(_time$)/ || v =~ /\d+/
|
198
214
|
metrics["indices.#{type}.#{k}"] = v
|
199
215
|
end
|
200
216
|
end
|
@@ -202,7 +218,7 @@ class ESNodeGraphiteMetrics < Sensu::Plugin::Metric::CLI::Graphite
|
|
202
218
|
|
203
219
|
node['transport'].each do |k, v|
|
204
220
|
# #YELLOW
|
205
|
-
unless k =~ /(_size$)/
|
221
|
+
unless k =~ /(_size$)/
|
206
222
|
metrics["transport.#{k}"] = v
|
207
223
|
end
|
208
224
|
end
|
data/bin/metrics-es-node.rb
CHANGED
@@ -31,6 +31,7 @@
|
|
31
31
|
require 'sensu-plugin/metric/cli'
|
32
32
|
require 'rest-client'
|
33
33
|
require 'json'
|
34
|
+
require 'base64'
|
34
35
|
|
35
36
|
#
|
36
37
|
# ES Node Metrics
|
@@ -55,9 +56,24 @@ class ESMetrics < Sensu::Plugin::Metric::CLI::Graphite
|
|
55
56
|
proc: proc(&:to_i),
|
56
57
|
default: 9200
|
57
58
|
|
58
|
-
|
59
|
-
|
60
|
-
|
59
|
+
option :user,
|
60
|
+
description: 'Elasticsearch User',
|
61
|
+
short: '-u USER',
|
62
|
+
long: '--user USER'
|
63
|
+
|
64
|
+
option :password,
|
65
|
+
description: 'Elasticsearch Password',
|
66
|
+
short: '-P PASS',
|
67
|
+
long: '--password PASS'
|
68
|
+
|
69
|
+
def run
|
70
|
+
headers = {}
|
71
|
+
if config[:user] && config[:password]
|
72
|
+
auth = 'Basic ' + Base64.encode64("#{config[:user]}:#{config[:password]}").chomp
|
73
|
+
headers = { 'Authorization' => auth }
|
74
|
+
end
|
75
|
+
ln = RestClient::Resource.new "http://#{config[:host]}:#{config[:port]}/_cluster/nodes/_local", timeout: 30, headers: headers
|
76
|
+
stats = RestClient::Resource.new "http://#{config[:host]}:#{config[:port]}/_cluster/nodes/_local/stats", timeout: 30, headers: headers
|
61
77
|
ln = JSON.parse(ln.get)
|
62
78
|
stats = JSON.parse(stats.get)
|
63
79
|
timestamp = Time.now.to_i
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-plugins-elasticsearch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sensu Plugins and contributors
|
@@ -30,7 +30,7 @@ cert_chain:
|
|
30
30
|
8sHuVruarogxxKPBzlL2is4EUb6oN/RdpGx2l4254+nyR+abg//Ed27Ym0PkB4lk
|
31
31
|
HP0m8WSjZmFr109pE/sVsM5jtOCvogyujQOjNVGN4gz1wwPr
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date: 2015-
|
33
|
+
date: 2015-08-12 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: rest-client
|
@@ -150,14 +150,14 @@ dependencies:
|
|
150
150
|
requirements:
|
151
151
|
- - '='
|
152
152
|
- !ruby/object:Gem::Version
|
153
|
-
version:
|
153
|
+
version: 0.32.1
|
154
154
|
type: :development
|
155
155
|
prerelease: false
|
156
156
|
version_requirements: !ruby/object:Gem::Requirement
|
157
157
|
requirements:
|
158
158
|
- - '='
|
159
159
|
- !ruby/object:Gem::Version
|
160
|
-
version:
|
160
|
+
version: 0.32.1
|
161
161
|
- !ruby/object:Gem::Dependency
|
162
162
|
name: rspec
|
163
163
|
requirement: !ruby/object:Gem::Requirement
|
@@ -237,7 +237,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
237
237
|
version: '0'
|
238
238
|
requirements: []
|
239
239
|
rubyforge_project:
|
240
|
-
rubygems_version: 2.4.
|
240
|
+
rubygems_version: 2.4.8
|
241
241
|
signing_key:
|
242
242
|
specification_version: 4
|
243
243
|
summary: Sensu plugins for elasticsearch
|
metadata.gz.sig
CHANGED
Binary file
|