riemann-babbler 0.5.5 → 0.5.6
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 +1 -5
- data/config.yml +1 -0
- data/lib/riemann/babbler/plugin.rb +17 -1
- data/lib/riemann/version.rb +1 -1
- metadata +2 -2
data/bin/riemann-babbler
CHANGED
@@ -79,10 +79,6 @@ unless configatron.plugins.files.nil?
|
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
82
|
-
# патч на dns resolv
|
83
|
-
ipaddress = Resolv.new.getaddresses(configatron.riemann.host)
|
84
|
-
configatron.riemann.host = ipaddress[rand(ipaddress.length)]
|
85
|
-
|
86
82
|
# start plugins
|
87
83
|
plugins.each { |plugin| require plugin }
|
88
84
|
|
@@ -92,7 +88,7 @@ plugin_threads = Riemann::Babbler.registered_plugins.map do |plugin|
|
|
92
88
|
}
|
93
89
|
end
|
94
90
|
|
95
|
-
Signal.trap "
|
91
|
+
Signal.trap "TERM" do # перехватываем сообщение (на будущее)
|
96
92
|
plugin_threads.each( &:kill )
|
97
93
|
end
|
98
94
|
|
data/config.yml
CHANGED
@@ -26,6 +26,9 @@ module Riemann
|
|
26
26
|
@configatron = configatron
|
27
27
|
@logger = logger
|
28
28
|
@storage = Hash.new
|
29
|
+
@configatron.riemann.cache_host = Configatron::Dynamic.new{ riemann_ip }
|
30
|
+
@configatron.riemann.last_cache_time = Time.now
|
31
|
+
@riemann_ip = riemann_random_ip
|
29
32
|
init
|
30
33
|
run
|
31
34
|
end
|
@@ -41,9 +44,22 @@ module Riemann
|
|
41
44
|
end
|
42
45
|
alias :opts :options
|
43
46
|
|
47
|
+
def riemann_ip
|
48
|
+
if Time.now - options.riemann.last_cache_time > options.riemann.dns_ttl
|
49
|
+
options.riemann.last_cache_time = Time.now
|
50
|
+
@riemann_ip = riemann_random_ip
|
51
|
+
end
|
52
|
+
@riemann_ip
|
53
|
+
end
|
54
|
+
|
55
|
+
def riemann_random_ip
|
56
|
+
ipaddress = Resolv.new.getaddresses(configatron.riemann.host)
|
57
|
+
ipaddress[rand(ipaddress.length)]
|
58
|
+
end
|
59
|
+
|
44
60
|
def riemann
|
45
61
|
@riemann ||= Riemann::Client.new(
|
46
|
-
:host => options.riemann.
|
62
|
+
:host => options.riemann.cache_host,
|
47
63
|
:port => options.riemann.port
|
48
64
|
)
|
49
65
|
end
|
data/lib/riemann/version.rb
CHANGED
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.5.
|
4
|
+
version: 0.5.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -164,7 +164,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
164
164
|
version: '0'
|
165
165
|
segments:
|
166
166
|
- 0
|
167
|
-
hash:
|
167
|
+
hash: -4231455956657341224
|
168
168
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
169
169
|
none: false
|
170
170
|
requirements:
|