[rrd-users] Re: PREV(v) and COMMENT conflict ?

Tobias Oetiker oetiker at ee.ethz.ch
Sun Nov 17 23:47:34 MET 2002



Nov 6 nasdoma wrote:

Hi Nasdoma,

Thanks for the demo script ... it seems that it is not strictly
depending on the number of commets, but also on the order of things
...

rrdtool graph html/good.png -a PNG -s 1036625900 -e 1036633900 \
COMMENT:"Average value" \
COMMENT:"Average value" \
DEF:t0=test.rrd:test:AVERAGE \
COMMENT:"Last value\j" \
CDEF:a0=PREV\(t0\) \
LINE2:t0#FF0000:data \
LINE2:a0#00FF00:prev \
CDEF:b0=a0,t0,+,2,/ LINE2:b0#0000FF:sum

rrdtool graph html/bad.png -a PNG -s 1036625900 -e 1036633900 \
COMMENT:"Average value" \
COMMENT:"Average value" \
COMMENT:"Last value\j" \
DEF:t0=test.rrd:test:AVERAGE \
CDEF:a0=PREV\(t0\) \
LINE2:t0#FF0000:data \
LINE2:a0#00FF00:prev \
CDEF:b0=a0,t0,+,2,/ LINE2:b0#0000FF:sum


note the position of the first DEF ... I have notyet had the time
to trace this with ddd so I do not have a soluting yet ...

it seems PREV(x) keeps haunting us ...

cheers
tobi

