[rrd-developers] create-update-fetch
Oxana Lazareva
obratukhina at sitronics.com
Wed Mar 23 07:34:17 CET 2011
Hello!
I'm learning RRDTool,
I created this trivial example (by Python),
but I have a problem.
I created 'target.rrd', I put 10 value in this rrd, but then I'm doing 'fetch' I'm getting only 9 value. Why?
#!/usr/bin/env python
import Globals
from Products.ZenUtils.ZenScriptBase import ZenScriptBase
from transaction import commit
dmd = ZenScriptBase(connect=True, noopts=True).dmd
from Products.ZenUtils import Time
import re
import sys
import rrdtool, tempfile
import time
import inspect
from optparse import OptionParser
import random
parser = OptionParser()
ret = rrdtool.create ('target.rrd',
'--start', '1300665600',
'--step', '60',
'DS:mem: GAUGE:600:0:671744',
'DS:mem1:GAUGE:600:0:671744',
'RRA:AVERAGE:0.5:1:600',
'RRA:AVERAGE:0.5:5:700')
print ret
if ret:
print rrdtool.error()
n = 1300888800
l = 0
input = 0
output = 0
while l < 10:
input = random.randrange(1000,1500)
output += random.randrange(1000, 1500)
ret=rrdtool.update('target.rrd',str(n) + ':' + str(input) + ':' + str (output));
print str(input) + '; ' + str(output)
if ret:
print rrdtool.error()
l = l + 1
n = n + 300
info = rrdtool.info('target.rrd')
print info['last_update']
print info ['ds[mem].minimal_heartbeat']
print rrdtool.fetch ('target.rrd', 'AVERAGE',
'--resolution', '1',
'--start', '1300795600',
'--end', '1300924800')
RESULTS:
(None, None)
(None, None)
(1195.0, 2093.0)
(1252.0, 3244.0)
(1181.0, 4720.0)
(1084.0, 5914.0)
(1065.0, 7007.0)
(1359.0, 8499.0)
(1045.0, 9538.0)
(1045.0, 10793.0)
(1170.0, 11795.0)
(None, None)
(None, None)
Oxana Lazareva
SITRONICS Telecom Solutions, Czech Republic a. s.
Ohradní 1369/8
140 00 Praha 4, Czech Republic
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.oetiker.ch/pipermail/rrd-developers/attachments/20110323/d4edcb23/attachment.htm
More information about the rrd-developers
mailing list