reset rrd_state for grapv in ruby bindings -- Sven Engelhardt
[rrdtool.git] / doc / cdeftutorial.pod
index bfe94ad..1c17046 100644 (file)
@@ -4,10 +4,15 @@ cdeftutorial - Alex van den Bogaerdt's CDEF tutorial
 
 =head1 DESCRIPTION
 
-If you provide a question, I will try to provide an answer in the next
-release of this tutorial. No feedback equals no changes! Additions to
+Intention of this document: to provide some examples of the commonly
+used parts of RRDtool's CDEF language.
+
+If you think some important feature is not explained properly, and if
+adding it to this document would benefit most users, please do ask me
+to add it.  I will then try to provide an answer in the next release
+of this tutorial.  No feedback equals no changes! Additions to
 this document are also welcome.  -- Alex van den Bogaerdt
-E<lt>alex@ergens.op.het.netE<gt>
+E<lt>alex@vandenbogaerdt.nlE<gt>
 
 =head2 Why this tutorial?
 
@@ -612,7 +617,7 @@ numbers (or zero) only.
 Let's compile the complete CDEF:
 
        DEF:ds0=router1.rrd:AVERAGE
-       CDEF:ds0modified=TIME,begintime,GE,TIME,endtime,LE,*,UNKN,ds0,IF
+       CDEF:ds0modified=TIME,begintime,GT,TIME,endtime,LE,*,ds0,UNKN,IF
 
 This will return the value of ds0 if both comparisons return true. You
 could also do it the other way around:
@@ -721,9 +726,12 @@ If you do so, you won't be able to use these next GPRINTs:
 
 =head2 Degrees Celsius vs. Degrees Fahrenheit
 
+To convert Celsius into Fahrenheit use the formula
+F=9/5*C+32
+
    rrdtool graph demo.png --title="Demo Graph" \
       DEF:cel=demo.rrd:exhaust:AVERAGE \
-      CDEF:far=cel,32,-,0.55555,* \
+      CDEF:far=9,5,/,cel,*,32,+ \
       LINE2:cel#00a000:"D. Celsius" \
       LINE2:far#ff0000:"D. Fahrenheit\c"
 
@@ -731,18 +739,16 @@ This example gets the DS called "exhaust" from database "demo.rrd"
 and puts the values in variable "cel". The CDEF used is evaluated
 as follows:
 
-   CDEF:far=cel,32,-,0.5555,*
-   1. push variable "cel"
-   2. push 32
-   3. push function "minus" and process it
-      The stack now contains values that are 32 less than "cel"
-   4. push 0.5555
-   5. push function "multiply" and process it
-   6. the resulting value is now "(cel-32)*0.55555"
-
-Note that if you take the Celsius to Fahrenheit function you should
-be doing "5/9*(cel-32)" so 0.55555 is not exactly correct. It is close
-enough for this purpose and it saves a calculation.
+   CDEF:far=9,5,/,cel,*,32,+
+   1. push 9, push 5
+   2. push function "divide" and process it
+      the stack now contains 9/5
+   3. push variable "cel"
+   4. push function "multiply" and process it
+      the stack now contains 9/5*cel
+   5. push 32
+   6. push function "plus" and process it
+      the stack contains now the temperature in Fahrenheit
 
 =head2 Changing unknown into zero
 
@@ -869,7 +875,7 @@ This document was created from questions asked by either myself or by
 other people on the RRDtool mailing list. Please let me know if you
 find errors in it or if you have trouble understanding it. If you
 think there should be an addition, mail me:
-E<lt>alex@ergens.op.het.netE<gt>
+E<lt>alex@vandenbogaerdt.nlE<gt>
 
 Remember: B<No feedback equals no changes!>
 
@@ -880,4 +886,4 @@ The RRDtool manpages
 =head1 AUTHOR
 
 Alex van den Bogaerdt
-E<lt>alex@ergens.op.het.netE<gt>
+E<lt>alex@vandenbogaerdt.nlE<gt>