riemann-babbler 2.0.7 → 2.0.8

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aa32e47b01f2def306dcb975beebf70a2909b7d6
4
- data.tar.gz: 799f46518441a10f1b5e5accf59446e2b3d5633b
3
+ metadata.gz: ca261d40d9f35e4b7aa41926a12aa57f8dc1e606
4
+ data.tar.gz: d27586426e66ab9485fbeafdf77f4c1bd4528421
5
5
  SHA512:
6
- metadata.gz: 8ae1a082b8c5f44b084772dd61a1cab4bf4a3d1a665e624e803b913abb2a978d38481f32266f23459110ccc78100541634bf3296505a0d7a503ce92803799389
7
- data.tar.gz: 2e256a5a1f0ad80e5c08af978f09258ab6f82a3469f2718d9d4aaa9d0bd192c6c444e478a831bbf55be8ce2b5d7f8f3c48e7a9478192492f9c9d6eb30e1e555e
6
+ metadata.gz: 8c47fbb89d8ea9c8a81fdc4778622d99b31c0ef1f46bd5aa659dcd073008bb423d76b57ac04022dfaae6bd74a21913056e001fce28ada069a9f2f9f069f3c36c
7
+ data.tar.gz: d15b7fd46e1f67319af9aafa7a8be67fa156573926149a27aebb79d0b2244b96c5c21d1d4239102b51e2bbf47990a44f351a1ae7cb6e9ba0344add6cde7899bd
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- riemann-babbler (2.0.7)
4
+ riemann-babbler (2.0.8)
5
5
  configatron
6
6
  docile
7
7
  file-tail
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 :responder_port, 'Port to bind responder', :default => 55755
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
@@ -24,7 +24,8 @@ module Riemann
24
24
  'tw_cli',
25
25
  'iptables',
26
26
  'errors_reporter',
27
- 'responder'
27
+ 'responder_http',
28
+ 'responder_udp',
28
29
  ].freeze
29
30
 
30
31
  attr_accessor :load_plugin_names_from_config, :delete_from_autostart
@@ -15,9 +15,9 @@ class Riemann::Babbler::Plugin::Ntp < Riemann::Babbler::Plugin
15
15
 
16
16
  def collect
17
17
  {
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
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::Responder < 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.responder_port)
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
@@ -1,5 +1,5 @@
1
1
  module Riemann
2
2
  module Babbler
3
- VERSION = '2.0.7'
3
+ VERSION = '2.0.8'
4
4
  end
5
5
  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.7
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/responder.rb
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