sensu-plugins-solr 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +13 -2
- data/README.md +1 -0
- data/bin/check-solr-replication-lag.rb +95 -0
- data/lib/sensu-plugins-solr/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 72d62cfdf77fb555ccf841545ba26e20081dd34f2adfc85ebb9759c1f1a15f73
|
4
|
+
data.tar.gz: 60a31f9490e3128fc5de498a22ea9a027f5d8099114e363093e37805b7c827cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3c60bd81d3590ff5ee8ad504cab35c3a0c8687e1fd1084e1a67e47dccdcc98059fb531c4427678df6b3fff6cdee928fa00cd8d581cbd32650e6edcb2b8b2daa
|
7
|
+
data.tar.gz: 700e078b60ab9ac33a48c96367732f3301f494175377341ab88656b1211995ee8cbc7919f7ab82f64f77f02a0ecbe12c19d163e4925e833529ced684cd80b5a1
|
data/CHANGELOG.md
CHANGED
@@ -1,10 +1,20 @@
|
|
1
1
|
# Change Log
|
2
2
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
3
3
|
|
4
|
-
This CHANGELOG follows the format listed
|
4
|
+
This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins/community/blob/master/HOW_WE_CHANGELOG.md)
|
5
5
|
|
6
6
|
## [Unreleased]
|
7
7
|
|
8
|
+
## [1.1.0] - 2018-07-12
|
9
|
+
### Added
|
10
|
+
- Added solr replication lag check (@alexbumbacea)
|
11
|
+
|
12
|
+
### Changed
|
13
|
+
- updated link to changelog guidelines (@majormoses)
|
14
|
+
|
15
|
+
### Fixed
|
16
|
+
- minor typos in PR template (@majormoses)
|
17
|
+
|
8
18
|
## [1.0.0] - 2017-05-10
|
9
19
|
### Added
|
10
20
|
- Ruby 2.3 and 2.4 support (@eheydrick)
|
@@ -30,7 +40,8 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
|
|
30
40
|
### Added
|
31
41
|
- initial release
|
32
42
|
|
33
|
-
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-solr/compare/1.
|
43
|
+
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-solr/compare/1.1.0...HEAD
|
44
|
+
[1.1.0]: https://github.com/sensu-plugins/sensu-plugins-solr/compare/1.0.0...1.1.0
|
34
45
|
[1.0.0]: https://github.com/sensu-plugins/sensu-plugins-solr/compare/0.0.3...1.0.0
|
35
46
|
[0.0.3]: https://github.com/sensu-plugins/sensu-plugins-solr/compare/0.0.2...0.0.3
|
36
47
|
[0.0.2]: https://github.com/sensu-plugins/sensu-plugins-solr/compare/0.0.1...0.0.2
|
data/README.md
CHANGED
@@ -0,0 +1,95 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# Check how behind replication is.
|
4
|
+
# ===
|
5
|
+
#
|
6
|
+
# Released under the same terms as Sensu (the MIT license); see LICENSE
|
7
|
+
# for details.
|
8
|
+
|
9
|
+
require 'sensu-plugin/check/cli'
|
10
|
+
require 'rest-client'
|
11
|
+
require 'json'
|
12
|
+
require 'date'
|
13
|
+
|
14
|
+
class SolrCheckReplication < Sensu::Plugin::Check::CLI
|
15
|
+
option :host,
|
16
|
+
short: '-h HOST',
|
17
|
+
long: '--host HOST',
|
18
|
+
description: 'Solr Host to connect to',
|
19
|
+
required: true
|
20
|
+
|
21
|
+
option :port,
|
22
|
+
short: '-p PORT',
|
23
|
+
long: '--port PORT',
|
24
|
+
description: 'Solr Port to connect to',
|
25
|
+
proc: proc(&:to_i),
|
26
|
+
required: true
|
27
|
+
|
28
|
+
option :protocol,
|
29
|
+
long: '--protocol PROTOCOL',
|
30
|
+
description: 'The connection protocol to use',
|
31
|
+
in: %w(http https), # this controls the acceptable inputs
|
32
|
+
default: 'http'
|
33
|
+
|
34
|
+
option :core,
|
35
|
+
description: 'Solr Core to check',
|
36
|
+
short: '-d CORE',
|
37
|
+
long: '--core CORE',
|
38
|
+
required: true
|
39
|
+
|
40
|
+
option :warning,
|
41
|
+
description: 'Warning if greater than X seconds',
|
42
|
+
short: '-w SECONDS',
|
43
|
+
proc: proc(&:to_i),
|
44
|
+
default: 1200
|
45
|
+
|
46
|
+
option :critical,
|
47
|
+
description: 'Critical if greater than X seconds',
|
48
|
+
short: '-c SECONDS',
|
49
|
+
proc: proc(&:to_i),
|
50
|
+
default: 3600
|
51
|
+
|
52
|
+
option :core_missing_ok,
|
53
|
+
short: '-x',
|
54
|
+
long: '--core-missing-ok',
|
55
|
+
description: 'Allow core to be missing (consider ok)',
|
56
|
+
boolean: true,
|
57
|
+
default: false
|
58
|
+
|
59
|
+
def get_url_json(url, notfoundok)
|
60
|
+
r = RestClient::Resource.new(url, timeout: 45)
|
61
|
+
JSON.parse(r.get)
|
62
|
+
rescue Errno::ECONNREFUSED
|
63
|
+
warning 'Connection refused'
|
64
|
+
rescue RestClient::RequestTimeout
|
65
|
+
warning 'Connection timed out'
|
66
|
+
rescue RestClient::ResourceNotFound
|
67
|
+
if notfoundok
|
68
|
+
ok "404 resource not found - #{url}"
|
69
|
+
else
|
70
|
+
warning "404 resource not found - #{url}"
|
71
|
+
end
|
72
|
+
rescue => e
|
73
|
+
warning "RestClient exception: #{e.class} -> #{e.message}"
|
74
|
+
end
|
75
|
+
|
76
|
+
def run
|
77
|
+
base_core_uri = "#{config[:protocol]}://#{config[:host]}:#{config[:port]}/solr/#{config[:core]}"
|
78
|
+
uri = "#{base_core_uri}/replication?command=details&wt=json"
|
79
|
+
data = get_url_json(uri, config[:core_missing_ok])
|
80
|
+
details = data['details']
|
81
|
+
if details['isSlave'] == 'true'
|
82
|
+
slave_details = details['slave']
|
83
|
+
lag = (DateTime.parse(slave_details['currentDate']).to_time - DateTime.parse(slave_details['indexReplicatedAt']).to_time).to_i
|
84
|
+
if lag >= config[:critical]
|
85
|
+
critical "Replication lag exceeds #{config[:critical]} seconds (#{lag})"
|
86
|
+
elsif lag >= config[:warning]
|
87
|
+
warning "Replication lag exceeds #{config[:warning]} seconds (#{lag})"
|
88
|
+
else
|
89
|
+
ok "Replication lag is ok (#{lag})"
|
90
|
+
end
|
91
|
+
else
|
92
|
+
ok 'this is not a slave host'
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-plugins-solr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.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:
|
11
|
+
date: 2018-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sensu-plugin
|
@@ -198,6 +198,7 @@ description: |-
|
|
198
198
|
status, and a variety of metrics including memory consumption, open file counts, and more.
|
199
199
|
email: "<sensu-users@googlegroups.com>"
|
200
200
|
executables:
|
201
|
+
- check-solr-replication-lag.rb
|
201
202
|
- metrics-solr-graphite.rb
|
202
203
|
- metrics-solr-v1.4graphite.rb
|
203
204
|
- metrics-solr4-graphite.rb
|
@@ -207,6 +208,7 @@ files:
|
|
207
208
|
- CHANGELOG.md
|
208
209
|
- LICENSE
|
209
210
|
- README.md
|
211
|
+
- bin/check-solr-replication-lag.rb
|
210
212
|
- bin/metrics-solr-graphite.rb
|
211
213
|
- bin/metrics-solr-v1.4graphite.rb
|
212
214
|
- bin/metrics-solr4-graphite.rb
|
@@ -238,7 +240,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
238
240
|
version: '0'
|
239
241
|
requirements: []
|
240
242
|
rubyforge_project:
|
241
|
-
rubygems_version: 2.
|
243
|
+
rubygems_version: 2.7.7
|
242
244
|
signing_key:
|
243
245
|
specification_version: 4
|
244
246
|
summary: Sensu plugins for solr
|