zabbix_receiver 0.0.4 → 0.0.5

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: 16d7639b10ddad739cc71e5027b0093fc3ea50cc
4
- data.tar.gz: 1344cfc43519e4993c99a2cc12bc7a380b50360e
3
+ metadata.gz: 9cde2102f6ce41ea3a56e751cf1995e78a046ac8
4
+ data.tar.gz: 97ad99114924f950b29b5e1d637a149d11d63608
5
5
  SHA512:
6
- metadata.gz: 02f603fa3f485493b43bcdbbb880d44aadb31c57d860c63f315f1a984db94a5fc158c80a441b985aed028dc51ee904f4efb31c3e6bda73e3e5514b0af775b1f0
7
- data.tar.gz: 46a7bb932afd96a319448ed2bb725e3a2ee0a2d97e9a6383ae16b6b0da4f69b6999ef762a2e7eade89bccee870411f8962202746d1940d41e40866cbb171fb63
6
+ metadata.gz: e93b37c25e9753c11e68076e378cf3a09ed6517df6fecf741ac8e84d03a8cb30a7ad1142265c07c0346103cd444d3e315398f01e1c7ea2e2bec08e8b1c52171d
7
+ data.tar.gz: fb803b81ae6da9b8d7c12dfdd20d24c1273988a1b69ba492faa86c150d8c54fa137dca88166f54fcf52921879dcb87b4f96e288b52ca60d7a5834aee9dbff6af
@@ -1,3 +1,3 @@
1
1
  module ZabbixReceiver
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -27,23 +27,26 @@ module ZabbixReceiver
27
27
 
28
28
  case request_type
29
29
  when 'active checks'
30
- c.write(proxy_request(request_body))
30
+ response_body = proxy_request(request_body)
31
31
  when 'sender data'
32
32
  output.receive_sender_data(request)
33
33
 
34
34
  count = request['data'].size
35
35
 
36
- respond_with(c, {
36
+ response_body = format_response({
37
37
  "response" => "success",
38
38
  "info" => "Processed #{count} Failed 0 Total #{count} Seconds spent 0.000000"
39
39
  })
40
40
  else
41
41
  logger.error "Unknown request type (#{request_type})"
42
- respond_with(c, {
42
+ response_body = format_response({
43
43
  "response" => "success",
44
44
  "info" => ""
45
45
  })
46
46
  end
47
+
48
+ logger.debug "Raw response: #{response.inspect}"
49
+ c.write(response_body)
47
50
  ensure
48
51
  c.close
49
52
  end
@@ -79,9 +82,9 @@ module ZabbixReceiver
79
82
  JSON.parse(body)
80
83
  end
81
84
 
82
- def respond_with(f, payload)
85
+ def format_response(payload)
83
86
  payload = payload.to_json
84
- f.write(ZABBIX_HEADER + [payload.bytesize].pack('q') + payload)
87
+ ZABBIX_HEADER + [payload.bytesize].pack('q') + payload
85
88
  end
86
89
  end
87
90
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zabbix_receiver
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryota Arai