sensu-plugins-storm 1.0.0 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1890e59e02fd0ab62bd5440b455401c716df56bf
4
- data.tar.gz: 014b252d57189836d61929056a80b3f7e6899b82
3
+ metadata.gz: 5ef58412e6dae8f0325129cbbbf312a71a1399ef
4
+ data.tar.gz: fc6c1783911abf32d8c3cbad2062363477b53c49
5
5
  SHA512:
6
- metadata.gz: e241dc326e76b78e2054ac391bf3981cb8f1f38449187ddcd4e5607d59a5b522eb9c869771e03b6a2ae1b82c62a1b6d505d793ee0cd3155b43418296549ad1ea
7
- data.tar.gz: 1a0fcfe22df5f458f9467c0013bdf23e0ee0299adcfa37ee97d703ea2330bdb53e3bbcd9d4e3fc82faa4386d6e14e6d879dd6101f20e2e7fdd73443104d11b56
6
+ metadata.gz: 12576dcb935530f6c13cfc133d32a6d4e43ed7b128654bcab7603a06d1df76c9785be88107eaeb6dd12d53a803080f6ef0292092e05bc7f002fc32550c2cc4c5
7
+ data.tar.gz: 4fcd341c54526b433f2941e74f8677d6b9c53a025e5aeab0483399a70d67a191eaf5a00cdc2dc28a282bfb89816d114ce565650c6617dfb7dfd24405522cfcf6
@@ -24,17 +24,26 @@ class CheckStormCapacity < Sensu::Plugin::Check::CLI
24
24
  description: 'Cluster host',
25
25
  required: true
26
26
 
27
+ option :port,
28
+ short: '-o',
29
+ long: '--port=VALUE',
30
+ description: 'Port (default 8080)',
31
+ default: 8080
32
+
27
33
  option :user,
28
34
  short: '-u',
29
35
  long: '--username=VALUE',
30
- description: 'username',
31
- required: true
36
+ description: 'username'
32
37
 
33
38
  option :pass,
34
39
  short: '-p',
35
40
  long: '--password=VALUE',
36
- description: 'password',
37
- required: true
41
+ description: 'password'
42
+
43
+ option :topology,
44
+ short: '-n',
45
+ long: '--topology=VALUE',
46
+ description: 'topology to check'
38
47
 
39
48
  option :ssl,
40
49
  description: 'use HTTPS (default false)',
@@ -63,13 +72,21 @@ class CheckStormCapacity < Sensu::Plugin::Check::CLI
63
72
 
64
73
  def request(path)
65
74
  protocol = config[:ssl] ? 'https' : 'http'
66
- auth = Base64.encode64("#{config[:user]}:#{config[:pass]}")
67
- RestClient::Request.execute(
68
- method: :get,
69
- url: "#{protocol}://#{config[:host]}:#{config[:port]}/#{path}",
70
- timeout: config[:timeout],
71
- headers: { 'Authorization' => "Basic #{auth}" }
72
- )
75
+ if config[:user]
76
+ auth = Base64.encode64("#{config[:user]}:#{config[:pass]}")
77
+ RestClient::Request.execute(
78
+ method: :get,
79
+ url: "#{protocol}://#{config[:host]}:#{config[:port]}#{path}",
80
+ timeout: config[:timeout],
81
+ headers: { 'Authorization' => "Basic #{auth}" }
82
+ )
83
+ else
84
+ RestClient::Request.execute(
85
+ method: :get,
86
+ url: "#{protocol}://#{config[:host]}:#{config[:port]}#{path}",
87
+ timeout: config[:timeout]
88
+ )
89
+ end
73
90
  end
74
91
 
75
92
  def run
@@ -81,6 +98,8 @@ class CheckStormCapacity < Sensu::Plugin::Check::CLI
81
98
 
82
99
  topologies = JSON.parse(r.to_str)['topologies']
83
100
  topologies.each do |topology|
101
+ next if config[:topology] && topology['name'] != config[:topology]
102
+ puts topology['name']
84
103
  t = request("/api/v1/topology/#{topology['id']}")
85
104
  if t.code != 200
86
105
  critical "unexpected status code '#{r.code}'"
@@ -95,10 +114,10 @@ class CheckStormCapacity < Sensu::Plugin::Check::CLI
95
114
  warning "bolt #{bolt['boltId']} has capacity #{bolt['capacity']}"
96
115
  end
97
116
  end
98
-
99
- ok 'all capacities ok'
100
117
  end
