[rrd-users] python rrdtool error -?
Tobias Oetiker
tobi at oetiker.ch
Sat Apr 3 08:57:37 CEST 2010
Hi Gregor,
Yesterday Gregory Guthrie wrote:
> Very helpful, many thanks!!
>
> It now runs, but gives no output, although the same (I think) thing run as a command gives output.
> I'm not asking you to debug my program but if I am missing something obvious, I am stuck!
>
> # Dump values for March-April 2010.
> start = int( time.mktime( (2010,3,1, 0,0,0, 0,0, -1) ) )
> end = int( time.mktime( (2010,4,10, 0,0,0, 0,0, -1) ) )
> print "Dump from:", start, end
> # works, full output.
> os.system('rrdtool fetch ' + data("temp") + \
> " AVERAGE" + " --start " + str(start) \
> + " --end " + str(end) )
> # no error, but no output.
> rrdtool.fetch( data("temp"),
> "AVERAGE", "--start", str(start),
> "--end", str(end) )
fetch 'returns' a nested data structure with the result ...
r = rrdtool.fetch( data("temp"),
"AVERAGE", "--start", str(start),
"--end", str(end) )
r contains
((start, end, step), (name1, name2, ...), [(data1, data2, ..), ...])
chers
tobi
>
> Computer Science Department
> School of Computer Science & Mathematics
> Maharishi University of Management
> -------------------------------------------
>
>
> > -----Original Message-----
> > From: Tobias Oetiker [mailto:tobi at oetiker.ch]
> > Sent: Friday, April 02, 2010 5:54 PM
> > To: Gregory Guthrie
> > Cc: rrd-users at lists.oetiker.ch
> > Subject: Re: [rrd-users] python rrdtool error -?
> >
> > Hi Gregory,
> >
> > try
> >
> > Yesterday Gregory Guthrie wrote:
> >
> > > The following python program fails, but the equivalent command line usage works fine, and in
> > fact invoking the command line from the program also works.
> > >
> > > I can't see what is wrong with the python API usage of fetch() below.
> > >
> > > start = int( time.mktime( (2010,3,1, 0,0,0, 0,0, -1) ) )
> > > end = int( time.mktime( (2010,4,10, 0,0,0, 0,0, -1) ) )
> > > print "Dump from:", start, end
> > > os.system('rrdtool fetch ' + data("temp") + \
> > > " AVERAGE" + " --start " + str(start) \
> > > + " --end " + str(end) ) # works
> > > rrdtool.fetch( data("temp"),
> > > "AVERAGE", "--start ", str(start),
> > > "--end ", str(end) ) # fails - error below
> > rrdtool.fetch( data("temp"),
> > "AVERAGE", "--start", str(start),
> > "--end", str(end) ) # fails - error below
> >
> >
> > note the options have NO spaces at the end ...
> >
> > cheers
> > tobi
> >
> >
> > --
> > Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
> > http://it.oetiker.ch tobi at oetiker.ch ++41 62 775 9902 / sb: -9900
>
>
--
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
http://it.oetiker.ch tobi at oetiker.ch ++41 62 775 9902 / sb: -9900
More information about the rrd-users
mailing list