lib/zabbix-ruby-client/plugins/cpu.rb in zabbix-ruby-client-0.0.15 vs lib/zabbix-ruby-client/plugins/cpu.rb in zabbix-ruby-client-0.0.16
- old
+ new
@@ -1,21 +1,21 @@
# for more info check
# http://www.linuxhowtos.org/System/procstat.htm
# http://juliano.info/en/Blog:Memory_Leak/Understanding_the_Linux_load_average
+require "zabbix-ruby-client/logger"
-class ZabbixRubyClient
+module ZabbixRubyClient
module Plugins
module Cpu
extend self
def collect(*args)
host = args[0]
- #cpuinfo = `mpstat | grep " all "`
cpuinfo = `cat /proc/stat | grep "^cpu"`
if $?.to_i == 0
_, user, nice, sys, idle, wait, irq, soft, guest, steal = cpuinfo.split(/\s+/).map(&:to_i)
else
- logger.warn "Oh you don't have a /proc ?"
+ Log.warn "Oh you don't have a /proc ?"
return []
end
used = user + nice + sys
total = used + idle