sensu-plugins-solr 1.1.0 → 1.2.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
  SHA256:
3
- metadata.gz: 72d62cfdf77fb555ccf841545ba26e20081dd34f2adfc85ebb9759c1f1a15f73
4
- data.tar.gz: 60a31f9490e3128fc5de498a22ea9a027f5d8099114e363093e37805b7c827cd
3
+ metadata.gz: 1d3cf4785148bdb0512d8dc1dd0550761c83a2ff1ca77c55e0209ee123b2adf6
4
+ data.tar.gz: 95f1d470d18627eb0d4c762b3730a92ded58b229f64d1ffbb9a384ede4bdf506
5
5
  SHA512:
6
- metadata.gz: a3c60bd81d3590ff5ee8ad504cab35c3a0c8687e1fd1084e1a67e47dccdcc98059fb531c4427678df6b3fff6cdee928fa00cd8d581cbd32650e6edcb2b8b2daa
7
- data.tar.gz: 700e078b60ab9ac33a48c96367732f3301f494175377341ab88656b1211995ee8cbc7919f7ab82f64f77f02a0ecbe12c19d163e4925e833529ced684cd80b5a1
6
+ metadata.gz: 15c1206add47b19197ee9bc5625a54390d61827f30083f31d79645baf42b40c3cb9ca6e5ddbbc23b9c3c48a5ae7e46fdbb33c05f82e033f9772146e54908226e
7
+ data.tar.gz: 14db5d51c7f2670187774155fe86429ea127a4ddf59d96607984cb33ce22c5a9ce3cf4cfef5ba9aacfe560388871ad98afeb4555ae768c176563c8da22067da9
data/CHANGELOG.md CHANGED
@@ -5,6 +5,11 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [1.2.0] - 2023-10-16
9
+ ### Changed
10
+ - Added backwards compatible support for solr 9.x in `check-solr-replication-lag` by checking both `(follower|slave)` terms in API response (@danieltoader)
11
+ - Added authentication in `check-solr-replication-lag` (@danieltoader)
12
+
8
13
  ## [1.1.0] - 2018-07-12
9
14
  ### Added
10
15
  - Added solr replication lag check (@alexbumbacea)
@@ -40,7 +45,8 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
40
45
  ### Added
41
46
  - initial release
42
47
 
