lib/zabbix-ruby-client/data.rb in zabbix-ruby-client-0.0.17 vs lib/zabbix-ruby-client/data.rb in zabbix-ruby-client-0.0.18

- old
+ new

@@ -9,21 +9,23 @@ @items = [] @host = host end def run_plugin(plugin, args = nil) - Plugins.load(plugin) || logger.error( "Plugin #{plugin} not found.") + Plugins.load(plugin) || ZabbixRubyClient::Log.error( "Plugin #{plugin} not found.") if Plugins.loaded[plugin] begin - @items += Plugins.loaded[plugin].send(:collect, @host, *args) + if Plugins.loaded[plugin].respond_to?(:collect) + @items += Plugins.loaded[plugin].send(:collect, @host, *args) + end if Plugins.loaded[plugin].respond_to?(:discover) key, value = Plugins.loaded[plugin].send(:discover, *args) @discover[key] ||= [] @discover[key] << [ value ] end rescue Exception => e - Log.fatal "Oops" - Log.fatal e.message + ZabbixRubyClient::Log.fatal "Oops" + ZabbixRubyClient::Log.fatal e.message end end end def merge