sensu-plugins-storm 0.2.1 → 0.3.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/CHANGELOG.md +9 -4
- data/README.md +7 -0
- data/bin/check-storm-capacity.rb +1 -1
- data/bin/metrics-storm-topologies.rb +84 -0
- data/lib/sensu-plugins-storm/version.rb +2 -2
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc407ce47c8070b733f54dd4e3efc5336a758968
|
4
|
+
data.tar.gz: c3b5b378300a26a4069f00bc42bb14aa8a9fa1d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 839071bbc2b72b1059fd8ebba744db2dfe34d8866af166c8d95d317892843b60448ef459801d63838f52ed8cb8eac974953ce5c1c96e3740eef438b18a09f685
|
7
|
+
data.tar.gz: a1af4cbe8313c7ea6ac3321f47117f7006526cb48352cb753194b34b08d578a6f49db269461fcd6d9be15fb456b205a1f658ef5ada9ebbde5bed69c0d141215f
|
data/CHANGELOG.md
CHANGED
@@ -3,18 +3,23 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
3
3
|
|
4
4
|
This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
|
5
5
|
|
6
|
-
# 0.
|
6
|
+
# [0.3.0] - 2016-09-01
|
7
|
+
### Added
|
8
|
+
- metrics-storm-topologies script
|
9
|
+
|
10
|
+
# [0.2.1] - 2016-09-01
|
7
11
|
### changed
|
8
12
|
- fix bug in timeout parsing
|
9
13
|
|
10
|
-
# 0.2.0 - 2016-09-01
|
14
|
+
# [0.2.0] - 2016-09-01
|
11
15
|
### Added
|
12
16
|
- check-storm-capacity script
|
13
17
|
|
14
|
-
# 0.1.0 - 2016-09-01
|
18
|
+
# [0.1.0] - 2016-09-01
|
15
19
|
### Added
|
16
20
|
- initial release
|
17
21
|
|
18
|
-
[0.
|
22
|
+
[0.3.0]: https://github.com/andyroyle/sensu-plugins-storm/compare/0.3.0...HEAD
|
23
|
+
[0.2.1]: https://github.com/andyroyle/sensu-plugins-storm/compare/0.2.1...0.3.0
|
19
24
|
[0.2.0]: https://github.com/andyroyle/sensu-plugins-storm/compare/0.2.0...0.2.1
|
20
25
|
[0.1.0]: https://github.com/andyroyle/sensu-plugins-storm/compare/0.1.0...0.2.0
|
data/README.md
CHANGED
@@ -10,6 +10,7 @@
|
|
10
10
|
## Files
|
11
11
|
* bin/check-storm-topologies.rb
|
12
12
|
* bin/check-storm-capacity.rb
|
13
|
+
* bin/metrics-storm-topologies.rb
|
13
14
|
|
14
15
|
## Usage
|
15
16
|
|
@@ -24,6 +25,12 @@
|
|
24
25
|
/opt/sensu/embedded/bin$ /opt/sensu/embedded/bin/ruby check-storm-capacity.rb --host=my-storm-cluster.com -s --user=admin --password=password -w 1 -c 1.5
|
25
26
|
```
|
26
27
|
|
28
|
+
**check-storm-capacity** example
|
29
|
+
```bash
|
30
|
+
/opt/sensu/embedded/bin$ /opt/sensu/embedded/bin/ruby metrics-storm-topologies.rb --host=my-storm-cluster.com -s --user=admin --password=password
|
31
|
+
```
|
32
|
+
|
33
|
+
|
27
34
|
## Installation
|
28
35
|
|
29
36
|
[Installation and Setup](http://sensu-plugins.io/docs/installation_instructions.html)
|
data/bin/check-storm-capacity.rb
CHANGED
@@ -0,0 +1,84 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# Storm Topology Metrics
|
4
|
+
# ===
|
5
|
+
#
|
6
|
+
# Copyright 2016 Andy Royle <ajroyle@gmail.com>
|
7
|
+
#
|
8
|
+
# Released under the same terms as Sensu (the MIT license); see LICENSE
|
9
|
+
# for details.
|
10
|
+
#
|
11
|
+
# Metrics for storm topologies
|
12
|
+
|
13
|
+
require 'sensu-plugin/metric/cli'
|
14
|
+
require 'rest-client'
|
15
|
+
require 'openssl'
|
16
|
+
require 'uri'
|
17
|
+
require 'json'
|
18
|
+
require 'base64'
|
19
|
+
|
20
|
+
class MetricsStormCapacity < Sensu::Plugin::Metric::CLI::Graphite
|
21
|
+
option :host,
|
22
|
+
short: '-h',
|
23
|
+
long: '--host=VALUE',
|
24
|
+
description: 'Cluster host',
|
25
|
+
required: true
|
26
|
+
|
27
|
+
option :user,
|
28
|
+
short: '-u',
|
29
|
+
long: '--username=VALUE',
|
30
|
+
description: 'username',
|
31
|
+
required: true
|
32
|
+
|
33
|
+
option :pass,
|
34
|
+
short: '-p',
|
35
|
+
long: '--password=VALUE',
|
36
|
+
description: 'password',
|
37
|
+
required: true
|
38
|
+
|
39
|
+
option :ssl,
|
40
|
+
description: 'use HTTPS (default false)',
|
41
|
+
long: '--ssl'
|
42
|
+
|
43
|
+
option :timeout,
|
44
|
+
short: '-t',
|
45
|
+
long: '--timeout=VALUE',
|
46
|
+
description: 'Timeout in seconds',
|
47
|
+
proc: proc { |l| l.to_f },
|
48
|
+
default: 5
|
49
|
+
|
50
|
+
option :scheme,
|
51
|
+
short: '-s',
|
52
|
+
long: '--scheme=VALUE',
|
53
|
+
description: 'Metric naming scheme, text to prepend to metric',
|
54
|
+
default: "#{Socket.gethostname}.storm"
|
55
|
+
|
56
|
+
def request(path)
|
57
|
+
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
|
+
)
|
65
|
+
end
|
66
|
+
|
67
|
+
def run
|
68
|
+
metrics = %w(emitted tasks failed executors processLatency executeLatency transferred capacity acked executed)
|
69
|
+
|
70
|
+
r = request('/stormui/api/v1/topology/summary')
|
71
|
+
|
72
|
+
topologies = JSON.parse(r.to_str)['topologies']
|
73
|
+
topologies.each do |topology|
|
74
|
+
t = request("/stormui/api/v1/topology/#{topology['id']}")
|
75
|
+
|
76
|
+
bolts = JSON.parse(t.to_str)['bolts']
|
77
|
+
bolts.each do |bolt|
|
78
|
+
metrics.each { |metric| output "#{config[:scheme]}.#{topology['name']}.#{bolt['boltId']}.#{metric}", bolt[metric] }
|
79
|
+
end
|
80
|
+
|
81
|
+
ok
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-plugins-storm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Royle
|
@@ -169,11 +169,13 @@ email: <ajroyle@gmail.com>
|
|
169
169
|
executables:
|
170
170
|
- check-storm-capacity.rb
|
171
171
|
- check-storm-topologies.rb
|
172
|
+
- metrics-storm-topologies.rb
|
172
173
|
extensions: []
|
173
174
|
extra_rdoc_files: []
|
174
175
|
files:
|
175
176
|
- bin/check-storm-capacity.rb
|
176
177
|
- bin/check-storm-topologies.rb
|
178
|
+
- bin/metrics-storm-topologies.rb
|
177
179
|
- lib/sensu-plugins-storm/version.rb
|
178
180
|
- lib/sensu-plugins-storm.rb
|
179
181
|
- LICENSE
|