Sha256: 477e8ca2d425a85693679fec2e952049906b41e8e40222805a56ae014c934013
Contents?: true
Size: 920 Bytes
Versions: 2
Compression:
Stored size: 920 Bytes
Contents
class ZabbixRubyClient module Plugins module Cpu extend self def collect(*args) host = args[0] cpuinfo = `mpstat | grep " all "` if $?.to_i == 0 _, _, _, user, nice, sys, wait, irq, soft, steal, guest, idle = cpuinfo.split(/\s+/) else logger.warn "Please install sysstat." return [] end back = [] back << "#{host} cpu[user] #{user}" back << "#{host} cpu[nice] #{nice}" back << "#{host} cpu[system] #{sys}" back << "#{host} cpu[iowait] #{wait}" back << "#{host} cpu[irq] #{irq}" back << "#{host} cpu[soft] #{soft}" back << "#{host} cpu[steal] #{steal}" back << "#{host} cpu[guest] #{guest}" back << "#{host} cpu[idle] #{idle}" return back end end end end ZabbixRubyClient::Plugins.register('cpu', ZabbixRubyClient::Plugins::Cpu)
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
zabbix-ruby-client-0.0.5 | lib/zabbix-ruby-client/plugins/cpu.rb |
zabbix-ruby-client-0.0.4 | lib/zabbix-ruby-client/plugins/cpu.rb |