Code

Imported upstream SVN snapshot 1.4~rc2+20090928.
[pkg-rrdtool.git] / doc / rrdgraph_rpn.html
index 0da9f789808b768d3cee9dbe259ed1a961c633d0..2f21e06696bd4d9c659c73c82b39d0e712816a09 100644 (file)
@@ -1,14 +1,18 @@
+<?xml version="1.0" ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
 <title>rrdgraph_rpn</title>
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
 <link rev="made" href="mailto:root@localhost" />
 </head>
 
 <body style="background-color: white">
 
-<p><a name="__index__"></a></p>
+
 <!-- INDEX BEGIN -->
+<div name="index">
+<p><a name="__index__"></a></p>
 <!--
 
 <ul>
        <li><a href="#see_also">SEE ALSO</a></li>
        <li><a href="#author">AUTHOR</a></li>
 </ul>
+
 -->
+
+
+</div>
 <!-- INDEX END -->
 
 <p>
@@ -51,7 +59,7 @@ data point on the graph. <strong>VDEF</strong> instructions work on an entire da
 one run. Note, that currently <strong>VDEF</strong> instructions only support a limited
 list of functions.</p>
 <p>Example: <code>VDEF:maximum=mydata,MAXIMUM</code></p>
-<p>This will set variable ``maximum'' which you now can use in the rest
+<p>This will set variable &quot;maximum&quot; which you now can use in the rest
 of your RRD script.</p>
 <p>Example: <code>CDEF:mydatabits=mydata,8,*</code></p>
 <p>This means:  push variable <em>mydata</em>, push the number 8, execute
@@ -69,173 +77,92 @@ would do <code>a = b, 3, +, 5, *</code> without the need for parentheses.</p>
 <hr />
 <h1><a name="operators">OPERATORS</a></h1>
 <dl>
-<dt><strong><a name="item_boolean_operators">Boolean operators</a></strong><br />
-</dt>
-<dd>
-<strong>LT, LE, GT, GE, EQ, NE</strong>
-</dd>
+<dt><strong><a name="boolean_operators" class="item">Boolean operators</a></strong></dt>
+
 <dd>
+<p><strong>LT, LE, GT, GE, EQ, NE</strong></p>
 <p>Pop two elements from the stack, compare them for the selected condition
 and return 1 for true or 0 for false. Comparing an <em>unknown</em> or an
 <em>infinite</em> value will always result in 0 (false).</p>
-</dd>
-<dd>
 <p><strong>UN, ISINF</strong></p>
-</dd>
-<dd>
 <p>Pop one element from the stack, compare this to <em>unknown</em> respectively
 to <em>positive or negative infinity</em>. Returns 1 for true or 0 for false.</p>
-</dd>
-<dd>
 <p><strong>IF</strong></p>
-</dd>
-<dd>
 <p>Pops three elements from the stack.  If the element popped last is 0
 (false), the value popped first is pushed back onto the stack,
 otherwise the value popped second is pushed back. This does, indeed,
 mean that any value other than 0 is considered to be true.</p>
-</dd>
-<dd>
 <p>Example: <code>A,B,C,IF</code> should be read as <code>if (A) then (B) else (C)</code></p>
-</dd>
-<dd>
-<p></p>
-</dd>
 <p></p>
-<dt><strong><a name="item_comparing_values">Comparing values</a></strong><br />
-</dt>
-<dd>
-<strong>MIN, MAX</strong>
 </dd>
+<dt><strong><a name="comparing_values" class="item">Comparing values</a></strong></dt>
+
 <dd>
+<p><strong>MIN, MAX</strong></p>
 <p>Pops two elements from the stack and returns the smaller or larger,
 respectively.  Note that <em>infinite</em> is larger than anything else.
 If one of the input numbers is <em>unknown</em> then the result of the operation will be
 <em>unknown</em> too.</p>
-</dd>
-<dd>
 <p><strong>LIMIT</strong></p>
-</dd>
-<dd>
 <p>Pops two elements from the stack and uses them to define a range.
 Then it pops another element and if it falls inside the range, it
 is pushed back. If not, an <em>unknown</em> is pushed.</p>
-</dd>
-<dd>
 <p>The range defined includes the two boundaries (so: a number equal
 to one of the boundaries will be pushed back). If any of the three
 numbers involved is either <em>unknown</em> or <em>infinite</em> this function
 will always return an <em>unknown</em></p>
