[rrd-users] rrdtool.update() in Python-HELP
Yiannis Vavouranakis
yiannis at vavouranakis.gr
Thu Jun 26 00:13:47 CEST 2008
Update on the python-rrdtool issue:
It seems that my version (at least) of the python bindings requires that ALL
arguments are strings. So this
<snip>
rrdtool.update('test.rrd', 920804700:12345, 920805000:12357,
920805300:12363)
</snip>
Will not work (for a number of reasons, one being that ":" signifies
name-value pairs in dictionaries). Instead, this
<snip>
rrdtool.update('test.rrd', '920804700:12345', '920805000:12357',
'920805300:12363')
</snip>
Will work like a charm. So taking the script you posted, and turning
everything into strings, I get a working script (I also deleted that extra
indent I was talking about):
<snip>
import rrdtool, os, time
rrdtool.create('test.rrd','--start', '920804400',
'DS:speed:COUNTER:600:U:U',
'RRA:AVERAGE:0.5:1:24',
'RRA:AVERAGE:0.5:6:10')
rrdtool.update('test.rrd', '920804700:12345',
'920805000:12357', '920805300:12363')
rrdtool.update('test.rrd', '920805600:12363',
'920805900:12363', '920806200:12373')
rrdtool.update('test.rrd', '920806500:12383',
'920806800:12393', '920807100:12399')
rrdtool.update('test.rrd', '920807400:12405',
'920807700:12411', '920808000:12415')
rrdtool.update('test.rrd', '920808300:12420',
'920808600:12422', '920808900:12423')
rrdtool.graph('test.png','--start', '920804400',
'--end', '920808000',
'DEF:myspeed=test.rrd:speed:AVERAGE',
'LINE2:myspeed#FF0000')
</snip>
This produced a pretty nice step graph on my machine. As a sidenote, I kept
all your imports, although you're not using anything from os or time
anywhere in the script you posted.
Hope that helped.
Yiannis Vavouranakis
More information about the rrd-users
mailing list