sensu-plugins-minio 0.0.5 → 1.0.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 +4 -4
- data/.github/workflows/main.yml +30 -0
- data/.rubocop.yml +28 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +30 -32
- data/README.md +8 -1
- data/bin/check-minio-update.rb +41 -28
- data/lib/sensu/plugins/minio/version.rb +1 -1
- data/sensu-plugins-minio.gemspec +7 -4
- metadata +17 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 144a116c5c586f1fa6d951dc893d8f184ee70cfc4c90ef2fbd0ada0e04d7e8dd
|
4
|
+
data.tar.gz: 98fa400a4401388b7db16f015ab3e81bed2babb41459b5c0f7a7a13731100e6e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03e42dd27a201ba2c70b6086103c9515e08352625cc3785e83a51d0a01b1d1f374fde5eda47f81af3eaaacdd754425b1294e24fbf5a7b62fa72fcc3f1ee0e6f5
|
7
|
+
data.tar.gz: f274315e2f90356e0491dd8896c8c63e6d6b24e2fb8fa53f8f4c308087a5c5c18bdaf0f0f2cca833371f88202828c8a3f29c06736b3fbf2fa66a7ba3c66feb80
|
@@ -0,0 +1,30 @@
|
|
1
|
+
name: main
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ "master" ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ "master" ]
|
8
|
+
|
9
|
+
permissions:
|
10
|
+
contents: read
|
11
|
+
|
12
|
+
jobs:
|
13
|
+
test:
|
14
|
+
|
15
|
+
runs-on: ubuntu-latest
|
16
|
+
strategy:
|
17
|
+
matrix:
|
18
|
+
ruby-version: ['2.3.3', '2.5.1', '2.7.0']
|
19
|
+
|
20
|
+
steps:
|
21
|
+
- uses: actions/checkout@v3
|
22
|
+
- name: Set up Ruby
|
23
|
+
uses: ruby/setup-ruby@v1
|
24
|
+
with:
|
25
|
+
ruby-version: ${{ matrix.ruby-version }}
|
26
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
27
|
+
- name: Lint
|
28
|
+
run: bundle exec rubocop
|
29
|
+
- name: Run specs
|
30
|
+
run: bundle exec rspec
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
AllCops:
|
2
|
+
TargetRubyVersion: 2.3
|
3
|
+
|
4
|
+
Lint/RaiseException:
|
5
|
+
Enabled: true
|
6
|
+
|
7
|
+
Lint/StructNewOverride:
|
8
|
+
Enabled: true
|
9
|
+
|
10
|
+
|
11
|
+
Metrics:
|
12
|
+
Enabled: false
|
13
|
+
|
14
|
+
|
15
|
+
Style/FrozenStringLiteralComment:
|
16
|
+
Enabled: false
|
17
|
+
|
18
|
+
Style/Documentation:
|
19
|
+
Enabled: false
|
20
|
+
|
21
|
+
Style/HashEachMethods:
|
22
|
+
Enabled: true
|
23
|
+
|
24
|
+
Style/HashTransformKeys:
|
25
|
+
Enabled: true
|
26
|
+
|
27
|
+
Style/HashTransformValues:
|
28
|
+
Enabled: true
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
sensu-plugins-minio (0.0
|
4
|
+
sensu-plugins-minio (1.0.0)
|
5
5
|
sensu-plugin (~> 2.1)
|
6
6
|
|
7
7
|
GEM
|
@@ -12,62 +12,60 @@ GEM
|
|
12
12
|
ast (2.4.2)
|
13
13
|
crack (0.4.5)
|
14
14
|
rexml
|
15
|
-
diff-lcs (1.
|
15
|
+
diff-lcs (1.5.0)
|
16
16
|
hashdiff (1.0.1)
|
17
|
-
|
17
|
+
jaro_winkler (1.5.4)
|
18
|
+
json (2.6.2)
|
18
19
|
mixlib-cli (1.7.0)
|
19
|
-
parallel (1.
|
20
|
-
parser (3.
|
20
|
+
parallel (1.19.2)
|
21
|
+
parser (3.1.2.0)
|
21
22
|
ast (~> 2.4.1)
|
22
|
-
public_suffix (4.0.
|
23
|
-
rainbow (3.
|
23
|
+
public_suffix (4.0.7)
|
24
|
+
rainbow (3.1.1)
|
24
25
|
rake (13.0.6)
|
25
|
-
regexp_parser (2.1.1)
|
26
26
|
rexml (3.2.5)
|
27
|
-
rspec (3.
|
28
|
-
rspec-core (~> 3.
|
29
|
-
rspec-expectations (~> 3.
|
30
|
-
rspec-mocks (~> 3.
|
31
|
-
rspec-core (3.
|
32
|
-
rspec-support (~> 3.
|
33
|
-
rspec-expectations (3.
|
27
|
+
rspec (3.11.0)
|
28
|
+
rspec-core (~> 3.11.0)
|
29
|
+
rspec-expectations (~> 3.11.0)
|
30
|
+
rspec-mocks (~> 3.11.0)
|
31
|
+
rspec-core (3.11.0)
|
32
|
+
rspec-support (~> 3.11.0)
|
33
|
+
rspec-expectations (3.11.0)
|
34
34
|
diff-lcs (>= 1.2.0, < 2.0)
|
35
|
-
rspec-support (~> 3.
|
36
|
-
rspec-mocks (3.
|
35
|
+
rspec-support (~> 3.11.0)
|
36
|
+
rspec-mocks (3.11.1)
|
37
37
|
diff-lcs (>= 1.2.0, < 2.0)
|
38
|
-
rspec-support (~> 3.
|
39
|
-
rspec-support (3.
|
40
|
-
rubocop (0.
|
38
|
+
rspec-support (~> 3.11.0)
|
39
|
+
rspec-support (3.11.0)
|
40
|
+
rubocop (0.81.0)
|
41
|
+
jaro_winkler (~> 1.5.1)
|
41
42
|
parallel (~> 1.10)
|
42
|
-
parser (>= 2.7.1
|
43
|
+
parser (>= 2.7.0.1)
|
43
44
|
rainbow (>= 2.2.2, < 4.0)
|
44
|
-
regexp_parser (>= 1.8)
|
45
45
|
rexml
|
46
|
-
rubocop-ast (>= 0.6.0)
|
47
46
|
ruby-progressbar (~> 1.7)
|
48
47
|
unicode-display_width (>= 1.4.0, < 2.0)
|
49
|
-
rubocop-ast (1.8.0)
|
50
|
-
parser (>= 3.0.1.1)
|
51
48
|
ruby-progressbar (1.11.0)
|
52
49
|
sensu-plugin (2.7.1)
|
53
50
|
json (< 3.0.0)
|
54
51
|
mixlib-cli (~> 1.5)
|
55
|
-
unicode-display_width (1.
|
56
|
-
webmock (3.
|
57
|
-
addressable (>= 2.
|
52
|
+
unicode-display_width (1.8.0)
|
53
|
+
webmock (3.14.0)
|
54
|
+
addressable (>= 2.8.0)
|
58
55
|
crack (>= 0.3.2)
|
59
56
|
hashdiff (>= 0.4.0, < 2.0.0)
|
60
57
|
|
61
58
|
PLATFORMS
|
62
|
-
|
59
|
+
ruby
|
63
60
|
|
64
61
|
DEPENDENCIES
|
65
|
-
bundler (~> 2.
|
62
|
+
bundler (~> 2.1)
|
63
|
+
parallel (< 1.20.0)
|
66
64
|
rake (~> 13.0)
|
67
65
|
rspec (~> 3.10)
|
68
|
-
rubocop (~> 0.54)
|
66
|
+
rubocop (~> 0.54, <= 0.81)
|
69
67
|
sensu-plugins-minio!
|
70
68
|
webmock (~> 3.3)
|
71
69
|
|
72
70
|
BUNDLED WITH
|
73
|
-
2.
|
71
|
+
2.1.4
|
data/README.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# Sensu check for minio updates
|
2
2
|
|
3
|
+
Translates the presence of an outdated minio server instance into sensu check
|
4
|
+
results to reduce the time-to-patch for minio systems.
|
5
|
+
|
3
6
|
## Installation
|
4
7
|
|
5
8
|
Add this line to your application's Gemfile:
|
@@ -24,7 +27,7 @@ Check if a the local minio version is in the most recent version
|
|
24
27
|
Checks will check the default URL https://dl.min.io/server/minio/release
|
25
28
|
and the default Platform linux-amd64 for updates. Adjust these optional
|
26
29
|
parameters if you want to check a different platform or for whatever
|
27
|
-
reason need to check a
|
30
|
+
reason need to check a different URL.
|
28
31
|
|
29
32
|
| Parameter | Description |
|
30
33
|
| ------------------ | ----------------------------------------------- |
|
@@ -57,3 +60,7 @@ Plugin follows the [rubocop ruby style guide](https://github.com/rubocop-hq/ruby
|
|
57
60
|
|
58
61
|
Bug reports and pull requests are welcome on GitHub at
|
59
62
|
https://github.com/aboutsource/sensu-plugins-minio.
|
63
|
+
|
64
|
+
## Security
|
65
|
+
|
66
|
+
* [Snyk](https://app.snyk.io/org/about-source/project/0a24cb05-4369-457c-8cca-7e4c395eb25e)
|
data/bin/check-minio-update.rb
CHANGED
@@ -21,6 +21,8 @@ require 'open3'
|
|
21
21
|
class CheckMinioUpdate < Sensu::Plugin::Check::CLI
|
22
22
|
include Sensu::Plugin::Utils
|
23
23
|
|
24
|
+
RELEASE_PATTERN = /(?<release>RELEASE.\d{4}-\d{2}-\d{2}T\d{2}-\d{2}-\d{2}Z)/.freeze # rubocop:disable Layout/LineLength
|
25
|
+
|
24
26
|
option :checkurl,
|
25
27
|
description: 'Base URL to check for updates',
|
26
28
|
short: '-u URL',
|
@@ -39,44 +41,55 @@ class CheckMinioUpdate < Sensu::Plugin::Check::CLI
|
|
39
41
|
default: 30
|
40
42
|
|
41
43
|
def run
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
Timeout.timeout(timeout) do
|
48
|
-
latest_version = get_latest_version(checkurl, platform)
|
49
|
-
local_version = get_local_version
|
50
|
-
|
51
|
-
if local_version == latest_version
|
52
|
-
ok 'No new minio version available'
|
53
|
-
else
|
54
|
-
critical "New minio version available #{latest_version}"
|
55
|
-
end
|
44
|
+
Timeout.timeout(config[:timeout].to_i) do
|
45
|
+
if local_version == latest_version
|
46
|
+
ok 'No new minio version available'
|
47
|
+
else
|
48
|
+
critical "New minio version available #{latest_version}"
|
56
49
|
end
|
57
|
-
rescue IOError => e
|
58
|
-
unknown "#{e.message}"
|
59
|
-
rescue Timeout::Error
|
60
|
-
unknown 'Connection timed out'
|
61
50
|
end
|
51
|
+
rescue IOError => e
|
52
|
+
unknown e.message.to_s
|
53
|
+
rescue Timeout::Error
|
54
|
+
unknown 'Connection timed out'
|
62
55
|
end
|
63
56
|
|
64
|
-
|
65
|
-
|
66
|
-
|
57
|
+
private
|
58
|
+
|
59
|
+
def latest_version
|
60
|
+
@latest_version ||= begin
|
61
|
+
uri = URI.parse("#{config[:checkurl]}/#{config[:platform]}/minio.shasum")
|
62
|
+
response = Net::HTTP.get_response(uri)
|
67
63
|
|
68
|
-
|
69
|
-
|
64
|
+
unless response.is_a?(Net::HTTPSuccess)
|
65
|
+
raise IOError, "Unable to gather latest minio version: #{response.body}"
|
66
|
+
end
|
67
|
+
|
68
|
+
extract_release(response.body)
|
70
69
|
end
|
70
|
+
end
|
71
71
|
|
72
|
-
|
72
|
+
def local_version
|
73
|
+
@local_version ||= begin
|
74
|
+
stdout, stderr, status = Open3.capture3(
|
75
|
+
{ 'PATH' => ENV['PATH'] }, 'minio --version', unsetenv_others: true
|
76
|
+
)
|
77
|
+
|
78
|
+
unless status.success?
|
79
|
+
raise IOError, "Unable to gather local minio version: #{stderr}"
|
80
|
+
end
|
81
|
+
|
82
|
+
extract_release(stdout)
|
83
|
+
end
|
73
84
|
end
|
74
85
|
|
75
|
-
def
|
76
|
-
|
86
|
+
def extract_release(release_source_str)
|
87
|
+
match_data = RELEASE_PATTERN.match(release_source_str)
|
77
88
|
|
78
|
-
|
89
|
+
if match_data.nil?
|
90
|
+
raise IOError, "Unable to extract release: #{release_source_str}"
|
91
|
+
end
|
79
92
|
|
80
|
-
|
93
|
+
match_data[:release]
|
81
94
|
end
|
82
95
|
end
|
data/sensu-plugins-minio.gemspec
CHANGED
@@ -11,20 +11,23 @@ Gem::Specification.new do |spec|
|
|
11
11
|
spec.authors = ['Hauke Altmann', 'Jonathan Schlue']
|
12
12
|
spec.email = ['info@aboutsource.net']
|
13
13
|
|
14
|
-
spec.summary = 'Check if there are updates for the local
|
14
|
+
spec.summary = 'Check if there are updates for the local '\
|
15
|
+
'minio server instance'
|
15
16
|
spec.description = 'Used to check for manual installed minio servers'
|
16
17
|
spec.homepage = 'https://github.com/aboutsource/sensu-plugins-minio'
|
17
18
|
spec.require_paths = ['lib']
|
18
19
|
|
19
|
-
spec.
|
20
|
+
spec.required_ruby_version = '>= 2.3.3'
|
21
|
+
|
22
|
+
spec.executables = Dir.glob('bin/**/*.rb').map { |f| File.basename(f) }
|
20
23
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
21
24
|
f.match(%r{^(test|spec|features)/})
|
22
25
|
end
|
23
26
|
|
24
27
|
spec.add_dependency 'sensu-plugin', '~> 2.1'
|
25
|
-
spec.add_development_dependency 'bundler', '~> 2.
|
28
|
+
spec.add_development_dependency 'bundler', '~> 2.1'
|
26
29
|
spec.add_development_dependency 'rake', '~> 13.0'
|
27
30
|
spec.add_development_dependency 'rspec', '~> 3.10'
|
28
|
-
spec.add_development_dependency 'rubocop', '~> 0.54'
|
31
|
+
spec.add_development_dependency 'rubocop', '~> 0.54', '<= 0.81'
|
29
32
|
spec.add_development_dependency 'webmock', '~> 3.3'
|
30
33
|
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-plugins-minio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hauke Altmann
|
8
8
|
- Jonathan Schlue
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2022-07-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sensu-plugin
|
@@ -31,14 +31,14 @@ dependencies:
|
|
31
31
|
requirements:
|
32
32
|
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: '2.
|
34
|
+
version: '2.1'
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: '2.
|
41
|
+
version: '2.1'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: rake
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -74,6 +74,9 @@ dependencies:
|
|
74
74
|
- - "~>"
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: '0.54'
|
77
|
+
- - "<="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0.81'
|
77
80
|
type: :development
|
78
81
|
prerelease: false
|
79
82
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -81,6 +84,9 @@ dependencies:
|
|
81
84
|
- - "~>"
|
82
85
|
- !ruby/object:Gem::Version
|
83
86
|
version: '0.54'
|
87
|
+
- - "<="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0.81'
|
84
90
|
- !ruby/object:Gem::Dependency
|
85
91
|
name: webmock
|
86
92
|
requirement: !ruby/object:Gem::Requirement
|
@@ -103,7 +109,9 @@ executables:
|
|
103
109
|
extensions: []
|
104
110
|
extra_rdoc_files: []
|
105
111
|
files:
|
112
|
+
- ".github/workflows/main.yml"
|
106
113
|
- ".gitignore"
|
114
|
+
- ".rubocop.yml"
|
107
115
|
- ".ruby-version"
|
108
116
|
- Gemfile
|
109
117
|
- Gemfile.lock
|
@@ -119,7 +127,7 @@ homepage: https://github.com/aboutsource/sensu-plugins-minio
|
|
119
127
|
licenses:
|
120
128
|
- MIT
|
121
129
|
metadata: {}
|
122
|
-
post_install_message:
|
130
|
+
post_install_message:
|
123
131
|
rdoc_options: []
|
124
132
|
require_paths:
|
125
133
|
- lib
|
@@ -127,15 +135,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
127
135
|
requirements:
|
128
136
|
- - ">="
|
129
137
|
- !ruby/object:Gem::Version
|
130
|
-
version:
|
138
|
+
version: 2.3.3
|
131
139
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
132
140
|
requirements:
|
133
141
|
- - ">="
|
134
142
|
- !ruby/object:Gem::Version
|
135
143
|
version: '0'
|
136
144
|
requirements: []
|
137
|
-
rubygems_version: 3.
|
138
|
-
signing_key:
|
145
|
+
rubygems_version: 3.3.15
|
146
|
+
signing_key:
|
139
147
|
specification_version: 4
|
140
148
|
summary: Check if there are updates for the local minio server instance
|
141
149
|
test_files: []
|