vmpooler 0.13.1 → 0.14.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/vmpooler +15 -10
- data/lib/vmpooler.rb +4 -16
- data/lib/vmpooler/api.rb +41 -34
- data/lib/vmpooler/api/helpers.rb +1 -1
- data/lib/vmpooler/api/request_logger.rb +20 -0
- data/lib/vmpooler/api/v1.rb +52 -27
- data/lib/vmpooler/generic_connection_pool.rb +7 -5
- data/lib/vmpooler/metrics.rb +24 -0
- data/lib/vmpooler/metrics/dummy_statsd.rb +24 -0
- data/lib/vmpooler/metrics/graphite.rb +47 -0
- data/lib/vmpooler/metrics/promstats.rb +380 -0
- data/lib/vmpooler/metrics/promstats/collector_middleware.rb +121 -0
- data/lib/vmpooler/metrics/statsd.rb +40 -0
- data/lib/vmpooler/pool_manager.rb +32 -40
- data/lib/vmpooler/providers/dummy.rb +2 -1
- data/lib/vmpooler/providers/vsphere.rb +88 -25
- data/lib/vmpooler/util/parsing.rb +16 -0
- data/lib/vmpooler/version.rb +1 -1
- metadata +25 -6
- data/lib/vmpooler/dummy_statsd.rb +0 -22
- data/lib/vmpooler/graphite.rb +0 -42
- data/lib/vmpooler/statsd.rb +0 -37
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# utility class shared between apps
|
4
|
+
module Vmpooler
|
5
|
+
class Parsing
|
6
|
+
def self.get_platform_pool_count(requested, &_block)
|
7
|
+
requested_platforms = requested.split(',')
|
8
|
+
requested_platforms.each do |platform|
|
9
|
+
platform_alias, pool, count = platform.split(':')
|
10
|
+
raise ArgumentError if platform_alias.nil? || pool.nil? || count.nil?
|
11
|
+
|
12
|
+
yield platform_alias, pool, count
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/vmpooler/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vmpooler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.14.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-08-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pickup
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '2.0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: prometheus-client
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '2.0'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '2.0'
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
126
|
name: net-ldap
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -205,13 +219,18 @@ files:
|
|
205
219
|
- lib/vmpooler/api.rb
|
206
220
|
- lib/vmpooler/api/dashboard.rb
|
207
221
|
- lib/vmpooler/api/helpers.rb
|
222
|
+
- lib/vmpooler/api/request_logger.rb
|
208
223
|
- lib/vmpooler/api/reroute.rb
|
209
224
|
- lib/vmpooler/api/v1.rb
|
210
225
|
- lib/vmpooler/dashboard.rb
|
211
|
-
- lib/vmpooler/dummy_statsd.rb
|
212
226
|
- lib/vmpooler/generic_connection_pool.rb
|
213
|
-
- lib/vmpooler/graphite.rb
|
214
227
|
- lib/vmpooler/logger.rb
|
228
|
+
- lib/vmpooler/metrics.rb
|
229
|
+
- lib/vmpooler/metrics/dummy_statsd.rb
|
230
|
+
- lib/vmpooler/metrics/graphite.rb
|
231
|
+
- lib/vmpooler/metrics/promstats.rb
|
232
|
+
- lib/vmpooler/metrics/promstats/collector_middleware.rb
|
233
|
+
- lib/vmpooler/metrics/statsd.rb
|
215
234
|
- lib/vmpooler/pool_manager.rb
|
216
235
|
- lib/vmpooler/providers.rb
|
217
236
|
- lib/vmpooler/providers/base.rb
|
@@ -228,7 +247,7 @@ files:
|
|
228
247
|
- lib/vmpooler/public/lib/dashboard.js
|
229
248
|
- lib/vmpooler/public/lib/jquery.min.js
|
230
249
|
- lib/vmpooler/public/vmpooler.css
|
231
|
-
- lib/vmpooler/
|
250
|
+
- lib/vmpooler/util/parsing.rb
|
232
251
|
- lib/vmpooler/version.rb
|
233
252
|
- lib/vmpooler/views/dashboard.erb
|
234
253
|
- lib/vmpooler/views/layout.erb
|
@@ -251,7 +270,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
251
270
|
- !ruby/object:Gem::Version
|
252
271
|
version: '0'
|
253
272
|
requirements: []
|
254
|
-
rubygems_version: 3.0.
|
273
|
+
rubygems_version: 3.0.8
|
255
274
|
signing_key:
|
256
275
|
specification_version: 4
|
257
276
|
summary: vmpooler provides configurable pools of instantly-available (running) virtual
|
@@ -1,22 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Vmpooler
|
4
|
-
class DummyStatsd
|
5
|
-
attr_reader :server, :port, :prefix
|
6
|
-
|
7
|
-
def initialize(*)
|
8
|
-
end
|
9
|
-
|
10
|
-
def increment(*)
|
11
|
-
true
|
12
|
-
end
|
13
|
-
|
14
|
-
def gauge(*)
|
15
|
-
true
|
16
|
-
end
|
17
|
-
|
18
|
-
def timing(*)
|
19
|
-
true
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
data/lib/vmpooler/graphite.rb
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'rubygems' unless defined?(Gem)
|
4
|
-
|
5
|
-
module Vmpooler
|
6
|
-
class Graphite
|
7
|
-
attr_reader :server, :port, :prefix
|
8
|
-
|
9
|
-
def initialize(params = {})
|
10
|
-
raise ArgumentError, "Graphite server is required. Config: #{params.inspect}" if params['server'].nil? || params['server'].empty?
|
11
|
-
|
12
|
-
@server = params['server']
|
13
|
-
@port = params['port'] || 2003
|
14
|
-
@prefix = params['prefix'] || 'vmpooler'
|
15
|
-
end
|
16
|
-
|
17
|
-
def increment(label)
|
18
|
-
log label, 1
|
19
|
-
end
|
20
|
-
|
21
|
-
def gauge(label, value)
|
22
|
-
log label, value
|
23
|
-
end
|
24
|
-
|
25
|
-
def timing(label, duration)
|
26
|
-
log label, duration
|
27
|
-
end
|
28
|
-
|
29
|
-
def log(path, value)
|
30
|
-
Thread.new do
|
31
|
-
socket = TCPSocket.new(server, port)
|
32
|
-
begin
|
33
|
-
socket.puts "#{prefix}.#{path} #{value} #{Time.now.to_i}"
|
34
|
-
ensure
|
35
|
-
socket.close
|
36
|
-
end
|
37
|
-
end
|
38
|
-
rescue StandardError => e
|
39
|
-
warn "Failure logging #{path} to graphite server [#{server}:#{port}]: #{e}"
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
data/lib/vmpooler/statsd.rb
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'rubygems' unless defined?(Gem)
|
4
|
-
require 'statsd'
|
5
|
-
|
6
|
-
module Vmpooler
|
7
|
-
class Statsd
|
8
|
-
attr_reader :server, :port, :prefix
|
9
|
-
|
10
|
-
def initialize(params = {})
|
11
|
-
raise ArgumentError, "Statsd server is required. Config: #{params.inspect}" if params['server'].nil? || params['server'].empty?
|
12
|
-
|
13
|
-
host = params['server']
|
14
|
-
@port = params['port'] || 8125
|
15
|
-
@prefix = params['prefix'] || 'vmpooler'
|
16
|
-
@server = ::Statsd.new(host, @port)
|
17
|
-
end
|
18
|
-
|
19
|
-
def increment(label)
|
20
|
-
server.increment(prefix + '.' + label)
|
21
|
-
rescue StandardError => e
|
22
|
-
warn "Failure incrementing #{prefix}.#{label} on statsd server [#{server}:#{port}]: #{e}"
|
23
|
-
end
|
24
|
-
|
25
|
-
def gauge(label, value)
|
26
|
-
server.gauge(prefix + '.' + label, value)
|
27
|
-
rescue StandardError => e
|
28
|
-
warn "Failure updating gauge #{prefix}.#{label} on statsd server [#{server}:#{port}]: #{e}"
|
29
|
-
end
|
30
|
-
|
31
|
-
def timing(label, duration)
|
32
|
-
server.timing(prefix + '.' + label, duration)
|
33
|
-
rescue StandardError => e
|
34
|
-
warn "Failure updating timing #{prefix}.#{label} on statsd server [#{server}:#{port}]: #{e}"
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|