summaryrefslogtreecommitdiff
path: root/jarmonbuild
diff options
context:
space:
mode:
authorRichard Wall <richard@largo>2010-08-30 13:16:19 +0100
committerRichard Wall <richard@largo>2010-08-30 13:16:19 +0100
commit4b7ed618664c5404c390f8e6ef8c106189eaf44c (patch)
tree5e48fb553d2d9e8a59d0b936d171d5aa0437bdb4 /jarmonbuild
parent877f4724204f0d68f44116ef21b8425813c8285d (diff)
more realistic rrd step sizes and data
Diffstat (limited to 'jarmonbuild')
-rw-r--r--jarmonbuild/commands.py21
1 files changed, 15 insertions, 6 deletions
diff --git a/jarmonbuild/commands.py b/jarmonbuild/commands.py
index 48e679b..5823042 100644
--- a/jarmonbuild/commands.py
+++ b/jarmonbuild/commands.py
@@ -10,6 +10,7 @@ import shutil
import sys
import time
+from datetime import datetime
from optparse import OptionParser
from subprocess import check_call, PIPE
from tempfile import gettempdir
@@ -229,18 +230,26 @@ class BuildTestDataCommand(BuildCommand):
rras = []
filename = os.path.join(self.build_dir, 'test.rrd')
- rows = 10
+ rows = 6
+ step = 10
- dss.append(DataSource(dsName='speed', dsType='GAUGE', heartbeat=1))
+ dss.append(DataSource(dsName='speed', dsType='GAUGE', heartbeat=2*step))
rras.append(RRA(cf='AVERAGE', xff=0.5, steps=1, rows=rows))
- my_rrd = RRD(filename, ds=dss, rra=rras, start=start, step=1)
+ my_rrd = RRD(filename, ds=dss, rra=rras, start=start, step=step)
my_rrd.create()
- for i, t in enumerate(range(start, start+rows, 1)):
- my_rrd.bufferValue(t+1, i)
+ for i, t in enumerate(range(start+step, start+step+(rows*step), step)):
+ self.log.debug('DATA: %s %s (%s)' % (t, i, datetime.fromtimestamp(t)))
+ my_rrd.bufferValue(t, i)
- my_rrd.update()
+ # Add further data 1 second later to demonstrate that the rrd
+ # lastupdatetime does not necessarily fall on a step boundary
+ t += 1
+ i += 1
+ self.log.debug('DATA: %s %s (%s)' % (t, i, datetime.fromtimestamp(t)))
+ my_rrd.bufferValue(t, i)
+ my_rrd.update()
# The available subcommands