sensu-plugins-minio 0.0.2 → 0.0.3
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/Gemfile.lock +1 -1
- data/bin/check-minio-update.rb +21 -17
- data/lib/sensu/plugins/minio/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d74061e15df08517fa18fd66022c63eed26d23141f0cc60699e907f949bccd7f
|
4
|
+
data.tar.gz: 161197e9bcc9ed4a0cccc89af3d3ca6b5c9996432e0429d80d6326c1ce9d15a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1995cc2b3453c2d40bd22017dad9af13bc60dbc487cee5093a575fb5cb64a59302f864eedda2fa1d793c3029704cd80e1a98224ffe9e8ef0325052e9f9917e4
|
7
|
+
data.tar.gz: c139954f08cb4fc7fe9c8fc84af54c4ea76c78435ce1c69965290695c17583fc40556d60cbb28810ceeef021a12e1c42562b95d95bc4edbece5aa0d6147e9558
|
data/Gemfile.lock
CHANGED
data/bin/check-minio-update.rb
CHANGED
@@ -45,34 +45,38 @@ class CheckMinioUpdate < Sensu::Plugin::Check::CLI
|
|
45
45
|
|
46
46
|
begin
|
47
47
|
Timeout.timeout(timeout) do
|
48
|
-
|
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
|
49
56
|
end
|
57
|
+
rescue IOError => e
|
58
|
+
unknown "#{e.message}"
|
50
59
|
rescue Timeout::Error
|
51
60
|
unknown 'Connection timed out'
|
52
61
|
end
|
53
62
|
end
|
54
63
|
|
55
|
-
def
|
64
|
+
def get_latest_version(checkurl, platform)
|
56
65
|
uri = URI.parse("#{checkurl}/#{platform}/minio.shasum")
|
57
66
|
response = Net::HTTP.get_response(uri)
|
58
67
|
|
59
|
-
|
60
|
-
|
61
|
-
else
|
62
|
-
unknown "Unable to gather latest minio version: #{response.body}"
|
68
|
+
unless response.is_a?(Net::HTTPSuccess)
|
69
|
+
raise IOError, "Unable to gather latest minio version: #{response.body}"
|
63
70
|
end
|
64
71
|
|
65
|
-
|
66
|
-
|
67
|
-
local_version = stdout_str.split.last
|
68
|
-
else
|
69
|
-
unknown "Unable to gather local minio version: #{error_str}"
|
70
|
-
end
|
72
|
+
return response.body.split.last.split('.', 2).last
|
73
|
+
end
|
71
74
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
75
|
+
def get_local_version
|
76
|
+
stdout, stderr, status = Open3.capture3('minio --version', unsetenv_others: true)
|
77
|
+
|
78
|
+
raise IOError, "Unable to gather local minio version: #{stderr}" unless status.success?
|
79
|
+
|
80
|
+
return stdout.split.last
|
77
81
|
end
|
78
82
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hauke Altmann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sensu-plugin
|