-</dd>
-<dd>
 <p>Example: <code>CDEF:a=alpha,0,100,LIMIT</code> will return <em>unknown</em> if
 alpha is lower than 0 or if it is higher than 100.</p>
-</dd>
-<dd>
 <p></p>
 </dd>
-<p></p>
-<dt><strong><a name="item_arithmetics">Arithmetics</a></strong><br />
-</dt>
-<dd>
-<strong>+, -, *, /, %</strong>
-</dd>
+<dt><strong><a name="arithmetics" class="item">Arithmetics</a></strong></dt>
+
 <dd>
+<p><strong>+, -, *, /, %</strong></p>
 <p>Add, subtract, multiply, divide, modulo</p>
-</dd>
-<dd>
 <p><strong>ADDNAN</strong></p>
-</dd>
-<dd>
 <p>NAN-safe addition. If one parameter is NAN/UNKNOWN it'll be treated as
 zero. If both parameters are NAN/UNKNOWN, NAN/UNKNOWN will be returned.</p>
-</dd>
-<dd>
 <p><strong>SIN, COS, LOG, EXP, SQRT</strong></p>
-</dd>
-<dd>
 <p>Sine and cosine (input in radians), log and exp (natural logarithm),
 square root.</p>
-</dd>
-<dd>
 <p><strong>ATAN</strong></p>
-</dd>
-<dd>
 <p>Arctangent (output in radians).</p>
-</dd>
-<dd>
 <p><strong>ATAN2</strong></p>
-</dd>
-<dd>
 <p>Arctangent of y,x components (output in radians).
 This pops one element from the stack, the x (cosine) component, and then
 a second, which is the y (sine) component.
 It then pushes the arctangent of their ratio, resolving the ambiguity between
 quadrants.</p>
-</dd>
-<dd>
 <p>Example: <code>CDEF:angle=Y,X,ATAN2,RAD2DEG</code> will convert <code>X,Y</code>
 components into an angle in degrees.</p>
-</dd>
-<dd>
 <p><strong>FLOOR, CEIL</strong></p>
-</dd>
-<dd>
 <p>Round down or up to the nearest integer.</p>
-</dd>
-<dd>
 <p><strong>DEG2RAD, RAD2DEG</strong></p>
-</dd>
-<dd>
 <p>Convert angle in degrees to radians, or radians to degrees.</p>
-</dd>
-<dd>
 <p><strong>ABS</strong></p>
-</dd>
-<dd>
 <p>Take the absolute value.</p>
 </dd>
-<p></p>
-<dt><strong><a name="item_set_operations">Set Operations</a></strong><br />
-</dt>
-<dd>
-<strong>SORT, REV</strong>
-</dd>
+<dt><strong><a name="set_operations" class="item">Set Operations</a></strong></dt>
+
 <dd>
+<p><strong>SORT, REV</strong></p>
 <p>Pop one element from the stack.  This is the <em>count</em> of items to be sorted
 (or reversed).  The top <em>count</em> of the remaining elements are then sorted
 (or reversed) in place on the stack.</p>
-</dd>
-<dd>
 <p>Example: <code>CDEF:x=v1,v2,v3,v4,v5,v6,6,SORT,POP,5,REV,POP,+,+,+,4,/</code> will
 compute the average of the values v1 to v6 after removing the smallest and
 largest.</p>
-</dd>
-<dd>
 <p><strong>AVG</strong></p>
-</dd>
-<dd>
 <p>Pop one element (<em>count</em>) from the stack. Now pop <em>count</em> elements and build the
 average, ignoring all UNKNOWN values in the process.</p>
-</dd>
-<dd>
 <p>Example: <code>CDEF:x=a,b,c,d,4,AVG</code></p>
-</dd>
-<dd>
 <p><strong>TREND, TRENDNAN</strong></p>
-</dd>
-<dd>
-<p>Create a ``sliding window'' average of another data series.</p>
-</dd>
-<dd>
+<p>Create a &quot;sliding window&quot; average of another data series.</p>
 <p>Usage:
 CDEF:smoothed=x,1800,TREND</p>
-</dd>
-<dd>
 <p>This will create a half-hour (1800 second) sliding window average of x.  The
 average is essentially computed as shown here:</p>
-</dd>
-<dd>
 <pre>
                  +---!---!---!---!---!---!---!---!---&gt;
                                                      now
@@ -245,45 +172,27 @@ average is essentially computed as shown here:</p>
                      &lt;---------------&gt;
                               delay      t2
                          &lt;---------------&gt;</pre>
