riemann-babbler 0.7.2 → 0.7.3

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.
data/bin/riemann-babbler CHANGED
@@ -31,6 +31,7 @@ logger = Logger.new(STDOUT)
31
31
  merge_config( logger, opts, configatron )
32
32
  set_logger_lvl( logger, configatron )
33
33
  load_plugins( configatron )
34
+ load_gems_plugins( configatron )
34
35
  riemann = get_riemann( configatron, logger )
35
36
  load_parent( configatron )
36
37
  start_plugins( Riemann::Babbler.registered_plugins, riemann, logger, configatron )
data/config.yml CHANGED
@@ -8,9 +8,6 @@ logger:
8
8
 
9
9
  plugins:
10
10
 
11
- run_only:
12
- # - cpu
13
-
14
11
  interval: 60
15
12
 
16
13
  dummy:
@@ -1,5 +1,5 @@
1
1
  module Riemann
2
2
  class Babbler
3
- VERSION = '0.7.2'
3
+ VERSION = '0.7.3'
4
4
  end
5
5
  end
data/lib/start_helpers.rb CHANGED
@@ -35,7 +35,7 @@ end
35
35
 
36
36
  # получаем список все плагинов
37
37
  def load_plugins(configatron)
38
- plugins = []
38
+ plugins = Array.new
39
39
  default_plugins_dir = File.expand_path('../riemann/babbler/plugins/', __FILE__)
40
40
  Dir.glob( default_plugins_dir + "/*.rb" ) do |file|
41
41
  plugins << file
@@ -58,6 +58,15 @@ def load_plugins(configatron)
58
58
  plugins.each { |plugin| require plugin }
59
59
  end
60
60
 
61
+ def load_gems_plugins(configatron)
62
+ plugins = Array.new
63
+ Gem.source_index.each do |gem|
64
+ plugin_name = gem[1].to_s.scan(/\s+name=(.+)\s+/)[0][0]
65
+ plugins << plugin_name if plugin_name.include? 'riemann-babbler-plugins-'
66
+ end
67
+ plugins.each { |plugin| require plugin }
68
+ end
69
+
61
70
  def get_riemann(configatron, logger)
62
71
  begin
63
72
  riemann_ip = Resolv.new.getaddress(configatron.riemann.host)
@@ -76,10 +85,10 @@ end
76
85
 
77
86
  # логика стартования плагинов
78
87
  def start_plugins(registered_plugins, riemann, logger, configatron)
79
-
80
- if run_only = configatron.plugins.run_only
81
- registered_plugins.delete_if {|plugin| ! run_only.include? plugin.to_s.split("::").last.downcase }
82
- end unless ( configatron.plugins.run_only.nil? || configatron.plugins.run_only.empty? )
88
+ run_only = Array.new
89
+ configatron.plugins.to_hash.keys.each { |key| run_only << key.to_s }
90
+ puts run_only.inspect
91
+ registered_plugins.delete_if {|plugin| ! run_only.include? plugin.to_s.split("::").last.downcase }
83
92
 
84
93
  plugin_threads = registered_plugins.map do |plugin|
85
94
  Thread.new {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: riemann-babbler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.7.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -165,7 +165,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
165
165
  version: '0'
166
166
  segments:
167
167
  - 0
168
- hash: 3223819334690264337
168
+ hash: -4099335186582753544
169
169
  required_rubygems_version: !ruby/object:Gem::Requirement
170
170
  none: false
171
171
  requirements: