[rrd-developers] Problem with 'IF'

Alex van den Bogaerdt alex at ergens.op.het.net
Sun Mar 9 16:07:28 CET 2008


Please look at the output of the following script.  I cannot explain
why timestamps should be different.

Please notice, the only differences are:

1: using another version of rrdtool; 1.2.10 vs latest svn 1.2 branch
2: the CDEF:  y=x,0,x,IF  vs y=x,x,0,IF
3: GPRINT using intermediate hack to print time, or strftime modifier



rrdtool1=~/svn/rrdtool-1.2/src/rrdtool
rrdtool2=~/c/rrdtool-1.2.10/src/rrdtool


$rrdtool1 create test1.rrd DS:x:GAUGE:600:U:U RRA:AVERAGE:0:1:1 --start 1205068200
$rrdtool1 update test1.rrd 1205068500:1
$rrdtool1 update test1.rrd 1205068800:1
$rrdtool1 graph test1.png \
	--start 1205068500 \
	--end 1205068800 \
	DEF:x=test1.rrd:x:AVERAGE \
	CDEF:y=x,0,GT,0,1,IF \
	VDEF:last1=x,LAST \
	VDEF:last2=y,LAST \
	PRINT:last1:%s:strftime \
	PRINT:last2:%s:strftime \

$rrdtool1 graph test1.png \
	--start 1205068500 \
	--end 1205068800 \
	DEF:x=test1.rrd:x:AVERAGE \
	CDEF:y=x,0,x,IF \
	VDEF:last1=x,LAST \
	VDEF:last2=y,LAST \
	PRINT:last1:%s:strftime \
	PRINT:last2:%s:strftime \

$rrdtool1 graph test1.png \
	--start 1205068500 \
	--end 1205068800 \
	DEF:x=test1.rrd:x:AVERAGE \
	CDEF:y=x,x,0,IF \
	VDEF:last1=x,LAST \
	VDEF:last2=y,LAST \
	PRINT:last1:%s:strftime \
	PRINT:last2:%s:strftime \


$rrdtool2 create test2.rrd DS:x:GAUGE:600:U:U RRA:AVERAGE:0:1:1 --start 1205068200
$rrdtool2 update test2.rrd 1205068500:1
$rrdtool2 update test2.rrd 1205068800:1
$rrdtool2 graph test2.png \
	--start 1205068500 \
	--end 1205068800 \
	DEF:x=test2.rrd:x:AVERAGE \
	CDEF:y=x,0,GT,0,1,IF \
	VDEF:last1=x,LAST \
	VDEF:last2=y,LAST \
	PRINT:last1:%c \
	PRINT:last2:%c \

$rrdtool2 graph test2.png \
	--start 1205068500 \
	--end 1205068800 \
	DEF:x=test2.rrd:x:AVERAGE \
	CDEF:y=x,0,x,IF \
	VDEF:last1=x,LAST \
	VDEF:last2=y,LAST \
	PRINT:last1:%c \
	PRINT:last2:%c \

$rrdtool2 graph test2.png \
	--start 1205068500 \
	--end 1205068800 \
	DEF:x=test2.rrd:x:AVERAGE \
	CDEF:y=x,x,0,IF \
	VDEF:last1=x,LAST \
	VDEF:last2=y,LAST \
	PRINT:last1:%c \
	PRINT:last2:%c \



More information about the rrd-developers mailing list