lib/zabbix-ruby-client/runner.rb in zabbix-ruby-client-0.1.2 vs lib/zabbix-ruby-client/runner.rb in zabbix-ruby-client-0.1.3
- old
+ new
@@ -22,10 +22,11 @@
@logsdir = makedir(@config['logsdir'], 'logs')
ZabbixRubyClient::Plugins.scan_dirs([ PLUGINDIR ] + @config['plugindirs'])
ZabbixRubyClient::Log.set_logger(File.join(@logsdir, 'zrc.log'), @config['loglevel'])
ZabbixRubyClient::Log.debug @config.inspect
@is_22 = /v2\.[24]\./.match zabbix_sender_version
+ @is_30 = /3\.[024]\./.match zabbix_sender_version
ZabbixRubyClient::Log.debug "zabbix sender version #{zabbix_sender_version}"
end
def collect
@tasks.each do |plugin|
@@ -43,10 +44,10 @@
file = @store.record(@data.merge)
command = "#{@config['zabbix']['sender']} -z #{@config['zabbix']['host']} -p #{@config['zabbix']['port']} -T -i #{file}"
ZabbixRubyClient::Log.debug command
begin
res = `#{command}`
- if @is_22
+ if @is_22 || @is_30
case $?.to_i
when 0
ZabbixRubyClient::Log.debug "zabbix-sender: Data Sent (#{$?})"
when 1
@store.keepdata(file)