create-update-fetch
Oxana Lazareva <[email protected]>
| Newsgroups | gmane.comp.db.rrdtool.devel |
|---|---|
| Message-ID | <799F415D4CB0FA4B8A87AA115E8FCE701D43346313@STS-PRG-EXM1M1.sts.sitronics.com> |
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
_______________________________________________
rrd-developers mailing list
[email protected]
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-developers