riemann-babbler 2.0.7 → 2.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/bin/riemann-babbler +2 -1
- data/lib/riemann/babbler/plugin_loader.rb +2 -1
- data/lib/riemann/babbler/plugins/ntp.rb +3 -3
- data/lib/riemann/babbler/plugins/{responder.rb → responder_http.rb} +3 -3
- data/lib/riemann/babbler/plugins/responder_udp.rb +29 -0
- data/lib/riemann/babbler/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca261d40d9f35e4b7aa41926a12aa57f8dc1e606
|
4
|
+
data.tar.gz: d27586426e66ab9485fbeafdf77f4c1bd4528421
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c47fbb89d8ea9c8a81fdc4778622d99b31c0ef1f46bd5aa659dcd073008bb423d76b57ac04022dfaae6bd74a21913056e001fce28ada069a9f2f9f069f3c36c
|
7
|
+
data.tar.gz: d15b7fd46e1f67319af9aafa7a8be67fa156573926149a27aebb79d0b2244b96c5c21d1d4239102b51e2bbf47990a44f351a1ae7cb6e9ba0344add6cde7899bd
|
data/Gemfile.lock
CHANGED
data/bin/riemann-babbler
CHANGED
@@ -32,7 +32,8 @@ where [options] are:
|
|
32
32
|
opt :plugins_directory, 'Directory for plugins', :default => '/usr/share/riemann-babbler/plugins'
|
33
33
|
opt :tcp, 'Use TCP transport instead of UDP (improves reliability, slight overhead.', :default => true
|
34
34
|
opt :minimize_event_count, 'Minimize count of sent messages', :default => true
|
35
|
-
opt :
|
35
|
+
opt :responder_http_port, 'Port to bind http responder', :default => 55755
|
36
|
+
opt :responder_udp_port, 'Port to bind tcp responder', :default => 55955
|
36
37
|
end
|
37
38
|
|
38
39
|
# load current settings
|
@@ -15,9 +15,9 @@ class Riemann::Babbler::Plugin::Ntp < Riemann::Babbler::Plugin
|
|
15
15
|
|
16
16
|
def collect
|
17
17
|
{
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
:service => plugin.service + " #{plugin.host}",
|
19
|
+
:description => "Ntp lag with host #{plugin.host}",
|
20
|
+
:metric => (::Net::NTP.get(plugin.host, 'ntp', 5).time.to_i - unixnow).abs
|
21
21
|
}
|
22
22
|
end
|
23
23
|
|
@@ -1,10 +1,10 @@
|
|
1
1
|
require 'net/http/server'
|
2
2
|
require 'json'
|
3
3
|
|
4
|
-
class Riemann::Babbler::Plugin::
|
4
|
+
class Riemann::Babbler::Plugin::ResponderHttp < Riemann::Babbler::Plugin
|
5
5
|
|
6
6
|
def init
|
7
|
-
plugin.set_default(:port, opts.riemann.
|
7
|
+
plugin.set_default(:port, opts.riemann.responder_http_port)
|
8
8
|
plugin.set_default(:started_at, Time.now.to_i)
|
9
9
|
end
|
10
10
|
|
@@ -36,4 +36,4 @@ class Riemann::Babbler::Plugin::Responder < Riemann::Babbler::Plugin
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
-
end
|
39
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'socket'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
class Riemann::Babbler::Plugin::ResponderUdp < Riemann::Babbler::Plugin
|
5
|
+
|
6
|
+
def init
|
7
|
+
plugin.set_default(:port, opts.riemann.responder_udp_port)
|
8
|
+
end
|
9
|
+
|
10
|
+
def process(data, src)
|
11
|
+
begin
|
12
|
+
report(JSON.parse(data))
|
13
|
+
puts "src:#{src.inspect}"
|
14
|
+
src.reply "ok\n"
|
15
|
+
rescue
|
16
|
+
log :error, "Failed to send message: #{data.inspect}"
|
17
|
+
src.reply "failed to send: #{data.inspect}\n"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def run!
|
22
|
+
log :unknown, "Start udp server at #{plugin.port}"
|
23
|
+
Socket.udp_server_loop(plugin.port) do |data, src|
|
24
|
+
log :debug, "recived data: #{data.inspect}, from client: #{src.inspect}"
|
25
|
+
process(data, src)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
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: 2.0.
|
4
|
+
version: 2.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vasiliev Dmitry
|
@@ -269,7 +269,8 @@ files:
|
|
269
269
|
- lib/riemann/babbler/plugins/nginx.rb
|
270
270
|
- lib/riemann/babbler/plugins/ntp.rb
|
271
271
|
- lib/riemann/babbler/plugins/pgsql.rb
|
272
|
-
- lib/riemann/babbler/plugins/
|
272
|
+
- lib/riemann/babbler/plugins/responder_http.rb
|
273
|
+
- lib/riemann/babbler/plugins/responder_udp.rb
|
273
274
|
- lib/riemann/babbler/plugins/runit.rb
|
274
275
|
- lib/riemann/babbler/plugins/status_file.rb
|
275
276
|
- lib/riemann/babbler/plugins/tw_cli.rb
|