5 B<rrdtool graph> I<filename>
6 [E<lt>B<L<option|rrdgraph/OPTIONS>>E<gt> ...]
7 E<lt>B<L<data definition|rrdgraph_data/DEF>>E<gt>
8 [E<lt>B<L<data definition|rrdgraph_data/DEF>>E<gt> ...]
9 [E<lt>B<L<data calculation|rrdgraph_data/CDEF>>E<gt> ...]
10 [E<lt>B<L<variable definition|rrdgraph_data/VDEF>>E<gt> ...]
11 [E<lt>B<L<graph element|rrdgraph_graph/GRAPH>>E<gt> ...]
12 [E<lt>B<L<print element|rrdgraph_graph/PRINT>>E<gt> ...]
16 The B<graph> function of B<RRDtool> is used to represent the
17 data from an B<RRD> to a human viewer. Its main purpose is to
18 create a nice graphical representation but it can also generate
23 B<rrdtool graph> needs data to work with, use one or more
24 B<L<data definition|rrdgraph_data/DEF>> statements to collect this
25 data. You are not limited to one database, it's perfectly legal to
26 collect data from two or more databases (one per statement though).
28 If you want to display averages, maxima, percentiles etcetera
29 it is best to collect them now using the
30 B<L<variable definition|rrdgraph_data/VDEF>> statement. At this
31 stage, this command works at the unprocessed data from the B<RRD>.
32 I<(Note: this is not yet true; it works on consolidated information
35 The data fetched from the B<RRA> is then B<consolidated> so that
36 there is exactly one datapoint per pixel in the graph. If you do
37 not take care yourself, B<RRDtool> will expand the range slightly
38 if necessary (in that case the first pixel may very well become
41 Sometimes data is not exactly as you would like to display it. For
42 instance, you might be collecting B<bytes> per second but want to
43 display B<bits> per second. This is where the
44 B<L<data calculation|rrdgraph_data/CDEF>> command is designed for.
45 After B<consolidating> the data, a copy is made and this copy is
46 modified using a rather flexible B<L<RPN|rrdgraph_rpn/>> command
47 set. If you use B<L<variable definition|rrdgraph_data/VDEF>>
48 statements after this, they work on the consolidated data and may
49 return other values for maximum, minimum etcetera!
51 When you are done fetching and processing the data, it is time to
52 graph it (or print it). This ends the B<rrdtool graph> sequence.
56 It is expected that most options will move to the graph definition
57 statements (after all, most of them do define graph elements...).
63 The name and path of the graph to generate. It is recommended to
64 end this in C<.png>, C<.svg> or C<.eps> but B<rrdtool> does not enforce this.
66 I<filename> can be 'C<->' to send the image to C<stdout>. In
67 that case, no other output is generated.
73 B<[-s|--start E<lt>timeE<gt>]>
74 B<[-e|--end E<lt>timeE<gt>]>
75 B<[--step E<lt>secondsE<gt>]>
77 The start and end of what you would like to display, and which
78 B<RRA> the data should come from. Defaults are: 1 day ago until
79 now, with the best possible resolution. B<Start> and B<end> can
80 be specified in several formats, see
81 L<AT-STYLE TIME SPECIFICATION|rrdfetch/> and L<rrdgraph_examples>.
82 By default, B<rrdtool graph> calculates the width of one pixel in
83 the time domain and tries to get data from an B<RRA> with that
84 resolution. With the B<step> option you can alter this behaviour.
85 If you want B<rrdtool graph> to get data at a one-hour resolution
86 from the B<RRD>, set B<step> to 3600. Note: a step smaller than
87 one pixel will silently be ignored.
93 B<[-t|--title E<lt>stringE<gt>]>
94 B<[-v|--vertical-label E<lt>stringE<gt>]>
96 A horizontal string at the top of the graph and/or a vertically
97 placed string at the left hand side of the graph. I<New: (not
98 yet implemented)> The string can contain formatter options that
99 are used to include variables (from B<VDEF>s) and newlines.
105 B<[-w|--width E<lt>pixelsE<gt>]>
106 B<[-h|--heigth E<lt>pixelsE<gt>]>
108 The width and height of the B<canvas> (the part of the graph with
109 the actual lines and such). Defaults are 400 pixels by 100 pixels.
115 I<Old behaviour, until the new options are implemented>
116 B<[-u|--upper-limit E<lt>valueE<gt>]>
117 B<[-l|--lower-limit E<lt>valueE<gt>]>
120 By default the graph will be autoscaling so that it displays the
121 portion of the y-axis that is actually used. You can change this
122 behaviour by setting the limits. The displayed y-axis will show
123 at least from B<lower-limit> to B<upper-limit>. Autoscaling will
124 still permit those boundaries to be stretched unless the B<rigid>
127 I<New behaviour, after the new options are implemented>
128 B<[--maximum-upper-limit E<lt>valueE<gt>]>
129 B<[--minimum-upper-limit E<lt>valueE<gt>]>
130 B<[--maximum-lower-limit E<lt>valueE<gt>]>
131 B<[--minimum-lower-limit E<lt>valueE<gt>]>
133 By default the graph will be autoscaling so that it displays the
134 portion of the y-axis that is actually used. You can change this
135 behaviour by setting the limits. The displayed y-axis will show
136 at most B<maximum-upper-limit> and at least B<minimum-upper-limit>
137 at the top, and similarily at least B<maximum-lower-limit> and
138 at most B<minimum-lower-limit> at the bottom. The default is to
139 display at most B<infinity> (so: no limit) and at least
140 B<negative infinity> (no minimal value) at the top. The bottom of
141 the graph has similar defaults. Note that the minimum lower limit
142 is the lowest one so you should compare this with maximum upper
143 limit when you try to figure out what you should set.
145 To make sure the graph shows the range of I<-1000> to I<2000>,
146 optionally expanding to no more than I<-3000> to I<4000>,
147 set the following options:
149 --maximum-upper-limit 4000 --minimum-upper-limit 2000
150 --maximum-lower-limit -1000 --minimum-lower-limit -3000
152 To mimic the old B<rigid> option, you can do:
154 --maximum-upper-limit 4000 --minimum-upper-limit 4000
155 --maximum-lower-limit -3000 --minimum-lower-limit -3000
159 Sometimes the default algorithm for selecting the y-axis scale is not
160 performing very well. Normally the scale is selected from a predefined
161 set of ranges and this fails miserably when you need to graph something
162 like C<260 + 0.001 * sin(x)>. This option calculates the minimum and
163 maximum y-axis from the actual minimum and maximum values. Our example
164 would display slightly less than C<260-0.001> to slightly more than
165 C<260+0.001> (Contributed by Sasha Mikheev).
167 B<[--alt-autoscale-max]>
169 Where C<--alt-autoscale> will modify both the absolute maximum AND minimum
170 values, this option will only affect the maximum value. The minimum
171 value, if not defined on the command line, will be 0. This option can
172 be useful when graphing router traffic when the WAN line uses compression,
173 and thus the throughput may be higher than the WAN line speed.
177 To avoid antialiasing effects gridlines are placed on
178 integer pixel values. This is by default done by extending
179 the scale so gridlines happends to be spaced using an
180 integer number of pixels, and starts on integer pixel value.
181 This might extend the scale too much for some logarithmic scales
182 and for linear scales where --alt-autoscale is needed.
183 Using --no-gridfit disables modification of the scale,
184 and just truncates y-coordinates to integer values for bitmap
195 B<[-x|--x-grid E<lt>I<GTMC<:>GSTC<:>MTMC<:>MSTC<:>LTMC<:>LSTC<:>LPRC<:>LFM>E<gt>]>
197 B<[-x|--x-grid C<none>]>
199 The x-axis label is quite complex to configure, if you don't have
200 very special needs it is probably best to rely on the autoconfiguration
201 to get this right. You can specify the string C<none> to skip the grid
202 and labels altogether.
204 The grid is defined by specifying a certain amount of time in the I<?TM>
205 positions. You can choose from C<SECOND>, C<MINUTE>, C<HOUR>, C<DAY>,
206 C<WEEK>, C<MONTH> or C<YEAR>. Then you define how many of these should
207 pass between each line or label. This pair (I<?TM:?ST>) needs to be
208 specified for the base grid (I<G??>), the major grid (I<M??>) and the
209 labels (I<L??>). For the labels you also need to define a precision
210 in I<LPR> and a I<strftime> format string in I<LFM>. I<LPR> defines
211 where each label will be placed. If it is zero, the label will be
212 placed right under the corresponding line (useful for hours, dates
213 etcetera). If you specify a number of seconds here the label is
214 centered in this interval (useful for monday, januari etcetera).
216 Example: C<--x-grid MINUTE:10:HOUR:1:HOUR:4:0:%X>
218 This places grid lines every 10 minutes, major grid lines every hour
219 and labels every 4 hours. The labels are placed under the major grid
220 lines as they specify exactly that time.
222 Example: C<--x-grid HOUR:8:DAY:1:DAY:1:0:%A>
224 This places grid lines every 8 hours, major grid lines and labels
225 each day. The labels are placed exactly between two major grid lines
226 as they specify the complete day and not just midnight.
232 B<[-y|--y-grid I<E<lt>grid stepE<gt>:E<lt>label factorE<gt>>]>
234 B<[-y|--y-grid C<none>]>
236 Y-axis grid lines appear at each I<grid step> interval. Labels are
237 placed every I<label factor> lines. You can specify C<-y none> to
238 skip the grid and labels altogether. The default for this option is
239 to automatically select sensible values.
243 Place Y grid dynamically based on graph Y range. Algorithm ensures
244 that you always have grid, that there are enough but not too many
245 grid lines and the grid is metric. That is grid lines are placed
246 every 1, 2, 5 or 10 units. (contributed by Sasha Mikheev)
248 B<[-o|--logarithmic]>
250 Logarithmic y-axis scaling.
252 B<[--units-exponent E<lt>valueE<gt>]>
254 This sets the 10**exponent scaling of the y-axis values. Normally
255 values will be scaled to the appropriate units (k, M, etc.). However
256 you may wish to display units always in k (Kilo, 10e3) even if the data
257 is in the M (Mega, 10e6) range for instance. Value should be an
258 integer which is a multiple of 3 between -18 and 18 inclusive. It is
259 the exponent on the units you which to use. For example, use 3 to
260 display the y-axis values in k (Kilo, 10e3, thousands), use -6 to
261 display the y-axis values in u (Micro, 10e-6, millionths). Use a value
262 of 0 to prevent any scaling of the y-axis values.
274 Only generate the graph, if the current graph is out of date or not
277 B<[-f|--imginfo E<lt>printfstrE<gt>]>
279 After the image has been created, the graph function uses printf
280 together with this format string to create output similar to the PRINT
281 function, only that the printf is supplied with the parameters
282 I<filename>, I<xsize> and I<ysize>. In order to generate an B<IMG> tag
283 suitable for including the graph into a web page, the command line
284 would look like this:
286 --imginfo '<IMG SRC="/img/%s" WIDTH="%lu" HEIGHT="%lu" ALT="Demo">'
288 B<[-c|--color I<COLORTAG>#I<rrggbb>[I<aa>]]>
290 Override the default colors for the standard elements of the graph.
291 The I<COLORTAG> is one of C<BACK> ground, C<CANVAS>, C<SHADEA> for the
292 left and top border, C<SHADEB> for the right and bottom border, C<GRID>,
293 C<MGRID> for the major grid, C<FONT>, C<FRAME> and axis, C<ARROW>.
294 Each color is composed out of three hexadecimal numbers specifying
295 its color component (00 is off, FF is maximum) of red, green and blue.
296 Optionally you may add another hexademimal number specifying the
297 transparency (FF is solid).
298 You may set this option several times to alter multiple defaults.
300 A green arrow is made by: C<--color ARROW:00FF00>
302 B<[--zoom I<factor>]>
304 Zoom the graphics by the given amount ... The factor must be E<gt> 0
306 B<[-n|--font I<FONTTAG>B<:>I<size>B<:>I<font>]>
308 Lets you customize which font to use for the various text elements on the
309 rrd graphs. C<DEFAULT> sets the default value for all elements C<TITLE>,
310 C<AXIS> for the axis labels, C<UNIT> for the vertical unit label, C<LEGEND>
311 for the graph legend.
313 Use Times for the title: C<--font TITLE:13:/usr/lib/fonts/times.ttf>
315 B<[-a|--imgformat C<PNG>|C<SVG>|C<EPS>|C<PDF>]>
317 Image format for the generated graph.
321 If images are interlaced they become visible on browsers more quickly.
325 Suppress generation of legend; only render the graph.
327 B<[-b|--base E<lt>valueE<gt>]>
329 If you are graphing memory (and NOT network traffic) this switch
330 should be set to 1024 so that one Kb is 1024 byte. For traffic
331 measurement, 1 kb/s is 1000 b/s.
335 =item Data and variables
337 B<DEF:>I<E<lt>vnameE<gt>>=I<E<lt>rrdfileE<gt>>:I<E<lt>ds-nameE<gt>>:I<E<lt>CFE<gt>>[:[I<E<lt>time rangeE<gt>>][:I<E<lt>step timeE<gt>>]]
339 B<CDEF:>I<E<lt>vnameE<gt>>=I<E<lt>RPN expressionE<gt>>
341 B<VDEF:>I<E<lt>vnameE<gt>>=I<E<lt>RPN expressionE<gt>>
343 You need at least one B<DEF> statement to generate anything. The
344 other statements are useful but optional.
345 See L<rrdgraph_data> and L<rrdgraph_rpn> for exact format.
349 =item Graph and print elements
351 You need at least one graph element to generate an image and/or
352 at least one print statement to generate a report.
353 See L<rrdgraph_graph> for exact format.