101
118
 
119
+ ok 'all capacities ok'
120
+
102
121
  rescue Errno::ECONNREFUSED => e
103
122
  critical 'Storm is not responding' + e.message
104
123
  rescue RestClient::RequestTimeout
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  #
3
- # Storm Workers Check
3
+ # Storm Supervisors Check
4
4
  # ===
5
5
  #
6
6
  # Copyright 2016 Andy Royle <ajroyle@gmail.com>
@@ -8,7 +8,7 @@
8
8
  # Released under the same terms as Sensu (the MIT license); see LICENSE
9
9
  # for details.
10
10
  #
11
- # Check the number of workers (supervisors) for a given cluster and compare to warn/minimum thresholds
11
+ # Check the number of supervisors for a given cluster and compare to warn/minimum thresholds
12
12
 
13
13
  require 'sensu-plugin/check/cli'
14
14
  require 'rest-client'
@@ -17,33 +17,37 @@ require 'uri'
17
17
  require 'json'
18
18
  require 'base64'
19
19
 
20
- class CheckStormCapacity < Sensu::Plugin::Check::CLI
20
+ class CheckStormSupervisors < Sensu::Plugin::Check::CLI
21
21
  option :host,
22
22
  short: '-h',
23
23
  long: '--host=VALUE',
24
24
  description: 'Cluster host',
25
25
  default: 'localhost'
26
26
 
27
+ option :port,
28
+ short: '-o',
29
+ long: '--port=VALUE',
30
+ description: 'Port (default 8080)',
31
+ default: 8080
32
+
27
33
  option :user,
28
34
  short: '-u',
29
35
  long: '--username=VALUE',
30
- description: 'username',
31
- required: true
36
+ description: 'username'
32
37
 
33
38
  option :pass,
34
39
  short: '-p',
35
40
  long: '--password=VALUE',
36
- description: 'password',
37
- required: true
41
+ description: 'password'
38
42
 
39
43
  option :ssl,
40
44
  description: 'use HTTPS (default false)',
41
45
  long: '--ssl'
42
46
 
43
47
  option :crit,
44
- short: '-m',
45
- long: '--minimum=VALUE',
46
- description: 'Minimum (critical) workers',
48
+ short: '-c',
49
+ long: '--critical=VALUE',
50
+ description: 'Minimum (critical) supervisors',
47
51
  required: true,
48
52
  proc: proc { |l| l.to_i }
49
53
 
@@ -63,13 +67,21 @@ class CheckStormCapacity < Sensu::Plugin::Check::CLI
63
67
 
64
68
  def request(path)
65
69
  protocol = config[:ssl] ? 'https' : 'http'
66
- auth = Base64.encode64("#{config[:user]}:#{config[:pass]}")
67
- RestClient::Request.execute(
68
- method: :get,
69
- url: "#{protocol}://#{config[:host]}:#{config[:port]}/#{path}",
70
- timeout: config[:timeout],
71
- headers: { 'Authorization' => "Basic #{auth}" }
72
- )
70
+ if config[:user]
71
+ auth = Base64.encode64("#{config[:user]}:#{config[:pass]}")
72
+ RestClient::Request.execute(
73
+ method: :get,
74
+ url: "#{protocol}://#{config[:host]}:#{config[:port]}#{path}",
75
+ timeout: config[:timeout],
76
+ headers: { 'Authorization' => "Basic #{auth}" }
77
+ )
78
+ else
79
+ RestClient::Request.execute(
80
+ method: :get,
81
+ url: "#{protocol}://#{config[:host]}:#{config[:port]}#{path}",
82
+ timeout: config[:timeout]
83
+ )
84
+ end
73
85
  end
74
86
 
75
87
  def run
@@ -80,15 +92,15 @@ class CheckStormCapacity < Sensu::Plugin::Check::CLI
80
92
  end
81
93
 
82
94
  cluster = JSON.parse(r.to_str)
83
- workers = cluster['supervisors'].to_i
95
+ supervisors = cluster['supervisors'].to_i
84
96
 
85
- if workers < config[:crit]
86
- critical "worker count #{workers} is below allowed minimum of #{config[:crit]}"
87
- elsif workers < config[:warn]
88
- warning "worker count #{workers} is below warn threshold of #{config[:warn]}"
97
+ if supervisors < config[:crit]
98
+ critical "supervisor count #{supervisors} is below allowed minimum of #{config[:crit]}"
99
+ elsif supervisors < config[:warn]
100
+ warning "supervisor count #{supervisors} is below warn threshold of #{config[:warn]}"
89
101
  end
