Sha256: cb2124d0d5360a3ce4f4d14bae94b385ce29a4d0b701b5d9dbc41ff77514bed1
Contents?: true
Size: 731 Bytes
Versions: 3
Compression:
Stored size: 731 Bytes
Contents
module RorVsWild class Metrics class Cpu attr_reader :user, :system, :idle, :waiting, :stolen attr_reader :load_average, :count def update if vmstat = execute(:vmstat) vmstat = vmstat.split("\n").last.split @user = vmstat[12].to_i @system = vmstat[13].to_i @idle = vmstat[14].to_i @waiting = vmstat[15].to_i @stolen = vmstat[16].to_i end if uptime = execute(:uptime) @load_average = uptime.split[-3].to_f end if nproc = execute(:nproc) @count = nproc.to_i end end def execute(command) `#{command}` rescue => ex nil end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rorvswild-1.5.17 | lib/rorvswild/metrics/cpu.rb |
rorvswild-1.5.16 | lib/rorvswild/metrics/cpu.rb |
rorvswild-1.5.15 | lib/rorvswild/metrics/cpu.rb |