fixed format
[rrdtool.git] / doc / rrdgraph.src
1 =head1 NAME
2
3 =cut
4
5 WARNING: DO NOT EDIT THE POD FILES. THEY ARE AUTO-GENERATED
6
7 =pod
8
9 rrdgraph - Round Robin Database tool grapher functions
10
11 =include name
12
13 =head1 SYNOPSIS
14
15 B<rrdtool graph> I<filename>
16 [I<L<option|rrdgraph/OPTIONS>> ...]
17 [I<L<data definition|rrdgraph_data/DEF>> ...]
18 [I<L<data calculation|rrdgraph_data/CDEF>> ...]
19 [I<L<variable definition|rrdgraph_data/VDEF>> ...]
20 [I<L<graph element|rrdgraph_graph/GRAPH>> ...]
21 [I<L<print element|rrdgraph_graph/PRINT>> ...]
22
23 =head1 DESCRIPTION
24
25 The B<graph> function of B<RRDtool> is used to present the
26 data from an B<RRD> to a human viewer.  Its main purpose is to
27 create a nice graphical representation but it can also generate
28 a numerical report.
29
30 =head1 OVERVIEW
31
32 B<rrdtool graph> needs data to work with, use one or more
33 B<L<data definition|rrdgraph_data/DEF>> statements to collect this
34 data.  You are not limited to one database, it's perfectly legal to
35 collect data from two or more databases (one per statement though).
36
37 If you want to display averages, maxima, percentiles etcetera
38 it is best to collect them now using the
39 B<L<variable definition|rrdgraph_data/VDEF>> statement.
40 Currently this makes no difference but in a future version
41 of rrdtool you may want to collect these values before consolidation.
42
43 The data fetched from the B<RRA> is then B<consolidated> so that
44 there is exactly one datapoint per pixel in the graph. If you do
45 not take care yourself, B<RRDtool> will expand the range slightly
46 if necessary (in that case the first and/or last pixel may very
47 well become unknown!).
48
49 Sometimes data is not exactly as you would like to display it. For
50 instance, you might be collecting B<bytes> per second but want to
51 display B<bits> per second. This is where the
52 B<L<data calculation|rrdgraph_data/CDEF>> command is designed for.
53 After B<consolidating> the data, a copy is made and this copy is
54 modified using a rather flexible B<L<RPN|rrdgraph_rpn/>> command
55 set.
56
57 When you are done fetching and processing the data, it is time to
58 graph it (or print it).  This ends the B<rrdtool graph> sequence.
59
60 =head1 OPTIONS
61
62 =over 4
63
64 =item filename
65
66 The name and path of the graph to generate. It is recommended to
67 end this in C<.png>, C<.svg> or C<.eps> but B<RRDtool> does not enforce this.
68
69 I<filename> can be 'C<->' to send the image to C<stdout>. In
70 that case, no other output is generated.  
71
72 =item Time range
73
74 [B<-s>|B<--start> I<time>]
75 [B<-e>|B<--end> I<time>]
76 [B<-S>|B<--step> I<seconds>]
77
78 The start and end of what you would like to display, and which
79 B<RRA> the data should come from.  Defaults are: 1 day ago until
80 now, with the best possible resolution. B<Start> and B<end> can 
81 be specified in several formats, see
82 L<AT-STYLE TIME SPECIFICATION|rrdfetch/> and L<rrdgraph_examples>.
83 By default, B<rrdtool graph> calculates the width of one pixel in
84 the time domain and tries to get data from an B<RRA> with that
85 resolution.  With the B<step> option you can alter this behaviour.
86 If you want B<rrdtool graph> to get data at a one-hour resolution
87 from the B<RRD>, set B<step> to 3600.  Note: a step smaller than
88 one pixel will silently be ignored.
89
90 =item Labels
91
92 [B<-t>|B<--title> I<string>]
93 [B<-v>|B<--vertical-label> I<string>]
94
95 A horizontal string at the top of the graph and/or a vertically
96 placed string at the left hand side of the graph.
97
98 =item Size
99
100 [B<-w>|B<--width> I<pixels>]
101 [B<-h>|B<--height> I<pixels>]
102 [B<-j>|B<--only-graph>]
103
104 The width and height of the B<canvas> (the part of the graph with
105 the actual lines and such). Defaults are 400 pixels by 100 pixels.
106
107 If you specify the B<--only-graph> option and set the height E<lt> 32
108 pixels you will get a tiny graph image to use as an icon in a potential
109 overview. All labeling will be stripped off the graph.
110
111 =item Limits
112
113 [B<-u>|B<--upper-limit> I<value>]
114 [B<-l>|B<--lower-limit> I<value>]
115 [B<-r>|B<--rigid>]
116
117 By default the graph will be autoscaling so that it displays the
118 portion of the y-axis that is actually used. You can change this
119 behaviour by setting the limits.  The displayed y-axis will show
120 at least from B<lower-limit> to B<upper-limit>.  Autoscaling will
121 still permit those boundaries to be stretched unless the B<rigid>
122 option is set.
123
124 [B<-A>|B<--alt-autoscale>]
125
126 Sometimes the default algorithm for selecting the y-axis scale is not
127 performing very well.  Normally the scale is selected from a predefined
128 set of ranges and this fails miserably when you need to graph something
129 like C<260 + 0.001 * sin(x)>. This option calculates the minimum and
130 maximum y-axis from the actual minimum and maximum values. Our example
131 would display slightly less than C<260-0.001> to slightly more than
132 C<260+0.001> (Contributed by Sasha Mikheev).
133
134 [B<-M>|B<--alt-autoscale-max>]
135
136 Where C<--alt-autoscale> will modify both the absolute maximum AND minimum
137 values, this option will only affect the maximum value. The minimum
138 value, if not defined on the command line, will be 0. This option can
139 be useful when graphing router traffic when the WAN line uses compression,
140 and thus the throughput may be higher than the WAN line speed.
141
142 [B<-N>|B<--no-gridfit>]
143
144 To avoid anti-aliasing effects gridlines are placed on 
145 integer pixel values. This is by default done by extending 
146 the scale so gridlines happens to be spaced using an 
147 integer number of pixels, and starts on integer pixel value.
148 This might extend the scale too much for some logarithmic scales
149 and for linear scales where B<--alt-autoscale> is needed.
150 Using B<--no-gridfit> disables modification of the scale.
151
152 =item Grid
153
154 =over 4
155
156 =item X-Axis
157
158 [B<-x>|B<--x-grid> I<GTM>B<:>I<GST>B<:>I<MTM>B<:>I<MST>B<:>I<LTM>B<:>I<LST>B<:>I<LPR>B<:>I<LFM>]
159
160 [B<-x>|B<--x-grid> B<none>]
161
162 The x-axis label is quite complex to configure, if you don't have
163 very special needs it is probably best to rely on the autoconfiguration
164 to get this right.  You can specify the string C<none> to skip the grid
165 and labels altogether.
166
167 The grid is defined by specifying a certain amount of time in the I<?TM>
168 positions. You can choose from C<SECOND>, C<MINUTE>, C<HOUR>, C<DAY>,
169 C<WEEK>, C<MONTH> or C<YEAR>. Then you define how many of these should
170 pass between each line or label.  This pair (I<?TM:?ST>) needs to be
171 specified for the base grid (I<G??>), the major grid (I<M??>) and the
172 labels (I<L??>). For the labels you also need to define a precision
173 in I<LPR> and a I<strftime> format string in I<LFM>.  I<LPR> defines
174 where each label will be placed. If it is zero, the label will be
175 placed right under the corresponding line (useful for hours, dates
176 etcetera).  If you specify a number of seconds here the label is
177 centered in this interval (useful for Monday, January etcetera).
178
179 Example: C<--x-grid MINUTE:10:HOUR:1:HOUR:4:0:%X>
180
181 This places grid lines every 10 minutes, major grid lines every hour
182 and labels every 4 hours. The labels are placed under the major grid
183 lines as they specify exactly that time.
184
185 Example: C<--x-grid HOUR:8:DAY:1:DAY:1:0:%A>
186
187 This places grid lines every 8 hours, major grid lines and labels
188 each day. The labels are placed exactly between two major grid lines
189 as they specify the complete day and not just midnight.
190
191 =item Y-Axis
192
193 [B<-y>|B<--y-grid> I<grid step>B<:>I<label factor>]
194
195 [B<-y>|B<--y-grid> B<none>]
196
197 Y-axis grid lines appear at each I<grid step> interval.  Labels are
198 placed every I<label factor> lines.  You can specify C<-y none> to
199 skip the grid and labels altogether.  The default for this option is
200 to automatically select sensible values.
201
202 [B<-Y>|B<--alt-y-grid>]
203
204 Place Y grid dynamically based on graph Y range. Algorithm ensures
205 that you always have grid, that there are enough but not too many
206 grid lines and the grid is metric. That is grid lines are placed
207 every 1, 2, 5 or 10 units.  (contributed by Sasha Mikheev)
208
209 [B<-o>|B<--logarithmic>]
210
211 Logarithmic y-axis scaling.
212
213 [B<-X>|B<--units-exponent> I<value>]
214
215 This sets the 10**exponent scaling of the y-axis values.  Normally
216 values will be scaled to the appropriate units (k, M, etc.).  However
217 you may wish to display units always in k (Kilo, 10e3) even if the data
218 is in the M (Mega, 10e6) range for instance.  Value should be an
219 integer which is a multiple of 3 between -18 and 18 inclusive.  It is
220 the exponent on the units you which to use.  For example, use 3 to
221 display the y-axis values in k (Kilo, 10e3, thousands), use -6 to
222 display the y-axis values in u (Micro, 10e-6, millionths).  Use a value
223 of 0 to prevent any scaling of the y-axis values.
224
225 This option is very effective at confusing the heck out of the default
226 rrdtool autoscaler and grid painter. If rrdtool detects that it is not
227 successful in labeling the graph under the given circumstances, it will switch
228 to the more robust B<--alt-y-grid> mode.
229
230 [B<-L>|B<--units-length> I<value>]
231
232 How many digits should rrdtool assume the y-axis labels to be ? You may have to use this option
233 to make enough space once you start fideling with the y-axis labeling.
234
235 =back
236
237 =item Miscellaneous
238
239 [B<-z>|B<--lazy>]
240
241 Only generate the graph, if the current graph is out of date or not
242 existent.
243
244 [B<-f>|B<--imginfo> I<printfstr>]
245
246 After the image has been created, the graph function uses printf
247 together with this format string to create output similar to the PRINT
248 function, only that the printf is supplied with the parameters
249 I<filename>, I<xsize> and I<ysize>. In order to generate an B<IMG> tag
250 suitable for including the graph into a web page, the command line
251 would look like this:
252
253  --imginfo '<IMG SRC="/img/%s" WIDTH="%lu" HEIGHT="%lu" ALT="Demo">'
254
255 [B<-c>|B<--color> I<COLORTAG>#I<rrggbb>[I<aa>]]
256
257 Override the default colors for the standard elements of the graph. The
258 I<COLORTAG> is one of C<BACK> background, C<CANVAS> for the background of
259 the actual graph, C<SHADEA> for the left and top border, C<SHADEB> for the
260 right and bottom border, C<GRID>, C<MGRID> for the major grid, C<FONT> for
261 the color of the font, C<AXIS> for the axis of the graph and finaly C<ARROW>
262 for the arrow head pointing to the future. Each color is composed out of
263 three hexadecimal numbers specifying its color component (00 is off, FF is
264 maximum) of red, green and blue. Optionally you may add another hexadecimal
265 number specifying the transparency (FF is solid). You may set this option
266 several times to alter multiple defaults.
267
268 A green arrow is made by: C<--color ARROW:00FF00>
269
270 [B<--zoom> I<factor>]
271
272 Zoom the graphics by the given amount ... The factor must be E<gt> 0
273
274 [B<-n>|B<--font> I<FONTTAG>B<:>I<size>B<:>I<font>]
275
276 Lets you customize which font to use for the various text elements on the
277 RRD graphs. C<DEFAULT> sets the default value for all elements C<TITLE>,
278 C<AXIS> for the axis labels, C<UNIT> for the vertical unit label, C<LEGEND>
279 for the graph legend.
280
281 Use Times for the title: C<--font TITLE:13:/usr/lib/fonts/times.ttf>
282
283 RRDtool comes with a preset default font. You can set the environment
284 variable C<RRD_DEFAULT_FONT> if you want to change this.
285
286 Truetype fonts are only supported for PNG output. See below.
287
288 [B<-a>|B<--imgformat> B<PNG>|B<SVG>|B<EPS>|B<PDF>]
289
290 Image format for the generated graph. For the vector formats you can choose among the standard Postscript fonts
291 Courier-Bold, Courier-BoldOblique, Courier-Oblique, Courier, Helvetica-Bold,
292 Helvetica-BoldOblique, Helvetica-Oblique, Helvetica, Symbol, Times-Bold, Times-BoldItalic,
293 Times-Italic, Times-Roman, ZapfDingbats 
294
295 [B<-i>|B<--interlaced>]
296
297 If images are interlaced they become visible on browsers more quickly.
298
299 [B<-g>|B<--no-legend>]
300
301 Suppress generation of legend; only render the graph.
302
303 [B<-F>|B<--force-rules-legend>]
304
305 Force the generation of HRULE and VRULE legend even if those HRULE or VRULE will not be drawn because out of graph boundaries (mimics behaviour of pre 1.0.42 versions).
306
307 [B<-T>|B<--tabwidth> I<value>]
308
309 By default the tab-width is 40 pixels, use this option to change it.
310
311 [B<-b>|B<--base> I<value>]
312
313 If you are graphing memory (and NOT network traffic) this switch
314 should be set to 1024 so that one Kb is 1024 byte. For traffic
315 measurement, 1 kb/s is 1000 b/s.
316
317 =item Data and variables
318
319 B<DEF:>I<vname>B<=>I<rrdfile>B<:>I<ds-name>B<:>I<CF>[B<:step=>I<step>][B<:start=>I<time>][B<:end=>I<time>]
320
321 B<CDEF:>I<vname>B<=>I<RPN expression>
322
323 B<VDEF:>I<vname>B<=>I<RPN expression>
324
325 You need at least one B<DEF> statement to generate anything. The
326 other statements are useful but optional.
327 See L<rrdgraph_data> and L<rrdgraph_rpn> for exact format.
328
329 =item Graph and print elements
330
331 You need at least one graph element to generate an image and/or
332 at least one print statement to generate a report.
333 See L<rrdgraph_graph> for exact format.
334
335 =back
336
337 =include see_also