90
102
 
91
- ok 'worker count OK'
103
+ ok 'supervisor count OK'
92
104
 
93
105
  rescue Errno::ECONNREFUSED => e
94
106
  critical 'Storm is not responding' + e.message
@@ -24,17 +24,21 @@ class CheckStormTopologies < Sensu::Plugin::Check::CLI
24
24
  description: 'Cluster host',
25
25
  required: true
26
26
 
27
+ option :port,
28
+ short: '-o',
29
+ long: '--port=VALUE',
30
+ description: 'Port (default 8080)',
31
+ default: 8080
32
+
27
33
  option :user,
28
34
  short: '-u',
29
35
  long: '--username=VALUE',
30
- description: 'username',
31
- required: true
36
+ description: 'username'
32
37
 
33
38
  option :pass,
34
39
  short: '-p',
35
40
  long: '--password=VALUE',
36
- description: 'password',
37
- required: true
41
+ description: 'password'
38
42
 
39
43
  option :ssl,
40
44
  description: 'use HTTPS (default false)',
@@ -62,13 +66,21 @@ class CheckStormTopologies < Sensu::Plugin::Check::CLI
62
66
 
63
67
  def request(path)
64
68
  protocol = config[:ssl] ? 'https' : 'http'
65
- auth = Base64.encode64("#{config[:user]}:#{config[:pass]}")
66
- RestClient::Request.execute(
67
- method: :get,
68
- url: "#{protocol}://#{config[:host]}:#{config[:port]}/#{path}",
69
- timeout: config[:timeout],
70
- headers: { 'Authorization' => "Basic #{auth}" }
71
- )
69
+ if config[:user]
70
+ auth = Base64.encode64("#{config[:user]}:#{config[:pass]}")
71
+ RestClient::Request.execute(
72
+ method: :get,
73
+ url: "#{protocol}://#{config[:host]}:#{config[:port]}#{path}",
74
+ timeout: config[:timeout],
75
+ headers: { 'Authorization' => "Basic #{auth}" }
76
+ )
77
+ else
78
+ RestClient::Request.execute(
79
+ method: :get,
80
+ url: "#{protocol}://#{config[:host]}:#{config[:port]}#{path}",
81
+ timeout: config[:timeout]
82
+ )
83
+ end
72
84
  end
73
85
 
74
86
  def run
@@ -17,24 +17,28 @@ require 'uri'
17
17
  require 'json'
18
18
  require 'base64'
19
19
 
20
- class MetricsStormCapacity < Sensu::Plugin::Metric::CLI::Graphite
20
+ class MetricsStormTopologies < Sensu::Plugin::Metric::CLI::Graphite
21
21
  option :host,
22
22
  short: '-h',
23
23
  long: '--host=VALUE',
24
24
  description: 'Cluster host',
25
25
  required: true
26
26
 
27
+ option :port,
28
+ short: '-o',
29
+ long: '--port=VALUE',
30
+ description: 'Port (default 8080)',
31
+ default: 8080
32
+
27
33
  option :user,
28
34
  short: '-u',
29
35
  long: '--username=VALUE',
30
- description: 'username',
31
- required: true
36
+ description: 'username'
32
37
 
33
38
  option :pass,
34
39
  short: '-p',
35
40
  long: '--password=VALUE',
36
- description: 'password',
37
- required: true
41
+ description: 'password'
38
42
 
39
43
  option :ssl,
40
44
  description: 'use HTTPS (default false)',
@@ -55,13 +59,21 @@ class MetricsStormCapacity < Sensu::Plugin::Metric::CLI::Graphite
55
59
 
56
60
  def request(path)
57
61
  protocol = config[:ssl] ? 'https' : 'http'
58
- auth = Base64.encode64("#{config[:user]}:#{config[:pass]}")
59
- RestClient::Request.execute(
60
- method: :get,
61
- url: "#{protocol}://#{config[:host]}:#{config[:port]}/#{path}",
62
- timeout: config[:timeout],
63
- headers: { 'Authorization' => "Basic #{auth}" }
64
- )
62
+ if config[:user]
63
+ auth = Base64.encode64("#{config[:user]}:#{config[:pass]}")
64
+ RestClient::Request.execute(
65
+ method: :get,
66
+ url: "#{protocol}://#{config[:host]}:#{config[:port]}#{path}",
67
+ timeout: config[:timeout],
68
+ headers: { 'Authorization' => "Basic #{auth}" }
69
+ )
70
+ else
71
+ RestClient::Request.execute(
72
+ method: :get,
73
+ url: "#{protocol}://#{config[:host]}:#{config[:port]}#{path}",
74
+ timeout: config[:timeout]
75
+ )
76
+ end
65
77
  end
