Code

7c9538c3a739a24c1ae1ec94379edd830329d823
[pkg-rrdtool.git] / doc / rrdgraph_data.1
1 .\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.14
2 .\"
3 .\" Standard preamble:
4 .\" ========================================================================
5 .de Sh \" Subsection heading
6 .br
7 .if t .Sp
8 .ne 5
9 .PP
10 \fB\\$1\fR
11 .PP
12 ..
13 .de Sp \" Vertical space (when we can't use .PP)
14 .if t .sp .5v
15 .if n .sp
16 ..
17 .de Vb \" Begin verbatim text
18 .ft CW
19 .nf
20 .ne \\$1
21 ..
22 .de Ve \" End verbatim text
23 .ft R
24 .fi
25 ..
26 .\" Set up some character translations and predefined strings.  \*(-- will
27 .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
28 .\" double quote, and \*(R" will give a right double quote.  | will give a
29 .\" real vertical bar.  \*(C+ will give a nicer C++.  Capital omega is used to
30 .\" do unbreakable dashes and therefore won't be available.  \*(C` and \*(C'
31 .\" expand to `' in nroff, nothing in troff, for use with C<>.
32 .tr \(*W-|\(bv\*(Tr
33 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
34 .ie n \{\
35 .    ds -- \(*W-
36 .    ds PI pi
37 .    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
38 .    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
39 .    ds L" ""
40 .    ds R" ""
41 .    ds C` ""
42 .    ds C' ""
43 'br\}
44 .el\{\
45 .    ds -- \|\(em\|
46 .    ds PI \(*p
47 .    ds L" ``
48 .    ds R" ''
49 'br\}
50 .\"
51 .\" If the F register is turned on, we'll generate index entries on stderr for
52 .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
53 .\" entries marked with X<> in POD.  Of course, you'll have to process the
54 .\" output yourself in some meaningful fashion.
55 .if \nF \{\
56 .    de IX
57 .    tm Index:\\$1\t\\n%\t"\\$2"
58 ..
59 .    nr % 0
60 .    rr F
61 .\}
62 .\"
63 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
64 .\" way too many mistakes in technical documents.
65 .hy 0
66 .if n .na
67 .\"
68 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
69 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
70 .    \" fudge factors for nroff and troff
71 .if n \{\
72 .    ds #H 0
73 .    ds #V .8m
74 .    ds #F .3m
75 .    ds #[ \f1
76 .    ds #] \fP
77 .\}
78 .if t \{\
79 .    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
80 .    ds #V .6m
81 .    ds #F 0
82 .    ds #[ \&
83 .    ds #] \&
84 .\}
85 .    \" simple accents for nroff and troff
86 .if n \{\
87 .    ds ' \&
88 .    ds ` \&
89 .    ds ^ \&
90 .    ds , \&
91 .    ds ~ ~
92 .    ds /
93 .\}
94 .if t \{\
95 .    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
96 .    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
97 .    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
98 .    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
99 .    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
100 .    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
101 .\}
102 .    \" troff and (daisy-wheel) nroff accents
103 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
104 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
105 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
106 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
107 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
108 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
109 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
110 .ds ae a\h'-(\w'a'u*4/10)'e
111 .ds Ae A\h'-(\w'A'u*4/10)'E
112 .    \" corrections for vroff
113 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
114 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
115 .    \" for low resolution devices (crt and lpr)
116 .if \n(.H>23 .if \n(.V>19 \
117 \{\
118 .    ds : e
119 .    ds 8 ss
120 .    ds o a
121 .    ds d- d\h'-1'\(ga
122 .    ds D- D\h'-1'\(hy
123 .    ds th \o'bp'
124 .    ds Th \o'LP'
125 .    ds ae ae
126 .    ds Ae AE
127 .\}
128 .rm #[ #] #H #V #F C
129 .\" ========================================================================
130 .\"
131 .IX Title "RRDGRAPH_DATA 1"
132 .TH RRDGRAPH_DATA 1 "2009-04-29" "1.3.99909060808" "rrdtool"
133 .SH "NAME"
134 rrdgraph_data \- preparing data for graphing in rrdtool graph
135 .SH "SYNOPSIS"
136 .IX Header "SYNOPSIS"
137 \&\fB\s-1DEF:\s0\fR\fI<vname>\fR=\fI<rrdfile>\fR:\fI<ds-name>\fR:\fI<\s-1CF\s0>\fR[:step=\fI<step>\fR][:start=\fI<time>\fR][:end=\fI<time>\fR][:reduce=\fI<\f(BI\s-1CF\s0\fI>\fR]
138 .PP
139 \&\fB\s-1VDEF\s0\fR:\fIvname\fR=\fI\s-1RPN\s0 expression\fR
140 .PP
141 \&\fB\s-1CDEF\s0\fR:\fIvname\fR=\fI\s-1RPN\s0 expression\fR
142 .SH "DESCRIPTION"
143 .IX Header "DESCRIPTION"
144 These three instructions extract data values out of the \fB\s-1RRD\s0\fR files,
145 optionally altering them (think, for example, of a bytes to bits
146 conversion). If so desired, you can also define variables containing
147 useful information such as maximum, minimum etcetera. Two of the
148 instructions use a language called \fB\s-1RPN\s0\fR which is described in its
149 own manual page.
150 .PP
151 Variable names (\fIvname\fR) must be made up strings of the following characters
152 \&\f(CW\*(C`A\-Z, a\-z, 0\-9, \-,_\*(C'\fR and a maximum length of 255 characters.
153 .PP
154 When picking variable names, make sure you do not choose a name that is
155 already taken by an \s-1RPN\s0 operator. A safe bet it to use lowercase or
156 mixedcase names for variables since operators will always be in uppercase.
157 .SH "DEF"
158 .IX Header "DEF"
159 \&\fB\s-1DEF:\s0\fR\fI<vname>\fR=\fI<rrdfile>\fR:\fI<ds-name>\fR:\fI<\s-1CF\s0>\fR[:step=\fI<step>\fR][:start=\fI<time>\fR][:end=\fI<time>\fR][:reduce=\fI<\f(BI\s-1CF\s0\fI>\fR]
160 .PP
161 This command fetches data from an \fB\s-1RRD\s0\fR file.  The virtual name
162 \&\fIvname\fR can then be used throughout the rest of the script. By
163 default, an \fB\s-1RRA\s0\fR which contains the correct consolidated data
164 at an appropriate resolution will be chosen.  The resolution can
165 be overridden with the \-\-step option.
166 The resolution can again be overridden by specifying the \fBstep size\fR.
167 The time span of this data is the same as for the graph by default,
168 you can override this by specifying \fBstart and end\fR.  Remember to
169 escape colons in the time specification!
170 .PP
171 If the resolution of the data is higher than the resolution of the
172 graph, the data will be further consolidated. This may result in
173 a graph that spans slightly more time than requested.
174 Ideally each point in the graph should correspond with one \fB\s-1CDP\s0\fR
175 from an \fB\s-1RRA\s0\fR.  For instance, if your \fB\s-1RRD\s0\fR has an \fB\s-1RRA\s0\fR with
176 a resolution of 1800 seconds per \fB\s-1CDP\s0\fR, you should create an
177 image with width 400 and time span 400*1800 seconds (use appropriate
178 start and end times, such as \f(CW\*(C`\-\-start end\-8days8hours\*(C'\fR).
179 .PP
180 If consolidation needs to be done, the \fB\s-1CF\s0\fR of the \fB\s-1RRA\s0\fR specified in the
181 \&\fB\s-1DEF\s0\fR itself will be used to reduce the data density. This behaviour can
182 be changed using \f(CW\*(C`:reduce=\f(CI<\f(CB\s-1CF\s0\f(CI>\f(CW\*(C'\fR.  This optional parameter
183 specifies the \fB\s-1CF\s0\fR to use during the data reduction phase.
184 .PP
185 Example:
186 .PP
187 .Vb 4
188 \&        DEF:ds0=router.rrd:ds0:AVERAGE
189 \&        DEF:ds0weekly=router.rrd:ds0:AVERAGE:step=7200
190 \&        DEF:ds0weekly=router.rrd:ds0:AVERAGE:start=end\-1h
191 \&        DEF:ds0weekly=router.rrd:ds0:AVERAGE:start=11\e:00:end=start+1h
192 .Ve
193 .SH "VDEF"
194 .IX Header "VDEF"
195 \&\fB\s-1VDEF\s0\fR:\fIvname\fR=\fI\s-1RPN\s0 expression\fR
196 .PP
197 This command returns a value and/or a time according to the \fB\s-1RPN\s0\fR
198 statements used. The resulting \fIvname\fR will, depending on the
199 functions used, have a value and a time component.  When you use
200 this \fIvname\fR in another \fB\s-1RPN\s0\fR expression, you are effectively
201 inserting its value just as if you had put a number at that place.
202 The variable can also be used in the various graph and print
203 elements.
204 .PP
205 Example: \f(CW\*(C`VDEF:avg=mydata,AVERAGE\*(C'\fR
206 .PP
207 Note that currently only aggregation functions work in \s-1VDEF\s0 rpn expressions.
208 Patches to change this are welcome.
209 .SH "CDEF"
210 .IX Header "CDEF"
211 \&\fB\s-1CDEF\s0\fR:\fIvname\fR=\fI\s-1RPN\s0 expression\fR
212 .PP
213 This command creates a new set of data points (in memory only, not
214 in the \fB\s-1RRD\s0\fR file) out of one or more other data series. The \fB\s-1RPN\s0\fR
215 instructions are used to evaluate a mathematical function on each
216 data point. The resulting \fIvname\fR can then be used further on in
217 the script, just as if it were generated by a \fB\s-1DEF\s0\fR instruction.
218 .PP
219 Example: \f(CW\*(C`CDEF:mydatabits=mydata,8,*\*(C'\fR
220 .SH "About CDEF versus VDEF"
221 .IX Header "About CDEF versus VDEF"
222 At some point in processing, \fBRRDtool\fR has gathered an array of rates
223 ready to display.
224 .PP
225 \&\fB\s-1CDEF\s0\fR works on such an array.  For example, \fICDEF:new=ds0,8,*\fR
226 would multiply each of the array members by eight (probably
227 transforming bytes into bits). The result is an array containing the
228 new values.
229 .PP
230 \&\fB\s-1VDEF\s0\fR also works on such an array but in a different way.  For
231 example, \fIVDEF:max=ds0,MAXIMUM\fR would scan each of the array members
232 and store the maximum value.
233 .Sh "When do you use \fB\s-1VDEF\s0\fP versus \fB\s-1CDEF\s0\fP?"
234 .IX Subsection "When do you use VDEF versus CDEF?"
235 Use \fB\s-1CDEF\s0\fR to transform your data prior to graphing.  In the above
236 example, we'd use a \fB\s-1CDEF\s0\fR to transform bytes to bits before
237 graphing the bits.
238 .PP
239 You use a \fB\s-1VDEF\s0\fR if you want \fImax(1,5,3,2,4)\fR to return five which
240 would be displayed in the graph's legend (to answer, what was the
241 maximum value during the graph period).
242 .PP
243 If you want to apply 'complex' operations to the result of a \s-1VDEF\s0 you have
244 to use a \s-1CDEF\s0 again since VDEFs only look like \s-1RPN\s0 expressions, they aren't
245 realy.
246 .SH "SEE ALSO"
247 .IX Header "SEE ALSO"
248 rrdgraph gives an overview of how \fBrrdtool graph\fR works.
249 rrdgraph_data describes \fB\s-1DEF\s0\fR,\fB\s-1CDEF\s0\fR and \fB\s-1VDEF\s0\fR in detail.
250 rrdgraph_rpn describes the \fB\s-1RPN\s0\fR language used in the \fB?DEF\fR statements.
251 rrdgraph_graph page describes all of the graph and print functions.
252 .PP
253 Make sure to read rrdgraph_examples for tips&tricks.
254 .SH "AUTHOR"
255 .IX Header "AUTHOR"
256 Program by Tobias Oetiker <tobi@oetiker.ch>
257 .PP
258 This manual page by Alex van den Bogaerdt <alex@vandenbogaerdt.nl>
259 with corrections and/or additions by several people