1
0
mirror of https://github.com/OpenNebula/one.git synced 2024-12-24 21:34:01 +03:00

bug #1023: fix host cpu retrieval for procps-ng

This commit is contained in:
Javi Fontan 2011-12-22 16:54:54 +01:00
parent 40a654411e
commit 14579991f1

View File

@ -51,9 +51,9 @@ exit(-1) if $?.exitstatus != 0
top_text.gsub!(/^top.*^top.*?$/m, "") # Strip first top output
top_text.split(/\n/).each{|line|
if line.match('^Cpu')
if line.match('^%?Cpu')
line[7..-1].split(",").each{|elemento|
temp = elemento.strip.split("%")
temp = elemento.strip.split(/[% ]/)
if temp[1]=="id"
idle = temp[0]
$free_cpu = idle.to_f * $total_cpu.to_f / 100