Module: ZabbixRubyClient::Plugins::Network

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

Instance Method Summary collapse

Methods included from ZabbixRubyClient::PluginBase

getline, getlines, httprequest, os, perform, time

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/network.rb', line 10

def collect(*args)
  host = args[0]
  interface = args[1]
  info = get_info(interface)
  if info
    back = []
    back << "#{host} net.rx_ok[#{interface}] #{time} #{info[:rx_ok]}"
    back << "#{host} net.rx_packets[#{interface}] #{time} #{info[:rx_packets]}"
    back << "#{host} net.rx_err[#{interface}] #{time} #{info[:rx_err]}"
    back << "#{host} net.rx_drop[#{interface}] #{time} #{info[:rx_drop]}"
    back << "#{host} net.tx_ok[#{interface}] #{time} #{info[:tx_ok]}"
    back << "#{host} net.tx_packets[#{interface}] #{time} #{info[:tx_packets]}"
    back << "#{host} net.tx_err[#{interface}] #{time} #{info[:tx_err]}"
    back << "#{host} net.tx_drop[#{interface}] #{time} #{info[:tx_drop]}"
    return back
  else
    return []
  end
end

#discover(*args) ⇒ Object



30
31
32
33
# File 'lib/zabbix-ruby-client/plugins/network.rb', line 30

def discover(*args)
  interface = args[0]
  [ "net.if.discovery", "{\"{#NET_IF}\": \"#{interface}\"}" ]
end