-</dd>
-<dd>
 <pre>
      Value at sample (t0) will be the average between (t0-delay) and (t0)
      Value at sample (t1) will be the average between (t1-delay) and (t1)
      Value at sample (t2) will be the average between (t2-delay) and (t2)</pre>
-</dd>
-<dd>
 <p>TRENDNAN is - in contrast to TREND - NAN-safe. If you use TREND and one 
 source value is NAN the complete sliding window is affected. The TRENDNAN 
 operation ignores all NAN-values in a sliding window and computes the 
 average of the remaining values.</p>
-</dd>
-<dd>
 <p><strong>PREDICT, PREDICTSIGMA</strong></p>
-</dd>
-<dd>
-<p>Create a ``sliding window'' average/sigma of another data series, that also
+<p>Create a &quot;sliding window&quot; average/sigma of another data series, that also
 shifts the data series by given amounts of of time as well</p>
-</dd>
-<dd>
 <p>Usage - explicit stating shifts:
 CDEF:predict=&lt;shift n&gt;,...,&lt;shift 1&gt;,n,&lt;window&gt;,x,PREDICT
 CDEF:sigma=&lt;shift n&gt;,...,&lt;shift 1&gt;,n,&lt;window&gt;,x,PREDICTSIGMA</p>
-</dd>
-<dd>
 <p>Usage - shifts defined as a base shift and a number of time this is applied
 CDEF:predict=&lt;shift multiplier&gt;,-n,&lt;window&gt;,x,PREDICT
 CDEF:sigma=&lt;shift multiplier&gt;,-n,&lt;window&gt;,x,PREDICTSIGMA</p>
-</dd>
-<dd>
 <p>Example:
 CDEF:predict=172800,86400,2,1800,x,PREDICT</p>
-</dd>
-<dd>
 <p>This will create a half-hour (1800 second) sliding window average/sigma of x, that
 average is essentially computed as shown here:</p>
-</dd>
-<dd>
 <pre>
  +---!---!---!---!---!---!---!---!---!---!---!---!---!---!---!---!---!---&gt;
                                                                      now
@@ -303,26 +212,18 @@ average is essentially computed as shown here:</p>
                      &lt;-----------------------------------------------&gt;
            window
      &lt;---------------&gt;</pre>
-</dd>
-<dd>
 <pre>
  Value at sample (t0) will be the average between (t0-shift1-window) and (t0-shift1)
                                       and between (t0-shift2-window) and (t0-shift2)
  Value at sample (t1) will be the average between (t1-shift1-window) and (t1-shift1)
                                       and between (t1-shift2-window) and (t1-shift2)</pre>
-</dd>
-<dd>
 <p>The function is by design NAN-safe. 
 This also allows for extrapolation into the future (say a few days)
 - you may need to define the data series whit the optional start= parameter, so that 
 the source data series has enough data to provide prediction also at the beginning of a graph...</p>
-</dd>
-<dd>
 <p>Here an example, that will create a 10 day graph that also shows the 
 prediction 3 days into the future with its uncertainty value (as defined by avg+-4*sigma)
 This also shows if the prediction is exceeded at a certain point.</p>
-</dd>
-<dd>
 <p>rrdtool graph image.png --imgformat=PNG \
  --start=-7days --end=+3days --width=1000 --height=200 --alt-autoscale-max \
  DEF:value=value.rrd:value:AVERAGE:start=-14days \
@@ -336,153 +237,100 @@ This also shows if the prediction is exceeded at a certain point.</p>
  LINE1:lower#0000ff:lower\ certainty\ limit \
  CDEF:exceeds=value,UN,0,value,lower,upper,LIMIT,UN,IF \
  TICK:exceeds#aa000080:1</p>
-</dd>
-<dd>
 <p>Note: Experience has shown that a factor between 3 and 5 to scale sigma is a good 
 discriminator to detect abnormal behaviour. This obviously depends also on the type 
-of data and how ``noisy'' the data series is.</p>
-</dd>
-<dd>
+of data and how &quot;noisy&quot; the data series is.</p>
 <p>This prediction can only be used for short term extrapolations - say a few days into the future-</p>
 </dd>
-<p></p>
-<dt><strong><a name="item_special_values">Special values</a></strong><br />
-</dt>
-<dd>
-<strong>UNKN</strong>
-</dd>
+<dt><strong><a name="special_values" class="item">Special values</a></strong></dt>
+
 <dd>
