1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-16 22:50:10 +03:00

Fix VmSample monitoring

This commit is contained in:
Daniel Molina 2011-07-12 19:26:36 +02:00
parent 3a7f18c912
commit afbd66e72e
2 changed files with 10 additions and 6 deletions

View File

@ -94,7 +94,7 @@ module OneWatchClient
end
a = Array.new
resources.group_and_count(:timestamp).collect { |row|
resources.group_and_count(:timestamp).all.each { |row|
a << [row[:timestamp], row[:count].to_i]
}

View File

@ -341,12 +341,14 @@ module WatchHelper
end
def self.flush
VmDelta.multi_insert(@@deltas_cache)
VmSample.multi_insert(@@samples_cache)
DB.transaction do
VmDelta.multi_insert(@@deltas_cache)
VmSample.multi_insert(@@samples_cache)
end
Vm.each { |vm|
if vm.samples.count > @@vm_window_size
vm.samples.last.delete
vm.samples.first.destroy
end
}
@ -395,11 +397,13 @@ module WatchHelper
end
def self.flush
HostSample.multi_insert(@@samples_cache)
DB.transaction do
HostSample.multi_insert(@@samples_cache)
end
Host.all.each { |host|
if host.samples.count > @@host_window_size
host.samples.first.delete
host.samples.first.destroy
end
}