sensu-plugins-minio 0.0.7 → 1.1.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 +27 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +4 -3
- data/README.md +17 -4
- data/bin/check-minio-update.rb +38 -30
- data/bin/setup +2 -1
- data/lib/sensu/plugins/minio/version.rb +1 -1
- data/lib/sensu/plugins/minio.rb +3 -0
- data/sensu-plugins-minio.gemspec +1 -1
- metadata +8 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e594af8003c16f54561385ea639b00cc9c8c4f8724a12bc923a0ea9b08616c9a
|
4
|
+
data.tar.gz: 8299f875412630ca49f3b6f48e7f9fb14956bd56a6f4ca882f28b15b5bdccf38
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad37b9db0265f265fb2a5edf11a2d207c2a27841d0f9d105cfcd73e2f0296f3f5e71d5015765a5107518cdbbe17b4dc63b705ce7d83c7488a56e3a17275fb7fe
|
7
|
+
data.tar.gz: 9c7a29f102d54b12109b4a09696e79a3972eef8a39b90871247dc33c636066a1163b9ac1ef327eb55b8533ca0e0eabdda129b5b54a2ad65605021471f4571f4e
|
@@ -0,0 +1,27 @@
|
|
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
|
+
|
17
|
+
steps:
|
18
|
+
- uses: actions/checkout@v3
|
19
|
+
- name: Set up Ruby
|
20
|
+
uses: ruby/setup-ruby@v1
|
21
|
+
with:
|
22
|
+
ruby-version: '2.7.0'
|
23
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
24
|
+
- name: Lint
|
25
|
+
run: bundle exec rubocop
|
26
|
+
- name: Run specs
|
27
|
+
run: bundle exec rspec
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
sensu-plugins-minio (
|
4
|
+
sensu-plugins-minio (1.1.0)
|
5
5
|
sensu-plugin (~> 2.1)
|
6
6
|
|
7
7
|
GEM
|
@@ -15,9 +15,9 @@ GEM
|
|
15
15
|
diff-lcs (1.5.0)
|
16
16
|
hashdiff (1.0.1)
|
17
17
|
jaro_winkler (1.5.4)
|
18
|
-
json (2.
|
18
|
+
json (2.7.1)
|
19
19
|
mixlib-cli (1.7.0)
|
20
|
-
parallel (1.
|
20
|
+
parallel (1.19.2)
|
21
21
|
parser (3.1.2.0)
|
22
22
|
ast (~> 2.4.1)
|
23
23
|
public_suffix (4.0.7)
|
@@ -60,6 +60,7 @@ PLATFORMS
|
|
60
60
|
|
61
61
|
DEPENDENCIES
|
62
62
|
bundler (~> 2.1)
|
63
|
+
parallel (< 1.20.0)
|
63
64
|
rake (~> 13.0)
|
64
65
|
rspec (~> 3.10)
|
65
66
|
rubocop (~> 0.54, <= 0.81)
|
data/README.md
CHANGED
@@ -24,9 +24,9 @@ Check if a the local minio version is in the most recent version
|
|
24
24
|
|
25
25
|
### Optional parameters
|
26
26
|
|
27
|
-
Checks will check the default URL https://dl.min.io/server/minio/release
|
28
|
-
and the default Platform linux-amd64 for updates. Adjust these optional
|
29
|
-
parameters if you want to check a different platform or for whatever
|
27
|
+
Checks will check the default URL https://dl.min.io/server/minio/release
|
28
|
+
and the default Platform linux-amd64 for updates. Adjust these optional
|
29
|
+
parameters if you want to check a different platform or for whatever
|
30
30
|
reason need to check a different URL.
|
31
31
|
|
32
32
|
| Parameter | Description |
|
@@ -42,7 +42,20 @@ reason need to check a different URL.
|
|
42
42
|
|
43
43
|
## Development
|
44
44
|
|
45
|
-
|
45
|
+
Install rbenv and ruby-build to get a ruby 2.7.x on your system (running on ubuntu 20.04).
|
46
|
+
|
47
|
+
yay -S rbenv ruby-build
|
48
|
+
|
49
|
+
Add the rbenv shell extension (`eval "$(rbenv init -)"`) to your shell config (e.g. `~/.zshrc`) and install ruby 2.7.0
|
50
|
+
|
51
|
+
rbenv install 2.7.0
|
52
|
+
|
53
|
+
After checking out the repo verify, that your system is using the 2.7.0 ruby:
|
54
|
+
|
55
|
+
# rbenv version
|
56
|
+
2.7.0 (set by ..../sensu-plugins-minio/.ruby-version)
|
57
|
+
|
58
|
+
Run `bin/setup` to install dependencies. You can
|
46
59
|
also run `bin/console` for an interactive prompt that will allow you to
|
47
60
|
experiment.
|
48
61
|
|
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,49 +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
|
-
|
50
|
-
if local_version == latest_version
|
51
|
-
ok 'No new minio version available'
|
52
|
-
else
|
53
|
-
critical "New minio version available #{latest_version}"
|
54
|
-
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}"
|
55
49
|
end
|
56
|
-
rescue IOError => e
|
57
|
-
unknown e.message.to_s
|
58
|
-
rescue Timeout::Error
|
59
|
-
unknown 'Connection timed out'
|
60
50
|
end
|
51
|
+
rescue IOError => e
|
52
|
+
unknown e.message.to_s
|
53
|
+
rescue Timeout::Error
|
54
|
+
unknown 'Connection timed out'
|
61
55
|
end
|
62
56
|
|
63
57
|
private
|
64
58
|
|
65
|
-
def
|
66
|
-
|
67
|
-
|
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)
|
68
63
|
|
69
|
-
|
70
|
-
|
71
|
-
|
64
|
+
unless response.is_a?(Net::HTTPSuccess)
|
65
|
+
raise IOError, "Unable to gather latest minio version: #{response.body}"
|
66
|
+
end
|
72
67
|
|
73
|
-
|
68
|
+
extract_release(response.body)
|
69
|
+
end
|
74
70
|
end
|
75
71
|
|
76
72
|
def local_version
|
77
|
-
|
78
|
-
|
79
|
-
|
73
|
+
@local_version ||= begin
|
74
|
+
stdout, stderr, status = Open3.capture3(
|
75
|
+
{ 'PATH' => ENV['PATH'] }, 'journalctl --boot --unit minio | grep "Version: RELEASE" | tail -n 1', unsetenv_others: true # rubocop:disable Layout/LineLength
|
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
|
84
|
+
end
|
85
|
+
|
86
|
+
def extract_release(release_source_str)
|
87
|
+
match_data = RELEASE_PATTERN.match(release_source_str)
|
80
88
|
|
81
|
-
|
82
|
-
raise IOError, "Unable to
|
89
|
+
if match_data.nil?
|
90
|
+
raise IOError, "Unable to extract release: #{release_source_str}"
|
83
91
|
end
|
84
92
|
|
85
|
-
|
93
|
+
match_data[:release]
|
86
94
|
end
|
87
95
|
end
|
data/bin/setup
CHANGED
data/sensu-plugins-minio.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.name = 'sensu-plugins-minio'
|
9
9
|
spec.version = Sensu::Plugins::Minio::VERSION
|
10
10
|
spec.licenses = ['MIT']
|
11
|
-
spec.authors = ['Hauke Altmann', 'Jonathan Schlue']
|
11
|
+
spec.authors = ['Hauke Altmann', 'Jonathan Schlue', 'Benjamin Meichsner']
|
12
12
|
spec.email = ['info@aboutsource.net']
|
13
13
|
|
14
14
|
spec.summary = 'Check if there are updates for the local '\
|
metadata
CHANGED
@@ -1,15 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-plugins-minio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hauke Altmann
|
8
8
|
- Jonathan Schlue
|
9
|
-
|
9
|
+
- Benjamin Meichsner
|
10
|
+
autorequire:
|
10
11
|
bindir: bin
|
11
12
|
cert_chain: []
|
12
|
-
date:
|
13
|
+
date: 2024-03-26 00:00:00.000000000 Z
|
13
14
|
dependencies:
|
14
15
|
- !ruby/object:Gem::Dependency
|
15
16
|
name: sensu-plugin
|
@@ -109,6 +110,7 @@ executables:
|
|
109
110
|
extensions: []
|
110
111
|
extra_rdoc_files: []
|
111
112
|
files:
|
113
|
+
- ".github/workflows/main.yml"
|
112
114
|
- ".gitignore"
|
113
115
|
- ".rubocop.yml"
|
114
116
|
- ".ruby-version"
|
@@ -120,13 +122,14 @@ files:
|
|
120
122
|
- bin/check-minio-update.rb
|
121
123
|
- bin/console
|
122
124
|
- bin/setup
|
125
|
+
- lib/sensu/plugins/minio.rb
|
123
126
|
- lib/sensu/plugins/minio/version.rb
|
124
127
|
- sensu-plugins-minio.gemspec
|
125
128
|
homepage: https://github.com/aboutsource/sensu-plugins-minio
|
126
129
|
licenses:
|
127
130
|
- MIT
|
128
131
|
metadata: {}
|
129
|
-
post_install_message:
|
132
|
+
post_install_message:
|
130
133
|
rdoc_options: []
|
131
134
|
require_paths:
|
132
135
|
- lib
|
@@ -142,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
142
145
|
version: '0'
|
143
146
|
requirements: []
|
144
147
|
rubygems_version: 3.1.2
|
145
|
-
signing_key:
|
148
|
+
signing_key:
|
146
149
|
specification_version: 4
|
147
150
|
summary: Check if there are updates for the local minio server instance
|
148
151
|
test_files: []
|