Sha256: 3223338bdfb7d494ea13fe47314dbf3117ffaa78ba6af787afa0f095d6ab1c26
Contents?: true
Size: 903 Bytes
Versions: 1
Compression:
Stored size: 903 Bytes
Contents
class ZabbixRubyClient class Data def initialize(host) @discover = {} @items = [] @host = host end def run_plugin(plugin, args = nil) Plugins.load(plugin) || logger.error( "Plugin #{plugin} not found.") if Plugins.loaded[plugin] begin @items += Plugins.loaded[plugin].send(:collect, @host, *args) if Plugins.loaded[plugin].respond_to?(:discover) key, value = Plugins.loaded[plugin].send(:discover, *args) @discover[key] ||= [] @discover[key] << [ value ] end rescue Exception => e logger.fatal "Oops" logger.fatal e.message end end end def merge time = Time.now.to_i @discover.reduce([]) do |a,(k,v)| a << "#{@host} #{k} #{time} { \"data\": [ #{v.join(', ')} ] }" a end + @items end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
zabbix-ruby-client-0.0.15 | lib/zabbix-ruby-client/data.rb |