Fix VmSample monitoring

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

No files matched your search

+1 -1
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]
}
+9 -5
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
}