Class: Zabbix::Sender::Buffer
Constant Summary
DEFAULT_SERVER_PORT
Instance Attribute Summary
#configured
Instance Method Summary
collapse
#configured?, #connect, #disconnect, #send_break, #send_data, #send_heartbeat, #send_start, #send_stop
Constructor Details
#initialize(opts = {}) ⇒ 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
|