kurchatov 0.4.1 → 0.4.2

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: 882843085745f7e2cbe6d86c71579c2bbd94fd71
4
- data.tar.gz: 7d87f910409e109272296cec7a99a994b4075909
3
+ metadata.gz: 03637929698462ddf10999615c44bf1abbfdf764
4
+ data.tar.gz: a6b8925c35795c75e2e62d66e4da4aeef628742a
5
5
  SHA512:
6
- metadata.gz: d2eb1257a80ecb9ebf4e8c779e5bbe07bd32f2517929445feebd9bb7f17f04cc9af2baf16a81581962a48d96241862895ae5068c3fb36c5b192090f7b46cc042
7
- data.tar.gz: 4080fa6689cb734639670dc8f11073955e17ca8acefa3f99f8ca563edd60ddde979c7ba0701f9440ce8ae0cb2133d3a752512680e10b5ebbadb6e10e9f3b5504
6
+ metadata.gz: f64e8e4e28beb87c3bfac265c11d5ecb6f7d135b56f72b331bdb3f7fac7047c079bb1fabe0cadeffba103b7ae432a250897a0f79b14f1530c61167c5135d6905
7
+ data.tar.gz: b3189a467b0e43b7ec2a745366c6f53401c71513c8c8014f346750a00d42f39646a830b932edf669aaf80e48ab057a1cb32a7d1eb306b97cb4f41e0dc3420506
data/app/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- gem "kurchatov", "= 0.3.8"
3
+ gem "kurchatov", "= 0.4.1"
4
4
  gem "beefcake", "=0.5.0"
5
5
  gem "sys-filesystem"
6
6
  gem "sys-proctable"
data/app/Gemfile.lock CHANGED
@@ -14,7 +14,7 @@ GEM
14
14
  file-tail (1.0.12)
15
15
  tins (~> 0.5)
16
16
  ipaddress (0.8.0)
17
- kurchatov (0.3.8)
17
+ kurchatov (0.4.1)
18
18
  beefcake (>= 0.3.5)
19
19
  ohai
20
20
  libyajl2 (1.0.1)
@@ -54,7 +54,7 @@ DEPENDENCIES
54
54
  beefcake (= 0.5.0)
55
55
  ffi-rzmq
56
56
  file-tail
57
- kurchatov (= 0.3.8)
57
+ kurchatov (= 0.4.1)
58
58
  net-ntp
59
59
  net-ping
60
60
  parallel
data/debian/changelog CHANGED
@@ -1,3 +1,9 @@
1
+ riemann-client (1:0.4.1) stable; urgency=low
2
+
3
+ * Bump.
4
+
5
+ -- Undev DevOps Team <devops@undev.ru> Mon, 15 Dec 2014 19:17:12 +0300
6
+
1
7
  riemann-client (1:0.4.0) stable; urgency=low
2
8
 
3
9
  * Http transport.
@@ -36,7 +36,7 @@ module Kurchatov
36
36
  :short => '-l LEVEL',
37
37
  :long => '--log_level LEVEL',
38
38
  :description => 'Set the log level (debug, info, warn, error, fatal)',
39
- :proc => lambda { |l| l.to_sym }
39
+ :proc => lambda { |l| l.downcase.to_sym }
40
40
 
41
41
  option :log_location,
42
42
  :short => '-L LOGLOCATION',
@@ -3,8 +3,8 @@ module Kurchatov
3
3
  extend Mixlib::Config
4
4
  default :log_level, :info
5
5
  default :log_location, STDERR
6
- default :plugin_paths, ['/usr/share/kurchatov/plugins']
7
- default :config_file, '/etc/kurchatov/config.yml'
6
+ default :plugin_paths, ['/usr/share/riemann-client/plugins']
7
+ default :config_file, '/etc/riemann-client/config.yml'
8
8
  # errors
9
9
  default :ERROR_CONFIG, 2
10
10
  end
@@ -24,6 +24,7 @@ module Kurchatov
24
24
  @all_names = Array.new
25
25
  @plugins_to_run = Array.new
26
26
  config = YAML.load_file(config_file)
27
+ config = {} and Log.info("Empty config file '#{config_file}'") if config == false
27
28
  config.each do |name, val|
28
29
  @all_names << name
29
30
  next if val.nil?
@@ -0,0 +1,59 @@
1
+ name 'new line delimeter json transport'
2
+
3
+ always_start true
4
+ ignore_errors true
5
+
6
+ default[:host], default[:port] = Kurchatov::Config[:nsjson_transport].to_s.split(":")
7
+ default[:connect_timeout] = 1
8
+ default[:send_timeout] = 1
9
+ default[:exit_on_disconnect] = true
10
+
11
+ run_if do
12
+ !!plugin.host
13
+ end
14
+
15
+ helpers do
16
+
17
+ def if_error
18
+ if plugin.exit_on_disconnect
19
+ Log.error("Socket #{plugin.host}:#{plugin.port} (#{@socket.inspect}) write error, exit..")
20
+ exit 99
21
+ end
22
+ nil
23
+ end
24
+
25
+ def connect
26
+ Timeout::timeout(plugin.connect_timeout) {
27
+ @socket ||= (TCPSocket.new(plugin.host, plugin.port) rescue if_error)
28
+ }
29
+ end
30
+
31
+ def mutex
32
+ @mutex ||= Mutex.new
33
+ end
34
+
35
+ def with_connection
36
+ mutex.synchronize do
37
+ yield(@socket || connect)
38
+ end
39
+ end
40
+
41
+ def flush
42
+ @events_to_send ||= events.to_flush
43
+ if !@events_to_send.empty?
44
+ @message = {"events" => @events_to_send}.to_json
45
+ Log.debug("Message: #{@message}")
46
+ with_connection do |socket|
47
+ Timeout::timeout(plugin.send_timeout) {
48
+ socket.puts(@message)
49
+ } rescue if_error
50
+ end
51
+ end
52
+ @events_to_send = nil
53
+ end
54
+
55
+ end
56
+
57
+ run do
58
+ loop { flush; sleep 1 }
59
+ end
@@ -1,3 +1,3 @@
1
1
  module Kurchatov
2
- VERSION = "0.4.1"
2
+ VERSION = "0.4.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kurchatov
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vasiliev Dmitry
@@ -177,6 +177,7 @@ files:
177
177
  - lib/kurchatov/queue.rb
178
178
  - lib/kurchatov/responders/http_server.rb
179
179
  - lib/kurchatov/responders/http_transport.rb
180
+ - lib/kurchatov/responders/ndjson_transport.rb
180
181
  - lib/kurchatov/responders/riemann_transport.rb
181
182
  - lib/kurchatov/responders/udp_server.rb
182
183
  - lib/kurchatov/riemann/client.rb