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

feature #696: use configuration file for window size and db uri

This commit is contained in:
Jaime Melis 2011-07-06 19:01:02 +02:00
parent 3fe28c5dd2
commit bc3f69c3d0
2 changed files with 26 additions and 8 deletions

View File

@ -14,14 +14,20 @@
# limitations under the License. #
#--------------------------------------------------------------------------- #
# Duration of each daemon loop in seconds
:STEP: 1
# Database URI
:DB: sqlite:///tmp/test_one_acct.db
# Duration of each daemon loop in seconds
:STEP: 2
# Number of daemon loops until an accounting watch
:ACCOUNTING_STEPS: 1
# Number of daemon loops until a monitiroing watch
:MONITORING_STEPS: 1
# Number of daemon loops until a VM monitoring watch
:VM_MONITORING_STEPS: 1
# Number of daemon loops until a Hosts monitoring watch
:HOST_MONITORING_STEPS: 1
# Number of records to preserve
:WINDOW_SIZE: 5
:WINDOW_SIZE: 10

View File

@ -1,5 +1,17 @@
module WatchHelper
DB = Sequel.connect('sqlite:///tmp/test_one_acct.db')
require 'yaml'
ONE_LOCATION=ENV["ONE_LOCATION"]
if !ONE_LOCATION
ACCTD_CONF="/etc/one/acctd.conf"
else
ACCTD_CONF=ONE_LOCATION+"/etc/acctd.conf"
end
CONF = YAML.load_file(ACCTD_CONF)
DB = Sequel.connect(CONF[:DB])
VM_SAMPLE = {
:cpu => {
@ -275,7 +287,7 @@ module WatchHelper
private
def control_regs(sample)
if self.samples.count > 4
if self.samples.count > CONF[:WINDOW_SIZE] - 1
self.samples.first.delete
end
end
@ -316,7 +328,7 @@ module WatchHelper
private
def control_regs(sample)
if self.samples.count > 4
if self.samples.count > CONF[:WINDOW_SIZE] - 1
self.samples.first.delete
end
end