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:
parent
3a7f18c912
commit
afbd66e72e
@ -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]
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user