43
- [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-solr/compare/1.1.0...HEAD
48
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-solr/compare/1.2.0...HEAD
49
+ [1.2.0]: https://github.com/sensu-plugins/sensu-plugins-solr/compare/1.1.0...1.2.0
44
50
  [1.1.0]: https://github.com/sensu-plugins/sensu-plugins-solr/compare/1.0.0...1.1.0
45
51
  [1.0.0]: https://github.com/sensu-plugins/sensu-plugins-solr/compare/0.0.3...1.0.0
46
52
  [0.0.3]: https://github.com/sensu-plugins/sensu-plugins-solr/compare/0.0.2...0.0.3
data/README.md CHANGED
@@ -18,6 +18,6 @@
18
18
 
19
19
  ## Installation
20
20
 
21
- [Installation and Setup](http://sensu-plugins.io/docs/installation_instructions.html)
21
+ [Installation and Setup](https://docs.sensu.io/sensu-core/latest/installation/installing-plugins/)
22
22
 
23
23
  ## Notes
@@ -56,11 +56,29 @@ class SolrCheckReplication < Sensu::Plugin::Check::CLI
56
56
  boolean: true,
57
57
  default: false
58
58
 
59
- def get_url_json(url, notfoundok)
60
- r = RestClient::Resource.new(url, timeout: 45)
59
+ option :username,
60
+ description: 'Username for HTTP Basic Authentication',
61
+ short: '-U USERNAME',
62
+ long: '--username USERNAME',
63
+ required: false
64
+
65
+ option :password,
66
+ description: 'Password for HTTP Basic Authentication',
67
+ short: '-P PASSWORD',
68
+ long: '--password PASSWORD',
69
+ required: false
70
+
71
+ def get_url_json(url, notfoundok, username = nil, password = nil)
72
+ resource_options = { timeout: 45 }
73
+ resource_options[:user] = username if username
74
+ resource_options[:password] = password if password
75
+
76
+ r = RestClient::Resource.new(url, resource_options)
61
77
  JSON.parse(r.get)
62
78
  rescue Errno::ECONNREFUSED
63
79
  warning 'Connection refused'
80
+ rescue RestClient::Unauthorized
81
+ warning 'Unauthorized: Invalid credentials'
64
82
  rescue RestClient::RequestTimeout
65
83
  warning 'Connection timed out'
66
84
  rescue RestClient::ResourceNotFound
@@ -76,11 +94,11 @@ class SolrCheckReplication < Sensu::Plugin::Check::CLI
76
94
  def run
77
95
  base_core_uri = "#{config[:protocol]}://#{config[:host]}:#{config[:port]}/solr/#{config[:core]}"
78
96
  uri = "#{base_core_uri}/replication?command=details&wt=json"
79
- data = get_url_json(uri, config[:core_missing_ok])
97
+ data = get_url_json(uri, config[:core_missing_ok], config[:username], config[:password])
80
98
  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
99
+ if details['isFollower'] == 'true' || details['isSlave'] == 'true'
100
+ follower_details = details['follower'] || details['slave']
101
+ lag = (DateTime.parse(follower_details['currentDate']).to_time - DateTime.parse(follower_details['indexReplicatedAt']).to_time).to_i
84
102
  if lag >= config[:critical]
85
103
  critical "Replication lag exceeds #{config[:critical]} seconds (#{lag})"
86
104
  elsif lag >= config[:warning]
@@ -1,7 +1,7 @@
1
1
  module SensuPluginsSolr
2
2
  module Version
3
3
  MAJOR = 1
4
- MINOR = 1
4
+ MINOR = 2
5
5
  PATCH = 0
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
metadata CHANGED
@@ -1,43 +1,49 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-solr
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
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: 2018-07-12 00:00:00.000000000 Z
11
+ date: 2023-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sensu-plugin
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.2'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '5.0'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
25
28
  - !ruby/object:Gem::Version
26
29
  version: '1.2'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '5.0'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: crack
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
37
  - - '='
32
38
  - !ruby/object:Gem::Version
33
- version: 0.4.2
39
+ version: 0.4.3
34
40
  type: :runtime
35
41
  prerelease: false
36
42
  version_requirements: !ruby/object:Gem::Requirement
37
43
  requirements:
38
44
  - - '='
39
45
  - !ruby/object:Gem::Version
40
- version: 0.4.2
46
+ version: 0.4.3
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: rest-client
43
49
  requirement: !ruby/object:Gem::Requirement
@@ -128,28 +134,28 @@ dependencies:
128
134
  requirements:
129
135
  - - "~>"
130
136
  - !ruby/object:Gem::Version
131
- version: '10.0'
137
+ version: '12.3'
132
138
  type: :development
133
139
  prerelease: false
134
140
  version_requirements: !ruby/object:Gem::Requirement
135
141
  requirements:
136
142
  - - "~>"
137
143
  - !ruby/object:Gem::Version
138
- version: '10.0'
144
+ version: '12.3'
139
145
  - !ruby/object:Gem::Dependency
140
146
  name: github-markup
141
147
  requirement: !ruby/object:Gem::Requirement
142
148
  requirements:
143
149
  - - "~>"
144
150
  - !ruby/object:Gem::Version
145
- version: '1.3'
151
+ version: '3.0'
146
152
  type: :development
147
153
  prerelease: false
148
154
  version_requirements: !ruby/object:Gem::Requirement
149
155
  requirements:
150
156
  - - "~>"
151
157
  - !ruby/object:Gem::Version
152
- version: '1.3'
158
+ version: '3.0'
153
159
  - !ruby/object:Gem::Dependency
154
160
  name: redcarpet
155
161
  requirement: !ruby/object:Gem::Requirement
@@ -199,9 +205,9 @@ description: |-
199
205
  email: "<sensu-users@googlegroups.com>"
200
206
  executables:
201
207
  - check-solr-replication-lag.rb
202
- - metrics-solr-graphite.rb
203
208
  - metrics-solr-v1.4graphite.rb
204
209
  - metrics-solr4-graphite.rb
210
+ - metrics-solr-graphite.rb
205
211
  extensions: []
206
212
  extra_rdoc_files: []
207
213
  files:
@@ -239,8 +245,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
239
245
  - !ruby/object:Gem::Version
240
246
  version: '0'
241
247
  requirements: []
242
- rubyforge_project:
243
- rubygems_version: 2.7.7
248
+ rubygems_version: 3.1.2
244
249
  signing_key:
245
250
  specification_version: 4
246
251
  summary: Sensu plugins for solr