1 <?xml version="1.0" ?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml">
4 <head>
5 <title>rrdgraph_data</title>
6 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
7 <link rev="made" href="mailto:root@localhost" />
8 </head>
10 <body style="background-color: white">
13 <!-- INDEX BEGIN -->
14 <div name="index">
15 <p><a name="__index__"></a></p>
16 <!--
18 <ul>
20 <li><a href="#name">NAME</a></li>
21 <li><a href="#synopsis">SYNOPSIS</a></li>
22 <li><a href="#description">DESCRIPTION</a></li>
23 <li><a href="#def">DEF</a></li>
24 <li><a href="#vdef">VDEF</a></li>
25 <li><a href="#cdef">CDEF</a></li>
26 <li><a href="#about_cdef_versus_vdef">About CDEF versus VDEF</a></li>
27 <ul>
29 <li><a href="#when_do_you_use_vdef_versus_cdef">When do you use <strong>VDEF</strong> versus <strong>CDEF</strong>?</a></li>
30 </ul>
32 <li><a href="#see_also">SEE ALSO</a></li>
33 <li><a href="#author">AUTHOR</a></li>
34 </ul>
36 -->
39 </div>
40 <!-- INDEX END -->
42 <p>
43 </p>
44 <h1><a name="name">NAME</a></h1>
45 <p>rrdgraph_data - preparing data for graphing in rrdtool graph</p>
46 <p>
47 </p>
48 <hr />
49 <h1><a name="synopsis">SYNOPSIS</a></h1>
50 <p><strong>DEF:</strong><em><vname></em>=<em><rrdfile></em>:<em><ds-name></em>:<em><CF></em>[:step=<em><step></em>][:start=<em><time></em>][:end=<em><time></em>][:reduce=<em><<strong>CF</strong>></em>]</p>
51 <p><strong>VDEF</strong>:<em>vname</em>=<em>RPN expression</em></p>
52 <p><strong>CDEF</strong>:<em>vname</em>=<em>RPN expression</em></p>
53 <p>
54 </p>
55 <hr />
56 <h1><a name="description">DESCRIPTION</a></h1>
57 <p>These three instructions extract data values out of the <strong>RRD</strong> files,
58 optionally altering them (think, for example, of a bytes to bits
59 conversion). If so desired, you can also define variables containing
60 useful information such as maximum, minimum etcetera. Two of the
61 instructions use a language called <strong>RPN</strong> which is described in its
62 own manual page.</p>
63 <p>Variable names (<em>vname</em>) must be made up strings of the following characters
64 <code>A-Z, a-z, 0-9, -,_</code> and a maximum length of 255 characters.</p>
65 <p>When picking variable names, make sure you do not choose a name that is
66 already taken by an RPN operator. A safe bet it to use lowercase or
67 mixedcase names for variables since operators will always be in uppercase.</p>
68 <p>
69 </p>
70 <hr />
71 <h1><a name="def">DEF</a></h1>
72 <p><strong>DEF:</strong><em><vname></em>=<em><rrdfile></em>:<em><ds-name></em>:<em><CF></em>[:step=<em><step></em>][:start=<em><time></em>][:end=<em><time></em>][:reduce=<em><<strong>CF</strong>></em>]</p>
73 <p>This command fetches data from an <strong>RRD</strong> file. The virtual name
74 <em>vname</em> can then be used throughout the rest of the script. By
75 default, an <strong>RRA</strong> which contains the correct consolidated data
76 at an appropriate resolution will be chosen. The resolution can
77 be overridden with the <a href="././rrdgraph.html#item_time">--step</a> option.
78 The resolution can again be overridden by specifying the <strong>step size</strong>.
79 The time span of this data is the same as for the graph by default,
80 you can override this by specifying <strong>start and end</strong>. Remember to
81 escape colons in the time specification!</p>
82 <p>If the resolution of the data is higher than the resolution of the
83 graph, the data will be further consolidated. This may result in
84 a graph that spans slightly more time than requested.
85 Ideally each point in the graph should correspond with one <strong>CDP</strong>
86 from an <strong>RRA</strong>. For instance, if your <strong>RRD</strong> has an <strong>RRA</strong> with
87 a resolution of 1800 seconds per <strong>CDP</strong>, you should create an
88 image with width 400 and time span 400*1800 seconds (use appropriate
89 start and end times, such as <code>--start end-8days8hours</code>).</p>
90 <p>If consolidation needs to be done, the <strong>CF</strong> of the <strong>RRA</strong> specified in the
91 <strong>DEF</strong> itself will be used to reduce the data density. This behaviour can
92 be changed using <code>:reduce=<CF></code>. This optional parameter
93 specifies the <strong>CF</strong> to use during the data reduction phase.</p>
94 <p>Example:</p>
95 <pre>
96 DEF:ds0=router.rrd:ds0:AVERAGE
97 DEF:ds0weekly=router.rrd:ds0:AVERAGE:step=7200
98 DEF:ds0weekly=router.rrd:ds0:AVERAGE:start=end-1h
99 DEF:ds0weekly=router.rrd:ds0:AVERAGE:start=11\:00:end=start+1h</pre>
100 <p>
101 </p>
102 <hr />
103 <h1><a name="vdef">VDEF</a></h1>
104 <p><strong>VDEF</strong>:<em>vname</em>=<em>RPN expression</em></p>
105 <p>This command returns a value and/or a time according to the <strong>RPN</strong>
106 statements used. The resulting <em>vname</em> will, depending on the
107 functions used, have a value and a time component. When you use
108 this <em>vname</em> in another <strong>RPN</strong> expression, you are effectively
109 inserting its value just as if you had put a number at that place.
110 The variable can also be used in the various graph and print
111 elements.</p>
112 <p>Example: <code>VDEF:avg=mydata,AVERAGE</code></p>
113 <p>Note that currently only aggregation functions work in VDEF rpn expressions.
114 Patches to change this are welcome.</p>
115 <p>
116 </p>
117 <hr />
118 <h1><a name="cdef">CDEF</a></h1>
119 <p><strong>CDEF</strong>:<em>vname</em>=<em>RPN expression</em></p>
120 <p>This command creates a new set of data points (in memory only, not
121 in the <strong>RRD</strong> file) out of one or more other data series. The <strong>RPN</strong>
122 instructions are used to evaluate a mathematical function on each
123 data point. The resulting <em>vname</em> can then be used further on in
124 the script, just as if it were generated by a <strong>DEF</strong> instruction.</p>
125 <p>Example: <code>CDEF:mydatabits=mydata,8,*</code></p>
126 <p>
127 </p>
128 <hr />
129 <h1><a name="about_cdef_versus_vdef">About CDEF versus VDEF</a></h1>
130 <p>At some point in processing, <strong>RRDtool</strong> has gathered an array of rates
131 ready to display.</p>
132 <p><strong>CDEF</strong> works on such an array. For example, <em>CDEF:new=ds0,8,*</em>
133 would multiply each of the array members by eight (probably
134 transforming bytes into bits). The result is an array containing the
135 new values.</p>
136 <p><strong>VDEF</strong> also works on such an array but in a different way. For
137 example, <em>VDEF:max=ds0,MAXIMUM</em> would scan each of the array members
138 and store the maximum value.</p>
139 <p>
140 </p>
141 <h2><a name="when_do_you_use_vdef_versus_cdef">When do you use <strong>VDEF</strong> versus <strong>CDEF</strong>?</a></h2>
142 <p>Use <strong>CDEF</strong> to transform your data prior to graphing. In the above
143 example, we'd use a <strong>CDEF</strong> to transform bytes to bits before
144 graphing the bits.</p>
145 <p>You use a <strong>VDEF</strong> if you want <em>max(1,5,3,2,4)</em> to return five which
146 would be displayed in the graph's legend (to answer, what was the
147 maximum value during the graph period).</p>
148 <p>If you want to apply 'complex' operations to the result of a VDEF you have
149 to use a CDEF again since VDEFs only look like RPN expressions, they aren't
150 realy.</p>
151 <p>
152 </p>
153 <hr />
154 <h1><a name="see_also">SEE ALSO</a></h1>
155 <p><a href="././rrdgraph.html">the rrdgraph manpage</a> gives an overview of how <strong>rrdtool graph</strong> works.
156 <a href="././rrdgraph_data.html">the rrdgraph_data manpage</a> describes <strong>DEF</strong>,<strong>CDEF</strong> and <strong>VDEF</strong> in detail.
157 <a href="././rrdgraph_rpn.html">the rrdgraph_rpn manpage</a> describes the <strong>RPN</strong> language used in the <strong>?DEF</strong> statements.
158 <a href="././rrdgraph_graph.html">the rrdgraph_graph manpage</a> page describes all of the graph and print functions.</p>
159 <p>Make sure to read <a href="././rrdgraph_examples.html">the rrdgraph_examples manpage</a> for tips&tricks.</p>
160 <p>
161 </p>
162 <hr />
163 <h1><a name="author">AUTHOR</a></h1>
164 <p>Program by Tobias Oetiker <<a href="mailto:tobi@oetiker.ch">tobi@oetiker.ch</a>></p>
165 <p>This manual page by Alex van den Bogaerdt <<a href="mailto:alex@vandenbogaerdt.nl">alex@vandenbogaerdt.nl</a>>
166 with corrections and/or additions by several people</p>
168 </body>
170 </html>