riemann-babbler 2.5.1 → 2.5.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e4cb348ec2b3429b7c55d42cf517995488eb71bf
4
- data.tar.gz: 73edbc46985f2bafb7abb11e65ad5dc412a55096
3
+ metadata.gz: 424c014b8907bd1e525e74d60cefb61bcb1703de
4
+ data.tar.gz: 8c094a607d4a165938d6905b8bffcaf783d56148
5
5
  SHA512:
6
- metadata.gz: 4f1dd30d413ee94ac51b4efd23f80e55ae0f746078d883b558eb60bbc2c237f60134f49555b8d732e765ef57d963773864294c1d793fa095fceeb8f5193c74bf
7
- data.tar.gz: efe780da08ed8a3e5bd03ae9344db34a9ce7023b26628e01e7a6441e340e0ecdaea26a48d64d38ac7540aa2572977fe63f1c1af3214ec0653e5dd09745b04546
6
+ metadata.gz: 4511b3cd0355050da41c40e19b09c934878ff9fe5f0342ca7bc19fd3e0a10af6edce86ae14bc033414c7f3025bbdf0ef1e31cf3e87585533ffe3f615355eb5c1
7
+ data.tar.gz: f447ac5c27014e8b505781cdcd740a6f1257cbd015880379fbaedf37a319cb4d7c1a6f09878a59bc5d1d0f0103d14b4332a5de26fc0e854d51f7d9be137ef45b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- riemann-babbler (2.5.1)
4
+ riemann-babbler (2.5.2)
5
5
  configatron
6
6
  docile
7
7
  file-tail
data/README.md CHANGED
@@ -14,18 +14,19 @@ Usage:
14
14
  riemann-babbler [options]
15
15
  where [options] are:
16
16
  --config, -c <s>: Config file (default: /etc/riemann-babbler/config.yml)
17
- --host, -h <s>: Riemann host (default: 127.0.0.1)
18
- --port, -p <i>: Riemann port (default: 5555)
17
+ --host, -h <s>: Riemann server (default: 127.0.0.1)
18
+ --port, -p <i>: Riemann server default port (default: 5555)
19
+ --backlog, -b <i>: Riemann server backlog for events (default: 100)
19
20
  --timeout, -t <i>: Riemann timeout (default: 5)
20
21
  --fqdn, --no-fqdn, -f: Use fqdn for event hostname (default: true)
21
22
  --ttl, -l <i>: TTL for events (default: 60)
22
23
  --interval, -i <i>: Seconds between updates (default: 60)
23
24
  --log-level, -o <s>: Level log (default: DEBUG)
24
- --plugins-directory, -u <s>: Directory for plugins (default: /usr/share/riemann-babbler/plugins)
25
+ --plugins-directory, -d <s>: Directory for plugins (default: /usr/share/riemann-babbler/plugins)
25
26
  --tcp, --no-tcp: Use TCP transport instead of UDP (improves reliability, slight overhead. (Default: true)
26
27
  --minimize-event-count, --no-minimize-event-count, -m: Minimize count of sent messages (default: true)
27
28
  --responder-bind-http, -r <s>: Bind to http responder (default: 0.0.0.0:55755)
28
- --responder-bind-udp, -e <s>: Bind to udp responder (default: 127.0.0.1:55955)
29
+ --responder-bind-udp, -e <s>: Bind to udp responder (default: 0.0.0.0:55955)
29
30
  --version, -v: Print version and exit
30
31
  --help: Show this message
31
32
  ```
@@ -19,11 +19,11 @@ module Riemann
19
19
  @host, @port = host.split(':')
20
20
  @port ||= opts.riemann.port
21
21
  @events = Array.new
22
- @riemann = client
23
22
  start
24
23
  end
25
24
 
26
25
  def start
26
+ build_client
27
27
  @running = true
28
28
  @runner = Thread.new do
29
29
  while @running
@@ -43,7 +43,7 @@ module Riemann
43
43
  end
44
44
 
45
45
  def <<(event)
46
- @events.shift if @events.size < opts.riemann.backlog
46
+ @events.shift if @events.size > opts.riemann.backlog
47
47
  @events << event
48
48
  end
49
49
 
@@ -62,42 +62,21 @@ module Riemann
62
62
  end
63
63
  end
64
64
 
65
- # riemann client connect
66
- def client
67
- sender = Riemann::Client.new(
68
- :host => resolv(@host), #todo: add ttl
69
- :port => @port,
70
- :timeout => opts.riemann.timeout
71
- )
72
- sender = sender.tcp if opts.riemann.tcp
73
- connect_client(sender)
65
+ # riemann client
66
+ def build_client
67
+ @riemann = nil
68
+ @riemann = Riemann::Client.new(:host => resolv(@host), :port => @port, :timeout => opts.riemann.timeout)
69
+ @riemann = @riemann.tcp if opts.riemann.tcp
70
+ @riemann
74
71
  end
75
72
 
76
73
  #@return ipaddress of riemann server
77
74
  def resolv(host)
78
- begin
79
- ip = Resolv.new.getaddress(host)
80
- log :debug, "Resolv host: #{host} => #{ip}"
81
- rescue
82
- log :fatal, "Can't resolv hostname: #{host}"
83
- exit Errors::RESOLV_RIEMANN_SERVER
84
- end
75
+ ip = Resolv.new.getaddress(host)
76
+ log :debug, "Resolv host: #{host} => #{ip}"
85
77
  ip
86
78
  end
87
79
 
88
- #@return connect to riemann
89
- def connect_client(riemann)
90
- connect = riemann
91
- begin
92
- connect = riemann.connect if opts.riemann.tcp
93
- log :debug, "Connected to #{riemann.host}:#{riemann.port}"
94
- rescue
95
- log :fatal, "Can't connect to riemann server: #{riemann.host}:#{riemann.port}"
96
- exit Errors::INIT_CONNECT
97
- end
98
- connect
99
- end
100
-
101
80
  end
102
81
  end
103
82
  end
@@ -1,5 +1,5 @@
1
1
  module Riemann
2
2
  module Babbler
3
- VERSION = '2.5.1'
3
+ VERSION = '2.5.2'
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.5.1
4
+ version: 2.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vasiliev Dmitry