>
> Hi
>
> I've encountered a weird problem with rrdtool graph. I can not use PREV(v)
> and *more than two* COMMENT specifications. Sample script below.... hope all
> lines will stay unwrapped. It will make two images - bad.png and good.png.
> The only difference between them is that bad.png was generated by a rrdtool
> graph with three COMMENT clauses while good.png uses only two COMMENTs. And
> I needed 5 COMMENTs (description/min/avg/max/last) to have a nice picture
> with aligned legend/commens.
>
> ==================================================
> #!/bin/sh
> if [ ! -f test.rrd ]; then
>   # rrd created with : rrdtool create test.rrd DS:test:GAUGE:600:U:U
> RRA:AVERAGE:0.5:1:100
>   rrdtool restore /dev/stdin test.rrd <<END
> <!-- Round Robin Database Dump -->
> <rrd>
>   <version> 0001 </version>
>   <step> 300 </step> <!-- Seconds -->
>   <lastupdate> 1036632900 </lastupdate> <!-- 2002-11-06 17:35:00 PST -->
>
>   <ds>
>     <name> test </name>
>     <type> GAUGE </type>
>     <minimal_heartbeat> 600 </minimal_heartbeat>
>     <min> NaN </min>
>     <max> NaN </max>
>
>     <!-- PDP Status -->
>     <last_ds> UNKN </last_ds>
>     <value> 0.0000000000e+00 </value>
>     <unknown_sec> 0 </unknown_sec>
>   </ds>
>
> <!-- Round Robin Archives -->
>   <rra>
>     <cf> AVERAGE </cf>
>     <pdp_per_row> 1 </pdp_per_row> <!-- 300 seconds -->
>     <xff> 5.0000000000e-01 </xff>
>
>     <cdp_prep>
>       <ds><value> NaN </value>  <unknown_datapoints> 0
> </unknown_datapoints></ds>
>     </cdp_prep>
>     <database>
>       <!-- 2002-11-06 15:55:00 PST / 1036626900 --> <row><v>
> 1.0000000000e+01 </v></row>
>       <!-- 2002-11-06 16:00:00 PST / 1036627200 --> <row><v>
> 1.0000000000e+00 </v></row>
>       <!-- 2002-11-06 16:05:00 PST / 1036627500 --> <row><v>
> 1.0000000000e+01 </v></row>
>       <!-- 2002-11-06 16:10:00 PST / 1036627800 --> <row><v>
> 1.0000000000e+00 </v></row>
>       <!-- 2002-11-06 16:15:00 PST / 1036628100 --> <row><v>
> 1.0000000000e+01 </v></row>
>       <!-- 2002-11-06 16:20:00 PST / 1036628400 --> <row><v>
> 1.0000000000e+00 </v></row>
>       <!-- 2002-11-06 16:25:00 PST / 1036628700 --> <row><v>
> 1.0000000000e+01 </v></row>
>       <!-- 2002-11-06 16:30:00 PST / 1036629000 --> <row><v>
> 1.0000000000e+00 </v></row>
>       <!-- 2002-11-06 16:35:00 PST / 1036629300 --> <row><v>
> 1.0000000000e+01 </v></row>
>       <!-- 2002-11-06 16:40:00 PST / 1036629600 --> <row><v>
> 1.0000000000e+00 </v></row>
>       <!-- 2002-11-06 16:45:00 PST / 1036629900 --> <row><v>
> 1.0000000000e+01 </v></row>
>       <!-- 2002-11-06 16:50:00 PST / 1036630200 --> <row><v>
> 1.0000000000e+00 </v></row>
>       <!-- 2002-11-06 16:55:00 PST / 1036630500 --> <row><v>
> 1.0000000000e+01 </v></row>
>       <!-- 2002-11-06 17:00:00 PST / 1036630800 --> <row><v>
> 1.0000000000e+00 </v></row>
>       <!-- 2002-11-06 17:05:00 PST / 1036631100 --> <row><v>
> 1.0000000000e+01 </v></row>
>       <!-- 2002-11-06 17:10:00 PST / 1036631400 --> <row><v>
> 1.0000000000e+00 </v></row>
>       <!-- 2002-11-06 17:15:00 PST / 1036631700 --> <row><v>
> 1.0000000000e+01 </v></row>
>       <!-- 2002-11-06 17:20:00 PST / 1036632000 --> <row><v>
> 1.0000000000e+00 </v></row>
>       <!-- 2002-11-06 17:25:00 PST / 1036632300 --> <row><v>
> 1.0000000000e+01 </v></row>
>       <!-- 2002-11-06 17:30:00 PST / 1036632600 --> <row><v>
> 1.0000000000e+00 </v></row>
>       <!-- 2002-11-06 17:35:00 PST / 1036632900 --> <row><v>
> 1.0000000000e+01 </v></row>
>     </database>
>   </rra>
> </rrd>
> END
> fi
>
> rrdtool graph html/good.png -a PNG -s 1036625900 -e 1036633900 \
> COMMENT:"Average value" \
> COMMENT:"Last value\j" \
> DEF:t0=test.rrd:test:AVERAGE LINE2:t0#FF0000:data \
> CDEF:a0=PREV\(t0\) LINE2:a0#00FF00:prev \
> CDEF:b0=a0,t0,+,2,/ LINE2:b0#0000FF:sum
>
> rrdtool graph html/bad.png -a PNG -s 1036625900 -e 1036633900 \
> COMMENT:"Average value" \
> COMMENT:"Mininum value" \
> COMMENT:"Last value\j" \
> DEF:t0=test.rrd:test:AVERAGE LINE2:t0#FF0000:data \
> CDEF:a0=PREV\(t0\) LINE2:a0#00FF00:prev \
> CDEF:b0=a0,t0,+,2,/ LINE2:b0#0000FF:sum
> ===============================================================
>
> Any help appreciated !
>
>
> --
> Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
> Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
> Archive     http://www.ee.ethz.ch/~slist/rrd-users
> WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi
>

-- 
 ______    __   _
/_  __/_  / /  (_) Oetiker, ETZ J97, ETH, CH-8092 Zurich, Switzerland
 / // _ \/ _ \/ /  System Manager Coach Time Lord Developer Designer
/_/ \.__/_.__/_/   http://people.ee.ethz.ch/~oetiker +41(0)1-632-5286

--
Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/rrd-users
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the rrd-users mailing list