<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style id="owaParaStyle">P {
        MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px
}
</style>
</head>
<body fPStyle="1" ocsi="0">
<div style="FONT-SIZE: 13px; COLOR: #000000; DIRECTION: ltr; FONT-FAMILY: Tahoma">
<div>Have you tried this:</div>
<div> </div>
<div><font face="Courier">CDEF:dtmaxdiff=dt,POP,dtfoo,16,- </font></div>
<div> </div>
<div>This uses a DEF variable (dt) although it is removed by the POP to trick the CDEF into having at least one dataset variable (dt) to base the new sequence off of. I'm still not sure if RRDTool lets you use the VDEF value as a constant, though... I suspect
not but havent tried it in the latest version of RRDTool</div>
<div> </div>
<div>Steve<br>
</div>
<div style="FONT-SIZE: 13px; FONT-FAMILY: Tahoma">
<div style="FONT-SIZE: 13px; FONT-FAMILY: Tahoma"><strong>Steve Shipway</strong></div>
<div style="FONT-SIZE: 13px; FONT-FAMILY: Tahoma">University of Auckland ITS</div>
<div style="FONT-SIZE: 13px; FONT-FAMILY: Tahoma"><em>UNIX Systems Design Lead</em></div>
<div style="FONT-SIZE: 13px; FONT-FAMILY: Tahoma"><a href="mailto:s.shipway@auckland.ac.nz">s.shipway@auckland.ac.nz</a></div>
<div style="FONT-SIZE: 13px; FONT-FAMILY: Tahoma">Ph: +64 9 373 7599 ext 86487</div>
<div style="FONT-SIZE: 13px; FONT-FAMILY: Tahoma"><em></em> </div>
</div>
<div style="FONT-SIZE: 16px; COLOR: #000000; FONT-FAMILY: Times New Roman">
<hr tabindex="-1">
<div id="divRpF123324" style="DIRECTION: ltr"><font face="Tahoma" color="#000000" size="2"><b>From:</b> rrd-users-bounces+s.shipway=auckland.ac.nz@lists.oetiker.ch [rrd-users-bounces+s.shipway=auckland.ac.nz@lists.oetiker.ch] on behalf of Rob Newman [rlnewman@ucsd.edu]<br>
<b>Sent:</b> Thursday, 11 November 2010 2:03 p.m.<br>
<b>To:</b> rrd-users@lists.oetiker.ch<br>
<b>Subject:</b> [rrd-users] Concatenated VDEF and CDEF commands in a rrdtool graph cmd<br>
</font><br>
</div>
<div></div>
<div>Hi there,
<div><br>
</div>
<div>Does anyone know why this fails:</div>
<div><br>
</div>
<div>
<div><font class="Apple-style-span" face="Courier">rrdtool graph /path/to/outputimage/rrd.png \</font></div>
<div><font class="Apple-style-span" face="Courier"> --interlaced --imgformat PNG --end 1289434618 --start 1286756217 \</font></div>
<div><font class="Apple-style-span" face="Courier"> --width 600 --height 200 --title 'TEST' \</font></div>
<div><font class="Apple-style-span" face="Courier"> DEF:dt=/path/to/dt.rrd:dt:AVERAGE \</font></div>
<div><font class="Apple-style-span" face="Courier"> VDEF:dtfoo=dt,MAXIMUM \</font></div>
<div><font class="Apple-style-span" face="Courier"> CDEF:dtmaxdiff=dtfoo,16,- \</font></div>
<div><font class="Apple-style-span" face="Courier"> LINE1:dtmaxdiff#990000:'TESTFOO' \</font></div>
<div><font class="Apple-style-span" face="Courier"> GPRINT:dt:LAST:'Latest value for TESTFOO\: %4.0lf%s\j'</font></div>
<div><br>
</div>
<div>The output I get from rrdtool is:</div>
<div><br>
</div>
<div><font class="Apple-style-span" face="Courier">ERROR: rpn expressions without DEF or CDEF variables are not supported</font></div>
<div><br>
</div>
<div>If I try and add backslashes to the path (a la <a href="http://www.mrtg.org/rrdtool/doc/rrdgraph_rpn.en.html" target="_blank">http://www.mrtg.org/rrdtool/doc/rrdgraph_rpn.en.html</a>, note between the VDEF and CDEF rpn command there is not a carriage return
anymore, just whitespace and a backslash):</div>
<div>
<div><font class="Apple-style-span" face="Courier"><br>
</font></div>
<div><font class="Apple-style-span" face="Courier">rrdtool graph /path/to/outputimage/rrd.png \</font></div>
<div><font class="Apple-style-span" face="Courier"> --interlaced --imgformat PNG --end 1289434618 --start 1286756217 \</font></div>
<div><font class="Apple-style-span" face="Courier"> --width 600 --height 200 --title 'TEST' \</font></div>
<div><font class="Apple-style-span" face="Courier"> DEF:dt=/path/to/dt.rrd:dt:AVERAGE \</font></div>
<div><font class="Apple-style-span" face="Courier"> VDEF:dtfoo=dt,MAXIMUM \ </font><span class="Apple-style-span" style="FONT-FAMILY: Courier">CDEF:dtmaxdiff=dtfoo,16,- \</span></div>
<div><font class="Apple-style-span" face="Courier"> LINE1:dtmaxdiff#990000:'TESTFOO' \</font></div>
<div><font class="Apple-style-span" face="Courier"> GPRINT:dt:LAST:'Latest value for TESTFOO\: %4.0lf%s\j'</font></div>
</div>
<div><br>
</div>
<div>I now get the output:</div>
<div><br>
</div>
<div><font class="Apple-style-span" face="Courier">ERROR: Could not make sense out of ' CDEF:dtmaxdiff=dtfoo,16,-'</font></div>
<div><br>
</div>
<div>What I want is to find the maximum value for the data set ('dtfoo = dt,MAXIMUM'), then take that value and subtract 16 from it (dtmaxdiff = dtfoo,16,-), then plot that value.</div>
<div><br>
</div>
<div>Any ideas why both of these fail?</div>
<div><br>
</div>
<div>Thanks in advance,</div>
<div>- Rob</div>
</div>
</div>
</div>
</div>
</body>
</html>