mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-16 09:43:18 +09:00
bug #388: Now kvm probe gets correct memory information
(cherry picked from commit bb922c51c7)
This commit is contained in:
1 parent
4b2265c9fc
commit
2f3efae538
1 file changed
+7
-12
@@ -51,15 +51,7 @@ exit(-1) if $?!=0
|
||||
top_text.gsub!(/^top.*^top.*?$/m, "") # Strip first top output
|
||||
|
||||
top_text.split(/\n/).each{|line|
|
||||
if line.match('^Mem')
|
||||
line[4..-1].split(",").each{|elemento|
|
||||
temp = elemento.strip.split("k ")
|
||||
if temp[1] == "used"
|
||||
$used_memory = temp[0]
|
||||
end
|
||||
}
|
||||
|
||||
elsif line.match('^Cpu')
|
||||
if line.match('^Cpu')
|
||||
line[7..-1].split(",").each{|elemento|
|
||||
temp = elemento.strip.split("%")
|
||||
if temp[1]=="id"
|
||||
@@ -73,8 +65,12 @@ top_text.split(/\n/).each{|line|
|
||||
end
|
||||
}
|
||||
|
||||
$free_memory=`free -k|grep "buffers\/cache"|awk '{print $4}'`
|
||||
|
||||
$total_memory = `free -k|grep "Mem:" | awk '{print $2}'`
|
||||
tmp=`free -k|grep "buffers\/cache"|awk '{print $3 " " $4}'`.split
|
||||
|
||||
$used_memory=tmp[0]
|
||||
$free_memory=tmp[1]
|
||||
|
||||
net_text=`cat /proc/net/dev`
|
||||
exit(-1) if $?!=0
|
||||
|
||||
@@ -101,4 +97,3 @@ print_info("USEDCPU",$used_cpu)
|
||||
|
||||
print_info("NETRX",$netrx)
|
||||
print_info("NETTX",$nettx)
|
||||
|
||||
Reference in new issue
Block a user