lib/zabbix-ruby-client/plugins/sysinfo.rb in zabbix-ruby-client-0.1.2 vs lib/zabbix-ruby-client/plugins/sysinfo.rb in zabbix-ruby-client-0.1.3

- old
+ new

@@ -2,21 +2,24 @@ module ZabbixRubyClient module Plugins module Sysinfo extend self + extend ZabbixRubyClient::PluginBase def collect(*args) host = args.delete_at(0) uname = `uname -a` - if $?.to_i == 0 + case os + when :linux arch, hostname, kernel, kernel_version, machine, os_debian, - _, platform_debian, _, _, _, _, _, platform, os = uname.split(/ /) + _, platform_debian, _, _, _, _, _, platform, os = uname.split(/\s+/) + when :unix + os, hostname, _, platform, kernel, machine, kernel_version, + _, _, _, _, _, _, _, arch = uname.split(/\s+/) else - Log.warn "Are you running on ubuntu ?" return [] end - time = Time.now.to_i back = [] back << "#{host} sysinfo[name] #{time} #{host}" back << "#{host} sysinfo[arch] #{time} #{arch}" back << "#{host} sysinfo[hostname] #{time} #{hostname}" back << "#{host} sysinfo[kernel] #{time} #{kernel}"