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 +4 -4
- data/lib/zabbix_receiver/version.rb +1 -1
- data/lib/zabbix_receiver/worker.rb +8 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9cde2102f6ce41ea3a56e751cf1995e78a046ac8
|
4
|
+
data.tar.gz: 97ad99114924f950b29b5e1d637a149d11d63608
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e93b37c25e9753c11e68076e378cf3a09ed6517df6fecf741ac8e84d03a8cb30a7ad1142265c07c0346103cd444d3e315398f01e1c7ea2e2bec08e8b1c52171d
|
7
|
+
data.tar.gz: fb803b81ae6da9b8d7c12dfdd20d24c1273988a1b69ba492faa86c150d8c54fa137dca88166f54fcf52921879dcb87b4f96e288b52ca60d7a5834aee9dbff6af
|
@@ -27,23 +27,26 @@ module ZabbixReceiver
|
|
27
27
|
|
28
28
|
case request_type
|
29
29
|
when 'active checks'
|
30
|
-
|
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
|
-
|
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
|
-
|
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
|
85
|
+
def format_response(payload)
|
83
86
|
payload = payload.to_json
|
84
|
-
|
87
|
+
ZABBIX_HEADER + [payload.bytesize].pack('q') + payload
|
85
88
|
end
|
86
89
|
end
|
87
90
|
end
|