66
78
 
67
79
  def run
@@ -1,7 +1,7 @@
1
1
  module SensuPluginsStorm
2
2
  module Version
3
3
  MAJOR = 1
4
- MINOR = 0
4
+ MINOR = 1
5
5
  PATCH = 0
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-storm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Royle
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-16 00:00:00.000000000 Z
11
+ date: 2017-05-31 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
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.2'
27
27
  - !ruby/object:Gem::Dependency
@@ -42,147 +42,147 @@ dependencies:
42
42
  name: codeclimate-test-reporter
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0.4'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0.4'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '1.7'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1.7'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: github-markup
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ~>
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: '1.3'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ~>
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '1.3'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: pry
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ~>
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0.10'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ~>
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0.10'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rake
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ~>
101
+ - - "~>"
102
102
  - !ruby/object:Gem::Version
103
103
  version: '10.0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ~>
108
+ - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: '10.0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: redcarpet
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ~>
115
+ - - "~>"
116
116
  - !ruby/object:Gem::Version
117
117
  version: '3.2'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ~>
122
+ - - "~>"
123
123
  - !ruby/object:Gem::Version
124
124
  version: '3.2'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: rspec
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ~>
129
+ - - "~>"
130
130
  - !ruby/object:Gem::Version
131
131
  version: '3.1'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - ~>
136
+ - - "~>"
137
137
  - !ruby/object:Gem::Version
138
138
  version: '3.1'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: rubocop
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - ~>
143
+ - - "~>"
144
144
  - !ruby/object:Gem::Version
145
145
  version: 0.40.0
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - ~>
150
+ - - "~>"
151
151
  - !ruby/object:Gem::Version
152
152
  version: 0.40.0
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: yard
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - ~>
157
+ - - "~>"
158
158
  - !ruby/object:Gem::Version
159
159
  version: '0.8'
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - ~>
164
+ - - "~>"
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0.8'
167
167
  description: This plugin provides metrics and checks for Apache Storm topologies
168
- email: <ajroyle@gmail.com>
168
+ email: "<ajroyle@gmail.com>"
169
169
  executables:
170
- - check-storm-capacity.rb
171
- - check-storm-topologies.rb
172
- - check-storm-workers.rb
170
+ - check-storm-supervisors.rb
173
171
  - metrics-storm-topologies.rb
172
+ - check-storm-topologies.rb
173
+ - check-storm-capacity.rb
174
174
  extensions: []
175
175
  extra_rdoc_files: []
176
176
  files:
177
+ - CHANGELOG.md
178
+ - LICENSE
179
+ - README.md
177
180
  - bin/check-storm-capacity.rb
181
+ - bin/check-storm-supervisors.rb
178
182
  - bin/check-storm-topologies.rb
179
- - bin/check-storm-workers.rb
180
183
  - bin/metrics-storm-topologies.rb
181
- - lib/sensu-plugins-storm/version.rb
182
184
  - lib/sensu-plugins-storm.rb
183
- - LICENSE
184
- - README.md
185
- - CHANGELOG.md
185
+ - lib/sensu-plugins-storm/version.rb
186
186
  homepage: https://github.com/andyroyle/sensu-plugins-storm
187
187
  licenses:
188
188
  - MIT
@@ -199,17 +199,17 @@ require_paths:
199
199
  - lib
200
200
  required_ruby_version: !ruby/object:Gem::Requirement
201
201
  requirements:
202
- - - '>='
202
+ - - ">="
203
203
  - !ruby/object:Gem::Version
204
204
  version: 2.0.0
205
205
  required_rubygems_version: !ruby/object:Gem::Requirement
206
206
  requirements:
207
- - - '>='
207
+ - - ">="
208
208
  - !ruby/object:Gem::Version
209
209
  version: '0'
210
210
  requirements: []
211
211
  rubyforge_project:
212
- rubygems_version: 2.0.14.1
212
+ rubygems_version: 2.5.2
213
213
  signing_key:
214
214
  specification_version: 4
215
215
  summary: Sensu plugins for Storm