Module: ZabbixRubyClient::Plugins::Memory

Extended by:
ZabbixRubyClient::PluginBase, Memory
Included in:
Memory
Defined in:
lib/zabbix-ruby-client/plugins/memory.rb

Instance Method Summary collapse

Methods included from ZabbixRubyClient::PluginBase

getline, getlines, httprequest, perform

Instance Method Details

#collect(*args) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/zabbix-ruby-client/plugins/memory.rb', line 10

def collect(*args)
  host = args[0]
  info = get_info
  if info
    time = Time.now.to_i
    back = []
    back << "#{host} memory[total] #{time} #{info['MemTotal']}"
    back << "#{host} memory[free] #{time} #{info['MemFree']}"
    back << "#{host} memory[used] #{time} #{info['MemUsed']}"
    back << "#{host} memory[percent_used] #{time} #{info['MemPercent']}"
    back << "#{host} memory[swap_total] #{time} #{info['SwapTotal']}"
    back << "#{host} memory[swap_free] #{time} #{info['SwapFree']}"
    back << "#{host} memory[swap_used] #{time} #{info['SwapUsed']}"
    back << "#{host} memory[swap_percent_used] #{time} #{info['SwapPercent']}"
    return back
  else
    return []
  end
end