lib/logstash/outputs/zabbix.rb in logstash-output-zabbix-1.0.0 vs lib/logstash/outputs/zabbix.rb in logstash-output-zabbix-2.0.0

- old
+ new

@@ -172,12 +172,12 @@ :returned_data => data ) return false end # Prune the semicolons, then turn it into an array - info = (data["info"].delete! ';').split() - # ["processed", "0", "Failed", ";", "Total", "1", "seconds", "spent:", "0.000018"] + info = data["info"].tr(';', '').split() + # ["processed", "0", "Failed", "1", "Total", "1", "seconds", "spent:", "0.000018"] failed = info[3].to_i total = info[5].to_i if failed == total @logger.warn("Zabbix server at #{@zabbix_server_host} rejected all items sent.", :zabbix_host => event[@zabbix_host] @@ -206,11 +206,11 @@ # Log whether the key/value pairs accepted info_check(event, resp) # Did the message get received by Zabbix? response_check(event, resp) end - rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH + rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH, Errno::ECONNRESET @logger.error("Connection error. Unable to connect to Zabbix server", :server => @zabbix_server_host, :port => @zabbix_server_port.to_s ) false @@ -232,10 +232,10 @@ end end public def receive(event) - return unless output?(event) + return unless field_check(event, @zabbix_host) send_to_zabbix(event) end # def event end # class LogStash::Outputs::Zabbix