+<p><strong>UNKN</strong></p>
 <p>Pushes an unknown value on the stack</p>
-</dd>
-<dd>
 <p><strong>INF, NEGINF</strong></p>
-</dd>
-<dd>
 <p>Pushes a positive or negative infinite value on the stack. When
 such a value is graphed, it appears at the top or bottom of the
 graph, no matter what the actual value on the y-axis is.</p>
-</dd>
-<dd>
 <p><strong>PREV</strong></p>
-</dd>
-<dd>
 <p>Pushes an <em>unknown</em> value if this is the first value of a data
 set or otherwise the result of this <strong>CDEF</strong> at the previous time
 step. This allows you to do calculations across the data.  This
 function cannot be used in <strong>VDEF</strong> instructions.</p>
-</dd>
-<dd>
 <p><strong>PREV(vname)</strong></p>
-</dd>
-<dd>
 <p>Pushes an <em>unknown</em> value if this is the first value of a data
 set or otherwise the result of the vname variable at the previous time
 step. This allows you to do calculations across the data. This
 function cannot be used in <strong>VDEF</strong> instructions.</p>
-</dd>
-<dd>
 <p><strong>COUNT</strong></p>
-</dd>
-<dd>
 <p>Pushes the number 1 if this is the first value of the data set, the
 number 2 if it is the second, and so on. This special value allows
 you to make calculations based on the position of the value within
 the data set. This function cannot be used in <strong>VDEF</strong> instructions.</p>
 </dd>
-<p></p>
-<dt><strong><a name="item_time">Time</a></strong><br />
-</dt>
-<dd>
-Time inside RRDtool is measured in seconds since the epoch. The
-epoch is defined to be <code>Thu&nbsp;Jan&nbsp;&nbsp;1&nbsp;00:00:00&nbsp;UTC&nbsp;1970</code>.
-</dd>
+<dt><strong><a name="time" class="item">Time</a></strong></dt>
+
 <dd>
+<p>Time inside RRDtool is measured in seconds since the epoch. The
+epoch is defined to be <code>Thu&nbsp;Jan&nbsp;&nbsp;1&nbsp;00:00:00&nbsp;UTC&nbsp;1970</code>.</p>
 <p><strong>NOW</strong></p>
-</dd>
-<dd>
 <p>Pushes the current time on the stack.</p>
-</dd>
-<dd>
 <p><strong>TIME</strong></p>
-</dd>
-<dd>
 <p>Pushes the time the currently processed value was taken at onto the stack.</p>
-</dd>
-<dd>
 <p><strong>LTIME</strong></p>
-</dd>
-<dd>
 <p>Takes the time as defined by <strong>TIME</strong>, applies the time zone offset
 valid at that time including daylight saving time if your OS supports
 it, and pushes the result on the stack.  There is an elaborate example
 in the examples section below on how to use this.</p>
 </dd>
-<p></p>
-<dt><strong><a name="item_processing_the_stack_directly">Processing the stack directly</a></strong><br />
-</dt>
-<dd>
-<strong>DUP, POP, EXC</strong>
-</dd>
+<dt><strong><a name="processing_the_stack_directly" class="item">Processing the stack directly</a></strong></dt>
+
 <dd>
+<p><strong>DUP, POP, EXC</strong></p>
 <p>Duplicate the top element, remove the top element, exchange the two
 top elements.</p>
-</dd>
-<dd>
 <p></p>
 </dd>
-<p></p></dl>
+</dl>
 <p>
 </p>
 <hr />
 <h1><a name="variables">VARIABLES</a></h1>
 <p>These operators work only on <strong>VDEF</strong> statements. Note that currently ONLY these work for <strong>VDEF</strong>.</p>
 <dl>
-<dt><strong><a name="item_maximum_2c_minimum_2c_average">MAXIMUM, MINIMUM, AVERAGE</a></strong><br />
-</dt>
-<dd>
-Return the corresponding value, MAXIMUM and MINIMUM also return
-the first occurrence of that value in the time component.
-</dd>
+<dt><strong><a name="maximum_minimum_average" class="item">MAXIMUM, MINIMUM, AVERAGE</a></strong></dt>
+
 <dd>
+<p>Return the corresponding value, MAXIMUM and MINIMUM also return
+the first occurrence of that value in the time component.</p>
 <p>Example: <code>VDEF:avg=mydata,AVERAGE</code></p>
 </dd>
