sensu-plugins-turbine 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NjExNDk5MTgxNTVjZmJjZmI0Yzg1MDA3OTgyNWIxZTZhMGUwZWNiNg==
5
+ data.tar.gz: !binary |-
6
+ ZjkwYTY5NDVhMTEzZmQ2YTA5NzNlZGE5NmMzMWZiYzA1OTg4MTg4NQ==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ ZjdhNWM4YzRhOGU1ZWE1YTlhYzFiN2NkYmI0MTI5ZjFlZWY2NWJlNzA5NTFi
10
+ MzY2MWFhN2ZmN2I0ZTAyNjI2M2U2ZGU3MTlkMDEyNzg3MDBjNGVkOWYwY2I2
11
+ MzA2NjQ3MDViMWIwNjJhZDU1ZTJhMWJhMjg1NDhkY2Q1NjYxMzg=
12
+ data.tar.gz: !binary |-
13
+ ZDNkMDdjOGNiNjIzYmFhOGUzZDVkZDNmNGNjYTQ4NDBiODRjOTI1NzNiYjlk
14
+ MDMzMTJkZjY3ZmI1MmYzMDhiNzVmZGFiYjEwMGNjM2NmMmI5YTlhMzZjM2I0
15
+ ZTgxZTNjMTFhZjA1ODNhYWRkZTk4Nzk3NTgzZDY5OTNkMTc1ZTc=
@@ -0,0 +1,76 @@
1
+ #! /usr/bin/env ruby
2
+ #
3
+ # metrics-turbine
4
+ #
5
+ # DESCRIPTION:
6
+ # Will output data from turbine.stream
7
+ #
8
+ # OUTPUT:
9
+ # metric data
10
+ #
11
+ # PLATFORMS:
12
+ # Linux
13
+ #
14
+ # DEPENDENCIES:
15
+ # gem: sensu-plugin
16
+ # gem: eventmachine
17
+ # gem: em-http-request
18
+ # gem: json
19
+ #
20
+ # USAGE:
21
+ #
22
+ # NOTES:
23
+ #
24
+ # LICENSE:
25
+ # Copyright 2016 Chris McFee <cmcfee@kent.edu>
26
+ # Released under the same terms as Sensu (the MIT license); see LICENSE
27
+ # for details.
28
+
29
+ require 'sensu-plugin/metric/cli'
30
+ require 'eventmachine'
31
+ require 'em-http'
32
+ require 'json'
33
+
34
+ class PodsMetrics < Sensu::Plugin::Metric::CLI::Graphite
35
+ option :url,
36
+ short: '-u URL',
37
+ description: 'Full URL path to the turbine stream',
38
+ required: true
39
+
40
+ option :thread_pool,
41
+ short: '-t POOLNAME',
42
+ description: 'The pool name requested',
43
+ required: true
44
+
45
+ def initialize
46
+ super
47
+ @url = config[:url]
48
+ @thread_pool = config[:thread_pool]
49
+ end
50
+
51
+ def run
52
+ config[:scheme] = URI(@url).host
53
+ http = EM::HttpRequest.new(@url, keepalive: true, connect_timeout: 0, inactivity_timeout: 0)
54
+ info = %w(currentActiveCount currentConcurrentExecutionCount)
55
+ EventMachine.run do
56
+ req = http.get(head: { 'accept' => 'application/json' })
57
+ req.stream do |chunk|
58
+ unless chunk.strip.empty?
59
+ if chunk.include?('data: ') && !chunk.include?('ping')
60
+ json_data = (chunk.split(': ')[1]).strip!
61
+ unless json_data.nil?
62
+ if json_data.end_with?('}')
63
+ message = JSON.parse(json_data)
64
+ if message['name'] == @thread_pool
65
+ info.size.times { |i| puts "#{config[:scheme]}.#{message['name']}.#{info[i]}.#{message[info[i]]}" unless message[info[i]].nil? }
66
+ EventMachine.stop
67
+ end
68
+ end
69
+ end
70
+ end
71
+ end
72
+ end
73
+ end
74
+ ok
75
+ end
76
+ end
@@ -0,0 +1,9 @@
1
+ module SensuPluginsTurbine
2
+ module Version
3
+ MAJOR = 0
4
+ MINOR = 0
5
+ PATCH = 1
6
+
7
+ VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
+ end
9
+ end
@@ -0,0 +1 @@
1
+ require 'sensu-plugins-turbine/version'
metadata ADDED
@@ -0,0 +1,217 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sensu-plugins-turbine
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - mickfeech and contributors
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-09-26 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: '1.2'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: eventmachine
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: em-http-request
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '1.7'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '1.7'
69
+ - !ruby/object:Gem::Dependency
70
+ name: codeclimate-test-reporter
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: '0.4'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: '0.4'
83
+ - !ruby/object:Gem::Dependency
84
+ name: github-markup
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ~>
88
+ - !ruby/object:Gem::Version
89
+ version: '1.3'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ~>
95
+ - !ruby/object:Gem::Version
96
+ version: '1.3'
97
+ - !ruby/object:Gem::Dependency
98
+ name: pry
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ~>
102
+ - !ruby/object:Gem::Version
103
+ version: '0.10'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ~>
109
+ - !ruby/object:Gem::Version
110
+ version: '0.10'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rake
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ~>
116
+ - !ruby/object:Gem::Version
117
+ version: '10.5'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ~>
123
+ - !ruby/object:Gem::Version
124
+ version: '10.5'
125
+ - !ruby/object:Gem::Dependency
126
+ name: redcarpet
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ~>
130
+ - !ruby/object:Gem::Version
131
+ version: '3.2'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ~>
137
+ - !ruby/object:Gem::Version
138
+ version: '3.2'
139
+ - !ruby/object:Gem::Dependency
140
+ name: rubocop
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ~>
144
+ - !ruby/object:Gem::Version
145
+ version: '0.37'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ~>
151
+ - !ruby/object:Gem::Version
152
+ version: '0.37'
153
+ - !ruby/object:Gem::Dependency
154
+ name: rspec
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ~>
158
+ - !ruby/object:Gem::Version
159
+ version: '3.4'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ~>
165
+ - !ruby/object:Gem::Version
166
+ version: '3.4'
167
+ - !ruby/object:Gem::Dependency
168
+ name: yard
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ~>
172
+ - !ruby/object:Gem::Version
173
+ version: '0.8'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ~>
179
+ - !ruby/object:Gem::Version
180
+ version: '0.8'
181
+ description: Plugins to provide functionality to check systemd services for Sensu,
182
+ a monitoring framework
183
+ email:
184
+ - cmcfee@kent.edu
185
+ executables:
186
+ - metrics-turbine.rb
187
+ extensions: []
188
+ extra_rdoc_files: []
189
+ files:
190
+ - bin/metrics-turbine.rb
191
+ - lib/sensu-plugins-turbine.rb
192
+ - lib/sensu-plugins-turbine/version.rb
193
+ homepage: https://github.com/mickfeech/sensu-plugins-turbine
194
+ licenses:
195
+ - MIT
196
+ metadata: {}
197
+ post_install_message:
198
+ rdoc_options: []
199
+ require_paths:
200
+ - lib
201
+ required_ruby_version: !ruby/object:Gem::Requirement
202
+ requirements:
203
+ - - ! '>='
204
+ - !ruby/object:Gem::Version
205
+ version: '0'
206
+ required_rubygems_version: !ruby/object:Gem::Requirement
207
+ requirements:
208
+ - - ! '>='
209
+ - !ruby/object:Gem::Version
210
+ version: '0'
211
+ requirements: []
212
+ rubyforge_project:
213
+ rubygems_version: 2.4.5
214
+ signing_key:
215
+ specification_version: 4
216
+ summary: This provides functionality to check turbine streams.
217
+ test_files: []