Sha256: ab5ceb8461fc3ba5e2a6caa6ac1803443f78d84859a66ad481ad1b7f9c1f3e05

Contents?: true

Size: 1.19 KB

Versions: 10

Compression:

Stored size: 1.19 KB

Contents

require "zabbix-ruby-client/logger"

module ZabbixRubyClient
  module Plugins
    module Sysinfo
      extend self

      def collect(*args)
        host = args.delete_at(0)
        uname = `uname -a`
        if $?.to_i == 0
          arch, hostname, kernel, kernel_version, machine, proc,
          _, _, _, _, _, _, _, platform, os = uname.split(/ /)
        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}"
        back << "#{host} sysinfo[kernel_version] #{time} #{kernel_version}"
        back << "#{host} sysinfo[machine] #{time} #{machine}"
        back << "#{host} sysinfo[platform] #{time} #{platform}"
        back << "#{host} sysinfo[os] #{time} #{os}"
        Hash[*args].each do |k,v|
          back << "#{host} sysinfo[#{k}] #{time} #{v}"
        end
        return back
      end

    end
  end
end

ZabbixRubyClient::Plugins.register('sysinfo', ZabbixRubyClient::Plugins::Sysinfo)

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
zabbix-ruby-client-0.1.1 lib/zabbix-ruby-client/plugins/sysinfo.rb
zabbix-ruby-client-0.1.0 lib/zabbix-ruby-client/plugins/sysinfo.rb
zabbix-ruby-client-0.0.23 lib/zabbix-ruby-client/plugins/sysinfo.rb
zabbix-ruby-client-0.0.22 lib/zabbix-ruby-client/plugins/sysinfo.rb
zabbix-ruby-client-0.0.21 lib/zabbix-ruby-client/plugins/sysinfo.rb
zabbix-ruby-client-0.0.20 lib/zabbix-ruby-client/plugins/sysinfo.rb
zabbix-ruby-client-0.0.19 lib/zabbix-ruby-client/plugins/sysinfo.rb
zabbix-ruby-client-0.0.18 lib/zabbix-ruby-client/plugins/sysinfo.rb
zabbix-ruby-client-0.0.17 lib/zabbix-ruby-client/plugins/sysinfo.rb
zabbix-ruby-client-0.0.16 lib/zabbix-ruby-client/plugins/sysinfo.rb