mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-25 02:50:08 +03:00
fixed bug in IM polling
This commit is contained in:
parent
a0b3eec6ee
commit
60c02d5de2
@ -16,6 +16,11 @@
|
||||
# limitations under the License. #
|
||||
#--------------------------------------------------------------------------- #
|
||||
|
||||
def print_info(name, value)
|
||||
value = "0" if value.nil? or value.to_s.empty?
|
||||
puts "#{name}=#{value}"
|
||||
end
|
||||
|
||||
######
|
||||
# First, get all the posible info out of virsh
|
||||
# TODO : use virsh freecell when available
|
||||
@ -78,18 +83,18 @@ net_text.split(/\n/).each{|line|
|
||||
end
|
||||
}
|
||||
|
||||
puts "HYPERVISOR=kvm"
|
||||
print_info("HYPERVISOR","kvm")
|
||||
|
||||
puts "TOTALCPU=#{$total_cpu}"
|
||||
puts "CPUSPEED=#{$cpu_speed}"
|
||||
print_info("TOTALCPU",$total_cpu)
|
||||
print_info("CPUSPEED",$cpu_speed)
|
||||
|
||||
puts "TOTALMEMORY=#{$total_memory}"
|
||||
puts "USEDMEMORY=#{$used_memory}"
|
||||
puts "FREEMEMORY=#{$free_memory}"
|
||||
print_info("TOTALMEMORY",$total_memory)
|
||||
print_info("USEDMEMORY",$used_memory)
|
||||
print_info("FREEMEMORY",$free_memory)
|
||||
|
||||
puts "FREECPU=#{$free_cpu}"
|
||||
puts "USEDCPU=#{$used_cpu}"
|
||||
print_info("FREECPU",$free_cpu)
|
||||
print_info("USEDCPU",$used_cpu)
|
||||
|
||||
puts "NETRX=#{$netrx}"
|
||||
puts "NETTX=#{$nettx}"
|
||||
print_info("NETRX",$netrx)
|
||||
print_info("NETTX",$nettx)
|
||||
|
||||
|
@ -21,6 +21,11 @@ require "pp"
|
||||
XENTOP_PATH="/usr/sbin/xentop"
|
||||
XM_PATH="/usr/sbin/xm"
|
||||
|
||||
def print_info(name, value)
|
||||
value = "0" if value.nil? or value.to_s.empty?
|
||||
puts "#{name}=#{value}"
|
||||
end
|
||||
|
||||
xentop_text=`sudo #{XENTOP_PATH} -bi2`
|
||||
xm_text=`sudo #{XM_PATH} info`
|
||||
|
||||
@ -85,13 +90,13 @@ domains_info.each {|line|
|
||||
|
||||
# WRITE INFO
|
||||
|
||||
puts "HYPERVISOR=xen"
|
||||
puts "TOTALCPU=" + cpu_info[:total].round.to_s
|
||||
puts "CPUSPEED=" + cpu_info[:speed]
|
||||
puts "TOTALMEMORY=" + memory_info[:total].to_s
|
||||
puts "FREEMEMORY=" + memory_info[:free].to_s
|
||||
puts "USEDMEMORY=" + memory_info[:used].to_s
|
||||
puts "USEDCPU=" + vm_info[:cpu].round.to_s
|
||||
puts "FREECPU=" + (cpu_info[:total]-vm_info[:cpu]).round.to_s
|
||||
puts "NETTX=" + vm_info[:nettx].to_s
|
||||
puts "NETRX=" + vm_info[:netrx].to_s
|
||||
print_info("HYPERVISOR","xen")
|
||||
print_info("TOTALCPU",cpu_info[:total].round.to_s)
|
||||
print_info("CPUSPEED",cpu_info[:speed])
|
||||
print_info("TOTALMEMORY",memory_info[:total].to_s)
|
||||
print_info("FREEMEMORY",memory_info[:free].to_s)
|
||||
print_info("USEDMEMORY",memory_info[:used].to_s)
|
||||
print_info("USEDCPU",vm_info[:cpu].round.to_s)
|
||||
print_info("FREECPU",(cpu_info[:total]-vm_info[:cpu]).round.to_s)
|
||||
print_info("NETTX",vm_info[:nettx].to_s)
|
||||
print_info("NETRX",vm_info[:netrx].to_s)
|
||||
|
Loading…
x
Reference in New Issue
Block a user