mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 10:08:40 -05:00
(RE-7014) Add support for statsd
They way we were using graphite was incorrect for the type of data we were sending it. statsd is the appropriate mechanism for our needs. statsd and graphite are mutually exclusive and configuring statsd will take precendence over Graphite. Example of configuration in vmpooler.yaml.example
This commit is contained in:
parent
5aaab7c5c2
commit
8d75865a5c
8 changed files with 143 additions and 7 deletions
|
|
@ -7,6 +7,7 @@ module Vmpooler
|
|||
require 'rbvmomi'
|
||||
require 'redis'
|
||||
require 'sinatra/base'
|
||||
require "statsd-ruby"
|
||||
require 'time'
|
||||
require 'timeout'
|
||||
require 'yaml'
|
||||
|
|
@ -52,6 +53,13 @@ module Vmpooler
|
|||
parsed_config[:graphite]['prefix'] ||= 'vmpooler'
|
||||
end
|
||||
|
||||
# statsd is an addition and my not be present in YAML configuration
|
||||
if parsed_config[:statsd]
|
||||
if parsed_config[:statsd]['server']
|
||||
parsed_config[:statsd]['prefix'] ||= 'vmpooler'
|
||||
end
|
||||
end
|
||||
|
||||
if parsed_config[:tagfilter]
|
||||
parsed_config[:tagfilter].keys.each do |tag|
|
||||
parsed_config[:tagfilter][tag] = Regexp.new(parsed_config[:tagfilter][tag])
|
||||
|
|
@ -79,6 +87,14 @@ module Vmpooler
|
|||
end
|
||||
end
|
||||
|
||||
def self.new_statsd(server, port)
|
||||
if server.nil? or server.empty? or server.length == 0
|
||||
nil
|
||||
else
|
||||
Statsd.new server, port
|
||||
end
|
||||
end
|
||||
|
||||
def self.pools(conf)
|
||||
conf[:pools]
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue