sensu-plugins-minio 0.0.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 35f60a0e03d4cd45c327c445ca34cb00da52ac632dbffcb3d2d9d7654b460544
4
+ data.tar.gz: f0b97784a6b4cbf5abf12413f5ee853b85ec804a013ff8aeb744cb86337b1c73
5
+ SHA512:
6
+ metadata.gz: 69d90a95f4530b3fe770f2102f97e74a58442a866cd4a3b606b305ec86fb584a54aa396e4321a1b0b0e7559f48d192cbafd9490348a140569eaf2425f6eb7672
7
+ data.tar.gz: 7f357373eefa2b99d5e6d3635f7c3dd44201b75c6042b1678b1e7c9d149d1a46ca56d84e61c139063215002108aa120a200dfea98584344abaebb0edc681270b
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ /vendor/
10
+ /*.gem
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in sensu-plugin-minio.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,69 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ sensu-plugins-minio (0.0.1)
5
+ sensu-plugin (~> 2.1)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ addressable (2.7.0)
11
+ public_suffix (>= 2.0.2, < 5.0)
12
+ ast (2.4.0)
13
+ crack (0.4.3)
14
+ safe_yaml (~> 1.0.0)
15
+ diff-lcs (1.3)
16
+ hashdiff (1.0.0)
17
+ jaro_winkler (1.5.3)
18
+ json (2.2.0)
19
+ mixlib-cli (1.7.0)
20
+ parallel (1.17.0)
21
+ parser (2.6.4.0)
22
+ ast (~> 2.4.0)
23
+ public_suffix (4.0.1)
24
+ rainbow (3.0.0)
25
+ rake (10.5.0)
26
+ rspec (3.8.0)
27
+ rspec-core (~> 3.8.0)
28
+ rspec-expectations (~> 3.8.0)
29
+ rspec-mocks (~> 3.8.0)
30
+ rspec-core (3.8.2)
31
+ rspec-support (~> 3.8.0)
32
+ rspec-expectations (3.8.4)
33
+ diff-lcs (>= 1.2.0, < 2.0)
34
+ rspec-support (~> 3.8.0)
35
+ rspec-mocks (3.8.1)
36
+ diff-lcs (>= 1.2.0, < 2.0)
37
+ rspec-support (~> 3.8.0)
38
+ rspec-support (3.8.2)
39
+ rubocop (0.74.0)
40
+ jaro_winkler (~> 1.5.1)
41
+ parallel (~> 1.10)
42
+ parser (>= 2.6)
43
+ rainbow (>= 2.2.2, < 4.0)
44
+ ruby-progressbar (~> 1.7)
45
+ unicode-display_width (>= 1.4.0, < 1.7)
46
+ ruby-progressbar (1.10.1)
47
+ safe_yaml (1.0.5)
48
+ sensu-plugin (2.7.1)
49
+ json (< 3.0.0)
50
+ mixlib-cli (~> 1.5)
51
+ unicode-display_width (1.6.0)
52
+ webmock (3.7.2)
53
+ addressable (>= 2.3.6)
54
+ crack (>= 0.3.2)
55
+ hashdiff (>= 0.4.0, < 2.0.0)
56
+
57
+ PLATFORMS
58
+ ruby
59
+
60
+ DEPENDENCIES
61
+ bundler (~> 1.11)
62
+ rake (~> 10.0)
63
+ rspec (~> 3.7)
64
+ rubocop (~> 0.54)
65
+ sensu-plugins-minio!
66
+ webmock (~> 3.3)
67
+
68
+ BUNDLED WITH
69
+ 1.16.1
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 about source GmbH
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,59 @@
1
+ # Sensu check for minio updates
2
+
3
+ ## Installation
4
+
5
+ Add this line to your application's Gemfile:
6
+
7
+ ```ruby
8
+ gem 'sensu-plugins-minio'
9
+ ```
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install sensu-plugins-minio
18
+
19
+ ## USAGE
20
+ Check if a the local minio version is in the most recent version
21
+
22
+ ### Optional parameters
23
+
24
+ Checks will check the default URL https://dl.min.io/server/minio/release
25
+ and the default Platform linux-amd64 for updates. Adjust these optional
26
+ parameters if you want to check a different platform or for whatever
27
+ reason need to check a differen URL.
28
+
29
+ | Parameter | Description |
30
+ | ------------------ | ----------------------------------------------- |
31
+ | -u URL | Url of minio site containing update information |
32
+ | -p PLATFORM | OS Platform to check for |
33
+ | --timeout TIMEOUT | Update website request timeout in seconds |
34
+
35
+ ### Example:
36
+ ```
37
+ ./bin/check-minio-update.rb
38
+ ```
39
+
40
+ ## Development
41
+
42
+ After checking out the repo, run `bin/setup` to install dependencies. You can
43
+ also run `bin/console` for an interactive prompt that will allow you to
44
+ experiment.
45
+
46
+ To run the tests execute `bundle exec rspec spec`.
47
+
48
+ To install this gem onto your local machine, run `bundle exec rake install`. To
49
+ release a new version, update the version number in `version.rb`, and then run
50
+ `bundle exec rake release`, which will create a git tag for the version, push
51
+ git commits and tags, and push the `.gem` file to
52
+ [rubygems.org](https://rubygems.org).
53
+
54
+ Plugin follows the [rubocop ruby style guide](https://github.com/rubocop-hq/ruby-style-guide)
55
+
56
+ ## Contributing
57
+
58
+ Bug reports and pull requests are welcome on GitHub at
59
+ https://github.com/aboutsource/sensu-plugins-minio.
data/Rakefile ADDED
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+ require 'rubocop/rake_task'
6
+
7
+ RSpec::Core::RakeTask.new(:spec) do |r|
8
+ r.pattern = FileList['spec/**/*_spec.rb']
9
+ end
10
+
11
+ RuboCop::RakeTask.new
12
+
13
+ task default: %i[rubocop spec]
@@ -0,0 +1,78 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # Check for minio updates
6
+ #
7
+ #
8
+ # OUTPUT:
9
+ # plain text
10
+ #
11
+ #
12
+ # USAGE:
13
+ # Check if minio updates are available for the local minio instance
14
+ # ./check-minio-update.rb
15
+
16
+ require 'sensu-plugin/check/cli'
17
+ require 'sensu-plugin/utils'
18
+ require 'net/http'
19
+ require 'open3'
20
+
21
+ class CheckMinioUpdate < Sensu::Plugin::Check::CLI
22
+ include Sensu::Plugin::Utils
23
+
24
+ option :checkurl,
25
+ description: 'Base URL to check for updates',
26
+ short: '-u URL',
27
+ long: '--url URL',
28
+ default: 'https://dl.min.io/server/minio/release'
29
+
30
+ option :platform,
31
+ description: 'os platform',
32
+ short: '-p PLATFORM',
33
+ long: '--platform PLATFORM',
34
+ default: 'linux-amd64'
35
+
36
+ option :timeout,
37
+ description: 'Request timeout in seconds',
38
+ long: '--timeout TIMEOUT',
39
+ default: 30
40
+
41
+ def run
42
+ checkurl = config[:checkurl]
43
+ platform = config[:platform]
44
+ timeout = config[:timeout].to_i
45
+
46
+ begin
47
+ Timeout.timeout(timeout) do
48
+ check_update(checkurl, platform)
49
+ end
50
+ rescue Timeout::Error
51
+ unknown 'Connection timed out'
52
+ end
53
+ end
54
+
55
+ def check_update(checkurl, platform)
56
+ uri = URI.parse("#{checkurl}/#{platform}/minio.shasum")
57
+ response = Net::HTTP.get_response(uri)
58
+
59
+ if response.is_a?(Net::HTTPSuccess)
60
+ latest_version = response.body.split.last.split('.', 2).last
61
+ else
62
+ unknown "Unable to gather latest minio version: #{response.body}"
63
+ end
64
+
65
+ stdout_str, error_str, status = Open3.capture3('minio version')
66
+ if status.success?
67
+ local_version = stdout_str.lines.at(1).split.last
68
+ else
69
+ unknown "Unable to gather local minio version: #{error_str}"
70
+ end
71
+
72
+ if latest_version == local_version
73
+ ok 'No new minio version available'
74
+ else
75
+ critical "New minio version available #{latest_version}"
76
+ end
77
+ end
78
+ end
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'sensu/plugins/minio'
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require 'pry'
12
+ # Pry.start
13
+
14
+ require 'irb'
15
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install --path vendor/bundle
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Sensu
4
+ module Plugins
5
+ module Minio
6
+ VERSION = '0.0.1'
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require_relative 'lib/sensu/plugins/minio/version'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = 'sensu-plugins-minio'
9
+ spec.version = Sensu::Plugins::Minio::VERSION
10
+ spec.licenses = ['MIT']
11
+ spec.authors = ['Hauke Altmann']
12
+ spec.email = ['info@aboutsource.net']
13
+
14
+ spec.summary = 'Check if there are updates for the local minio server instance'
15
+ spec.description = 'Used to check for manual installed minio servers'
16
+ spec.homepage = 'https://github.com/aboutsource/sensu-plugins-minio'
17
+ spec.require_paths = ['lib']
18
+
19
+ spec.executables = Dir.glob('bin/**/*.rb').map { |file| File.basename(file) }
20
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
21
+ f.match(%r{^(test|spec|features)/})
22
+ end
23
+
24
+ spec.add_dependency 'sensu-plugin', '~> 2.1'
25
+ spec.add_development_dependency 'bundler', '~> 1.11'
26
+ spec.add_development_dependency 'rake', '~> 10.0'
27
+ spec.add_development_dependency 'rspec', '~> 3.7'
28
+ spec.add_development_dependency 'rubocop', '~> 0.54'
29
+ spec.add_development_dependency 'webmock', '~> 3.3'
30
+ end
metadata ADDED
@@ -0,0 +1,140 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sensu-plugins-minio
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Hauke Altmann
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-10-14 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: sensu-plugin
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.11'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.11'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.7'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.7'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '0.54'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '0.54'
83
+ - !ruby/object:Gem::Dependency
84
+ name: webmock
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '3.3'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '3.3'
97
+ description: Used to check for manual installed minio servers
98
+ email:
99
+ - info@aboutsource.net
100
+ executables:
101
+ - check-minio-update.rb
102
+ extensions: []
103
+ extra_rdoc_files: []
104
+ files:
105
+ - ".gitignore"
106
+ - Gemfile
107
+ - Gemfile.lock
108
+ - LICENSE
109
+ - README.md
110
+ - Rakefile
111
+ - bin/check-minio-update.rb
112
+ - bin/console
113
+ - bin/setup
114
+ - lib/sensu/plugins/minio/version.rb
115
+ - sensu-plugins-minio.gemspec
116
+ homepage: https://github.com/aboutsource/sensu-plugins-minio
117
+ licenses:
118
+ - MIT
119
+ metadata: {}
120
+ post_install_message:
121
+ rdoc_options: []
122
+ require_paths:
123
+ - lib
124
+ required_ruby_version: !ruby/object:Gem::Requirement
125
+ requirements:
126
+ - - ">="
127
+ - !ruby/object:Gem::Version
128
+ version: '0'
129
+ required_rubygems_version: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ requirements: []
135
+ rubyforge_project:
136
+ rubygems_version: 2.7.6
137
+ signing_key:
138
+ specification_version: 4
139
+ summary: Check if there are updates for the local minio server instance
140
+ test_files: []