[rrd-users] rrdtool.update() in Python

Emily Chouinard cousin17 at msu.edu
Thu Jun 26 17:18:45 CEST 2008


Thanks, I got it all figured out now, just trying to apply these ideas 
to my project!

Korthrun wrote:
> On Tue, Jun 24, 2008 at 11:33 AM, Emily Chouinard <cousin17 at msu.edu> wrote:
>   
>> So I've been working  on the python binding for rrdtool and after
>> encountering some problems I went back to the basics, and used the
>> example given in the tutorial to try to find what's wrong.
>>
>> I've followed the step by step directions in Alex van den Bogaerdt's
>> RRDtool tutorial in the speed example and have translated it into python
>> but the rrdtool.update command is giving my some slack. I followed the
>> example but python gives me syntax errors that I can't resolve. If
>> anyone familiar with the rrdtool python binding could give a clue as to
>> what's going on I would really appreciate it.  Here's my code, I cut and
>> pasted it from the website, but I get this error when I run the code
>> File "redo.py", line 11
>>    rrdtool.update('test.rrd',920804700:12345)
>>    ^
>> SyntaxError: invalid syntax
>>
>>
>> import rrdtool
>> import os
>> import 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')
>>
>>
>> I really appreciate the help!!
>>
>> _______________________________________________
>> rrd-users mailing list
>> rrd-users at lists.oetiker.ch
>> https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users
>>
>>     
> rrdtool.update('test.rrd', 920804700:12345, 920805000:12357, 920805300:12363)
> With those values unquoted, python is going to try to treat them as
> python directives of some sort.
> If you quote them this script will run fine.
> Well I didn't test the graph part.
> Don't forget to quote what you're passing to --start in your create().
>
> rrdtool.update('test.rrd', '920804700:12345', '920805000:12357',
> '920805300:12363')
>
>
>   



More information about the rrd-users mailing list