Class: Zabbix::Sender::Buffer
- Inherits:
-
Zabbix::Sender
- Object
- Zabbix::Sender
- Zabbix::Sender::Buffer
- Defined in:
- lib/zabbix/sender/buffer.rb
Constant Summary
Constants inherited from Zabbix::Sender
Instance Attribute Summary
Attributes inherited from Zabbix::Sender
Instance Method Summary collapse
- #append(key, value, opts = {}) ⇒ Object
- #flush ⇒ Object (also: #send!)
-
#initialize(opts = {}) ⇒ Buffer
constructor
A new instance of Buffer.
Methods inherited from Zabbix::Sender
#configured?, #connect, #disconnect, #send_break, #send_data, #send_heartbeat, #send_start, #send_stop
Constructor Details
#initialize(opts = {}) ⇒ Buffer
Returns a new instance of Buffer.
2 3 4 5 |
# File 'lib/zabbix/sender/buffer.rb', line 2 def initialize(opts={}) @buffer = [] super(opts) end |
Instance Method Details
#append(key, value, opts = {}) ⇒ Object
7 8 9 10 |
# File 'lib/zabbix/sender/buffer.rb', line 7 def append(key, value, opts={}) return false unless configured? @buffer << cons_zabbix_data_element(key, value, opts) end |
#flush ⇒ Object Also known as: send!
12 13 14 15 16 17 |
# File 'lib/zabbix/sender/buffer.rb', line 12 def flush return false unless @buffer.size > 0 ret = send_zabbix_request(@buffer) @buffer.clear return ret end |