-<p></p>
-<dt><strong><a name="item_stdev">STDEV</a></strong><br />
-</dt>
-<dd>
-Returns the standard deviation of the values.
-</dd>
+<dt><strong><a name="stdev" class="item">STDEV</a></strong></dt>
+
 <dd>
+<p>Returns the standard deviation of the values.</p>
 <p>Example: <code>VDEF:stdev=mydata,STDEV</code></p>
 </dd>
-<p></p>
-<dt><strong><a name="item_last_2c_first">LAST, FIRST</a></strong><br />
-</dt>
+<dt><strong><a name="last_first" class="item">LAST, FIRST</a></strong></dt>
+
 <dd>
-Return the last/first value including its time.  The time for
+<p>Return the last/first value including its time.  The time for
 FIRST is actually the start of the corresponding interval, whereas
-LAST returns the end of the corresponding interval.
-</dd>
-<dd>
+LAST returns the end of the corresponding interval.</p>
 <p>Example: <code>VDEF:first=mydata,FIRST</code></p>
 </dd>
-<p></p>
-<dt><strong><a name="item_total">TOTAL</a></strong><br />
-</dt>
+<dt><strong><a name="total" class="item">TOTAL</a></strong></dt>
+
 <dd>
-Returns the rate from each defined time slot multiplied with the
+<p>Returns the rate from each defined time slot multiplied with the
 step size.  This can, for instance, return total bytes transfered
 when you have logged bytes per second. The time component returns
-the number of seconds.
-</dd>
-<dd>
+the number of seconds.</p>
 <p>Example: <code>VDEF:total=mydata,TOTAL</code></p>
 </dd>
-<p></p>
-<dt><strong><a name="item_percent_2c_percentnan">PERCENT, PERCENTNAN</a></strong><br />
-</dt>
+<dt><strong><a name="percent_percentnan" class="item">PERCENT, PERCENTNAN</a></strong></dt>
+
 <dd>
-This should follow a <strong>DEF</strong> or <strong>CDEF</strong> <em>vname</em>. The <em>vname</em> is popped,
+<p>This should follow a <strong>DEF</strong> or <strong>CDEF</strong> <em>vname</em>. The <em>vname</em> is popped,
 another number is popped which is a certain percentage (0..100). The
 data set is then sorted and the value returned is chosen such that
 <em>percentage</em> percent of the values is lower or equal than the result.
@@ -491,28 +339,23 @@ For PERCENTNAN <em>Unknown</em> values are ignored, but for PERCENT
 purpose so if this operator returns an <em>unknown</em> you have quite a lot
 of them in your data.  <strong>Inf</strong>inite numbers are lesser, or more, than the
 finite numbers and are always more than the <em>Unknown</em> numbers.
-(NaN &lt; -INF &lt; finite values &lt; INF)
-</dd>
-<dd>
+(NaN &lt; -INF &lt; finite values &lt; INF)</p>
 <p>Example: <code>VDEF:perc95=mydata,95,PERCENT</code>
          <code>VDEF:percnan95=mydata,95,PERCENTNAN</code></p>
 </dd>
-<p></p>
-<dt><strong><a name="item_lslslope_2c_lslint_2c_lslcorrel">LSLSLOPE, LSLINT, LSLCORREL</a></strong><br />
-</dt>
+<dt><strong><a name="lslslope_lslint_lslcorrel" class="item">LSLSLOPE, LSLINT, LSLCORREL</a></strong></dt>
+
 <dd>
-Return the parameters for a <strong>L</strong>east <strong>S</strong>quares <strong>L</strong>ine <em>(y = mx +b)</em> 
+<p>Return the parameters for a <strong>L</strong>east <strong>S</strong>quares <strong>L</strong>ine <em>(y = mx +b)</em> 
 which approximate the provided dataset.  LSLSLOPE is the slope <em>(m)</em> of
 the line related to the COUNT position of the data.  LSLINT is the 
 y-intercept <em>(b)</em>, which happens also to be the first data point on the 
 graph. LSLCORREL is the Correlation Coefficient (also know as Pearson's 
 Product Moment Correlation Coefficient).  It will range from 0 to +/-1 
-and represents the quality of fit for the approximation.
-</dd>
-<dd>
+and represents the quality of fit for the approximation.</p>
 <p>Example: <code>VDEF:slope=mydata,LSLSLOPE</code></p>
 </dd>
-<p></p></dl>
+</dl>
 <p>
 </p>
 <hr />