[rrd-users] [rrd-developers] RRDTOOL xport issue whereas RRDTOOL fetch is fine

Tobias Oetiker tobi at oetiker.ch
Mon Jan 11 09:08:38 CET 2010


Hi Swami,

Friday swami wrote:

> Hi Tobi,
>                I tried with 1.3.9 and 1.4.2 and the issue is still seen as shown below in the snapshot (rrdtool xport not returning rows whereas rrdtool fetch returns a row).
>
> One more thing to observe is that the ouput of rrdtool fetch below shows just one record with the time as 1262886600 which is not in the range of time given in the command.
> When i execute rrd_fetch from php with the same parameters used as in the command below, i get the ret['start'] as 1262886000 which is correct .
>
[...]
> [root at dev006 build_1.4.2]# /usr/local/third-party/rrd/bin/rrdtool xport --step 3 -s 1262886000 -e 1262886120 DEF:aval=/var/stats/rrd_data/service_class_data/service_class_TESTSC04.rrd:AccelTrafficBytesIn:AVERAGE DEF:bval=/var/stats/rrd_data/service_class_data/service_class_TESTSC04.rrd:BytesOut:AVERAGE DEF:cval=/var/stats/rrd_data/service_class_data/service_class_TESTSC04.rrd:GoodPutBytesIn:AVERAGE DEF:dval=/var/stats/rrd_data/service_class_data/service_class_TESTSC04.rrd:GoodPutBytesOut:AVERAGE CDEF:a=aval,UN,0,aval,IF,8,* CDEF:b=bval,UN,0,bval,IF,8,* CDEF:c=cval,UN,0,cval,IF,8,* CDEF:d=dval,UN,0,dval,IF,8,* CDEF:dr1=d,100,*,a,/ CDEF:dr=100,dr1,- CDEF:ci=a,d,/ CDEF:civ=ci,UN,1,ci,IF CDEF:cival=civ,1,MAX XPORT:dr XPORT:cival XPORT:a XPORT:b XPORT:c XPORT:d
> <?xml version="1.0" encoding="ISO-8859-1"?>
>
> <xport>
>   <meta>
>     <start>1262886600</start>
>     <step>600</step>
>     <end>1262886000</end>
>     <rows>0</rows>
>     <columns>6</columns>
>     <legend>
>       <entry></entry>
>       <entry></entry>
>       <entry></entry>
>       <entry></entry>
>       <entry></entry>
>       <entry></entry>
>     </legend>
>   </meta>
>   <data>
>   </data>
> </xport>

ah ... I see what you are getting at ... the end is being adjusted
down and not up ... try this patch

Index: rrd_xport.c
===================================================================
--- rrd_xport.c (revision 1993)
+++ rrd_xport.c (working copy)
@@ -286,7 +286,7 @@
     free(step_list);

     *start =  im->start - im->start % (*step);
-    *end = im->end - im->end % (*step);
+    *end = im->end - im->end % (*step) + (*step);


     /* room for rearranged data */


> [root at dev006 build_1.4.2]# /usr/local/third-party/rrd/bin/rrdtool fetch /var/stats/rrd_data/service_class_data/service_class_TESTSC04.rrd AVERAGE -r 3 -s 1262886000 -e 1262886180
>             AccelTrafficBytesIn PThruTrafficBytesIn     GoodPutBytesOut      GoodPutBytesIn     WanPThruBytesIn            BytesOut
>
> 1262886600: 4.3554497354e+02 0.0000000000e+00 1.6151587302e+02 5.8164285714e+02 0.0000000000e+00 5.6100264550e+03

this is correct ... note that the timestamp marks THE END of the
interval, not the start hence the numbers returned cover your
requested timespan ... since you are only getting one line it may
be non obvious what the interval is, but then again you are free to
request a little more data from fetch ...

cheer
tobi
> Regards
> swami
> ----- Original Message -----
> From: "Tobias Oetiker" <tobi at oetiker.ch>
> To: "swami" <swami at infineta.com>
> Cc: <rrd-users at lists.oetiker.ch>; <rrd-developers at lists.oetiker.ch>
> Sent: Thursday, January 07, 2010 10:20 PM
> Subject: Re: [rrd-developers] RRDTOOL xport issue whereas RRDTOOL fetch is fine
>
>
> > Hi Swami,
> >
> >
> > Yesterday swami wrote:
> >
> >> Hi All,
> >>          I am finding this issue of rrd xport not returning rows whereas the rrd fetch is returning rows with the same parameters.
> >> Would be great if any of you could help me or have faced this issue.I am using rrdtool version 1.3.6.
> >>
> >> Below is the snapshot of the commands executed and their result .
> >>
> >> RRDTOOL FETCH: returns one row as shown below
> >>
> >> [root at dev006 ~]# /usr/local/third-party/rrd/bin/rrdtool fetch /var/stats/rrd_data/service_class_data/service_class_TESTSC04.rrd AVERAGE -r 3 -s 1262886000 -e 1262886180
> >>             AccelTrafficBytesIn PThruTrafficBytesIn     GoodPutBytesOut      GoodPutBytesIn     WanPThruBytesIn            BytesOut
> >>
> >> 1262886600: 4.3554497354e+02 0.0000000000e+00 1.6151587302e+02 5.8164285714e+02 0.0000000000e+00 5.6100264550e+03
> >>
> >> RRDTOOL XPORT  : things to observe
> >> 1)  in the result , step is 600 eventhough step is set to 3 in the command
> >> 2) start and end time in the result are not the same as in the command
> >> 3) no rows are returned.
> >>
> >> [root at dev006 ~]# /usr/local/third-party/rrd/bin/rrdtool xport --step 3 -s 1262886000 -e 1262886180 DEF:aval=/var/stats/rrd_data/service_class_data/service_class_TESTSC04.rrd:AccelTrafficBytesIn:AVERAGE DEF:bval=/var/stats/rrd_data/service_class_data/service_class_TESTSC04.rrd:BytesOut:AVERAGE DEF:cval=/var/stats/rrd_data/service_class_data/service_class_TESTSC04.rrd:GoodPutBytesIn:AVERAGE DEF:dval=/var/stats/rrd_data/service_class_data/service_class_TESTSC04.rrd:GoodPutBytesOut:AVERAGE CDEF:a=aval,UN,0,aval,IF,8,* CDEF:b=bval,UN,0,bval,IF,8,* CDEF:c=cval,UN,0,cval,IF,8,* CDEF:d=dval,UN,0,dval,IF,8,* CDEF:dr1=d,100,*,a,/ CDEF:dr=100,dr1,- CDEF:ci=a,d,/ CDEF:civ=ci,UN,1,ci,IF CDEF:cival=civ,1,MAX XPORT:dr XPORT:cival XPORT:a XPORT:b XPORT:c XPORT:d
> >> <?xml version="1.0" encoding="ISO-8859-1"?>
> >>
> >> <xport>
> >>   <meta>
> >>     <start>1262886600</start>
> >>     <step>600</step>
> >>     <end>1262886000</end>
> >>     <rows>0</rows>
> >>     <columns>6</columns>
> >>     <legend>
> >>       <entry></entry>
> >>       <entry></entry>
> >>       <entry></entry>
> >>       <entry></entry>
> >>       <entry></entry>
> >>       <entry></entry>
> >>     </legend>
> >>   </meta>
> >>   <data>
> >>   </data>
> >> </xport>
> >
> > there were a number of issues fixed in xport recently. please try
> > with the latest 1.3.x or 1.4.x version of rrdtool
> >
> > 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