Sha256: 4906656f922c2b1d5a85c74768183cdc7e493d7daeee87520f4c4cfaea04995d
Contents?: true
Size: 502 Bytes
Versions: 1
Compression:
Stored size: 502 Bytes
Contents
class MPstat include RunCommand command :mpstat, :interval => 5, :times => 2 def command_line_opts "#{options[:interval]} #{options[:times]}" end def data command_output.split("\n").map {|line| line.split("\s") }.inject([]) do |output,line| if line[1] == "CPU" headers = line.map {|hdr| hdr.gsub(/%/,'').to_sym} next end next unless headers pkt = {} line.each_with_index do |itm,idx| pkt[headers[idx]] = itm end output << pkt output end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
city-watch-0.3.0 | lib/city_watch/commands/mpstat.rb |