Class: ZabbixSender::Request
- Inherits:
-
Object
- Object
- ZabbixSender::Request
- Defined in:
- lib/zabbix_sender/request.rb
Overview
Zabbix Sender protocol:
www.zabbix.org/wiki/Docs/protocols www.zabbix.com/documentation/2.4/manual/appendix/items/activepassive
<HEADER><DATA LENGTH><DATA>
HEADER - “ZBXDx01” DATA LENGTH - data length (8 bytes, little endian) DATA - JSON, see data method
Constant Summary collapse
- HEADER =
"ZBXD\x01"
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(host, key, value) ⇒ Request
constructor
A new instance of Request.
- #response ⇒ Object
- #send(socket) ⇒ Object
Constructor Details
#initialize(host, key, value) ⇒ Request
Returns a new instance of Request.
19 20 21 22 23 |
# File 'lib/zabbix_sender/request.rb', line 19 def initialize(host, key, value) @host = host @key = key @value = value end |
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
17 18 19 |
# File 'lib/zabbix_sender/request.rb', line 17 def host @host end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
17 18 19 |
# File 'lib/zabbix_sender/request.rb', line 17 def key @key end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
17 18 19 |
# File 'lib/zabbix_sender/request.rb', line 17 def value @value end |
Instance Method Details
#response ⇒ Object
31 32 33 |
# File 'lib/zabbix_sender/request.rb', line 31 def response @response ||= JSON.parse(@raw_response[13..-1]) end |
#send(socket) ⇒ Object
25 26 27 28 29 |
# File 'lib/zabbix_sender/request.rb', line 25 def send(socket) socket.puts(encoded_data) @raw_response = socket.gets response end |