1RRDGRAPH(1) rrdtool RRDGRAPH(1)
2
3
4
6 rrdgraph - Round Robin Database tool grapher functions
7
9 rrdtool graph|graphv filename [option ...] [data definition ...]
10 [data calculation ...] [variable definition ...] [graph element ...]
11 [print element ...]
12
14 The graph function of RRDtool is used to present the data from an RRD
15 to a human viewer. Its main purpose is to create a nice graphical
16 representation, but it can also generate a numerical report.
17
19 rrdtool graph needs data to work with, so you must use one or more data
20 definition statements to collect this data. You are not limited to one
21 database, it's perfectly legal to collect data from two or more
22 databases (one per statement, though).
23
24 If you want to display averages, maxima, percentiles, etcetera it is
25 best to collect them now using the variable definition statement.
26 Currently this makes no difference, but in a future version of rrdtool
27 you may want to collect these values before consolidation.
28
29 The data fetched from the RRA is then consolidated so that there is
30 exactly one datapoint per pixel in the graph. If you do not take care
31 yourself, RRDtool will expand the range slightly if necessary. Note, in
32 that case the first and/or last pixel may very well become unknown!
33
34 Sometimes data is not exactly in the format you would like to display
35 it. For instance, you might be collecting bytes per second, but want to
36 display bits per second. This is what the data calculation command is
37 designed for. After consolidating the data, a copy is made and this
38 copy is modified using a rather powerful RPN command set.
39
40 When you are done fetching and processing the data, it is time to graph
41 it (or print it). This ends the rrdtool graph sequence.
42
44 graphv
45 This alternate version of graph takes the same arguments and performs
46 the same function. The v stands for verbose, which describes the output
47 returned. graphv will return a lot of information about the graph using
48 the same format as rrdtool info (key = value). See the bottom of the
49 document for more information.
50
51 filename
52 The name and path of the graph to generate. It is recommended to end
53 this in ".png", ".svg" or ".eps", but RRDtool does not enforce this.
54
55 filename can be '"-"' to send the image to "stdout". In this case, no
56 other output is generated.
57
58 Time range
59 [-s|--start time] [-e|--end time] [-S|--step seconds]
60
61 The start and end of the time series you would like to display, and
62 which RRA the data should come from. Defaults are: 1 day ago until
63 now, with the best possible resolution. Start and end can be specified
64 in several formats, see AT-STYLE TIME SPECIFICATION and
65 rrdgraph_examples. By default, rrdtool graph calculates the width of
66 one pixel in the time domain and tries to get data from an RRA with
67 that resolution. With the step option you can alter this behaviour.
68 If you want rrdtool graph to get data at a one-hour resolution from the
69 RRD, set step to 3'600. Note: a step smaller than one pixel will
70 silently be ignored.
71
72 Labels
73 [-t|--title string] [-v|--vertical-label string]
74
75 A horizontal string at the top of the graph and/or a vertically placed
76 string at the left hand side of the graph.
77
78 Right Axis
79 [--right-axis scale:shift] [--right-axis-label label]
80
81 A second axis will be drawn to the right of the graph. It is tied to
82 the left axis via the scale and shift parameters. You can also define a
83 label for the right axis.
84
85 [--right-axis-format format-string]
86
87 By default the format of the axis lables gets determined automatically.
88 If you want todo this your self, use this option with the same %lf
89 arguments you know from the PRING and GPRINT commands.
90
91 Size
92 [-w|--width pixels] [-h|--height pixels] [-j|--only-graph]
93 [-D|--full-size-mode]
94
95 By default, the width and height of the canvas (the part with the
96 actual data and such). This defaults to 400 pixels by 100 pixels.
97
98 If you specify the --full-size-mode option, the width and height
99 specify the final dimensions of the output image and the canvas is
100 automatically resized to fit.
101
102 If you specify the --only-graph option and set the height < 32 pixels
103 you will get a tiny graph image (thumbnail) to use as an icon for use
104 in an overview, for example. All labeling will be stripped off the
105 graph.
106
107 Limits
108 [-u|--upper-limit value] [-l|--lower-limit value] [-r|--rigid]
109
110 By default the graph will be autoscaling so that it will adjust the
111 y-axis to the range of the data. You can change this behaviour by
112 explicitly setting the limits. The displayed y-axis will then range at
113 least from lower-limit to upper-limit. Autoscaling will still permit
114 those boundaries to be stretched unless the rigid option is set.
115
116 [-A|--alt-autoscale]
117
118 Sometimes the default algorithm for selecting the y-axis scale is not
119 satisfactory. Normally the scale is selected from a predefined set of
120 ranges and this fails miserably when you need to graph something like
121 "260 + 0.001 * sin(x)". This option calculates the minimum and maximum
122 y-axis from the actual minimum and maximum data values. Our example
123 would display slightly less than "260-0.001" to slightly more than
124 "260+0.001" (this feature was contributed by Sasha Mikheev).
125
126 [-J|--alt-autoscale-min]
127
128 Where "--alt-autoscale" will modify both the absolute maximum AND
129 minimum values, this option will only affect the minimum value. The
130 maximum value, if not defined on the command line, will be 0. This
131 option can be useful when graphing router traffic when the WAN line
132 uses compression, and thus the throughput may be higher than the WAN
133 line speed.
134
135 [-M|--alt-autoscale-max]
136
137 Where "--alt-autoscale" will modify both the absolute maximum AND
138 minimum values, this option will only affect the maximum value. The
139 minimum value, if not defined on the command line, will be 0. This
140 option can be useful when graphing router traffic when the WAN line
141 uses compression, and thus the throughput may be higher than the WAN
142 line speed.
143
144 [-N|--no-gridfit]
145
146 In order to avoid anti-aliasing blurring effects rrdtool snaps points
147 to device resolution pixels, this results in a crisper appearance. If
148 this is not to your liking, you can use this switch to turn this
149 behaviour off.
150
151 Gridfitting is turned off for PDF, EPS, SVG output by default.
152
153 Grid
154 X-Axis
155 [-x|--x-grid GTM:GST:MTM:MST:LTM:LST:LPR:LFM]
156
157 [-x|--x-grid none]
158
159 The x-axis label is quite complex to configure. If you don't have
160 very special needs it is probably best to rely on the
161 autoconfiguration to get this right. You can specify the string
162 "none" to suppress the grid and labels altogether.
163
164 The grid is defined by specifying a certain amount of time in the
165 ?TM positions. You can choose from "SECOND", "MINUTE", "HOUR",
166 "DAY", "WEEK", "MONTH" or "YEAR". Then you define how many of these
167 should pass between each line or label. This pair (?TM:?ST) needs
168 to be specified for the base grid (G??), the major grid (M??) and
169 the labels (L??). For the labels you also must define a precision
170 in LPR and a strftime format string in LFM. LPR defines where each
171 label will be placed. If it is zero, the label will be placed right
172 under the corresponding line (useful for hours, dates etcetera).
173 If you specify a number of seconds here the label is centered on
174 this interval (useful for Monday, January etcetera).
175
176 --x-grid MINUTE:10:HOUR:1:HOUR:4:0:%X
177
178 This places grid lines every 10 minutes, major grid lines every
179 hour, and labels every 4 hours. The labels are placed under the
180 major grid lines as they specify exactly that time.
181
182 --x-grid HOUR:8:DAY:1:DAY:1:86400:%A
183
184 This places grid lines every 8 hours, major grid lines and labels
185 each day. The labels are placed exactly between two major grid
186 lines as they specify the complete day and not just midnight.
187
188 Y-Axis
189 [-y|--y-grid grid step:label factor]
190
191 [-y|--y-grid none]
192
193 Y-axis grid lines appear at each grid step interval. Labels are
194 placed every label factor lines. You can specify "-y none" to
195 suppress the grid and labels altogether. The default for this
196 option is to automatically select sensible values.
197
198 If you have set --y-grid to 'none' not only the labels get
199 suppressed, also the space reserved for the labels is removed. You
200 can still add space manually if you use the --units-length command
201 to explicitly reserve space.
202
203 [-Y|--alt-y-grid]
204
205 Place the Y grid dynamically based on the graph's Y range. The
206 algorithm ensures that you always have a grid, that there are
207 enough but not too many grid lines, and that the grid is metric.
208 That is the grid lines are placed every 1, 2, 5 or 10 units. This
209 parameter will also ensure that you get enough decimals displayed
210 even if your graph goes from 69.998 to 70.001. (contributed by
211 Sasha Mikheev).
212
213 [-o|--logarithmic]
214
215 Logarithmic y-axis scaling.
216
217 [-X|--units-exponent value]
218
219 This sets the 10**exponent scaling of the y-axis values. Normally,
220 values will be scaled to the appropriate units (k, M, etc.).
221 However, you may wish to display units always in k (Kilo, 10e3)
222 even if the data is in the M (Mega, 10e6) range, for instance.
223 Value should be an integer which is a multiple of 3 between -18 and
224 18 inclusively. It is the exponent on the units you wish to use.
225 For example, use 3 to display the y-axis values in k (Kilo, 10e3,
226 thousands), use -6 to display the y-axis values in u (Micro, 10e-6,
227 millionths). Use a value of 0 to prevent any scaling of the y-axis
228 values.
229
230 This option is very effective at confusing the heck out of the
231 default rrdtool autoscaler and grid painter. If rrdtool detects
232 that it is not successful in labeling the graph under the given
233 circumstances, it will switch to the more robust --alt-y-grid mode.
234
235 [-L|--units-length value]
236
237 How many digits should rrdtool assume the y-axis labels to be? You
238 may have to use this option to make enough space once you start
239 fideling with the y-axis labeling.
240
241 [--units=si]
242
243 With this option y-axis values on logarithmic graphs will be scaled
244 to the appropriate units (k, M, etc.) instead of using exponential
245 notation. Note that for linear graphs, SI notation is used by
246 default.
247
248 Miscellaneous
249 [-z|--lazy]
250
251 Only generate the graph if the current graph is out of date or not
252 existent. Note, that all the calculations will happen regardless so
253 that the output of PRINT and graphv will be complete regardless. Note
254 that the behaviour of lazy in this regard has seen several changes over
255 time. The only thing you can realy rely on before rrdtool 1.3.7 is that
256 lazy will not generate the graph when it is already there and up to
257 date, and also that it will output the size of the graph.
258
259 [-f|--imginfo printfstr]
260
261 After the image has been created, the graph function uses printf
262 together with this format string to create output similar to the PRINT
263 function, only that the printf function is supplied with the parameters
264 filename, xsize and ysize. In order to generate an IMG tag suitable for
265 including the graph into a web page, the command line would look like
266 this:
267
268 --imginfo '<IMG SRC="/img/%s" WIDTH="%lu" HEIGHT="%lu" ALT="Demo">'
269
270 [-c|--color COLORTAG#rrggbb[aa]]
271
272 Override the default colors for the standard elements of the graph. The
273 COLORTAG is one of "BACK" background, "CANVAS" for the background of
274 the actual graph, "SHADEA" for the left and top border, "SHADEB" for
275 the right and bottom border, "GRID", "MGRID" for the major grid, "FONT"
276 for the color of the font, "AXIS" for the axis of the graph, "FRAME"
277 for the line around the color spots, and finally "ARROW" for the arrow
278 head pointing up and forward. Each color is composed out of three
279 hexadecimal numbers specifying its rgb color component (00 is off, FF
280 is maximum) of red, green and blue. Optionally you may add another
281 hexadecimal number specifying the transparency (FF is solid). You may
282 set this option several times to alter multiple defaults.
283
284 A green arrow is made by: "--color ARROW#00FF00"
285
286 [--zoom factor]
287
288 Zoom the graphics by the given amount. The factor must be > 0
289
290 [-n|--font FONTTAG:size:[font]]
291
292 This lets you customize which font to use for the various text elements
293 on the RRD graphs. "DEFAULT" sets the default value for all elements,
294 "TITLE" for the title, "AXIS" for the axis labels, "UNIT" for the
295 vertical unit label, "LEGEND" for the graph legend, "WATERMARK" for the
296 watermark on the edge of the graph.
297
298 Use Times for the title: "--font TITLE:13:Times"
299
300 If you do not give a font string you can modify just the size of the
301 default font: "--font TITLE:13:".
302
303 If you specify the size 0 then you can modify just the font without
304 touching the size. This is especially useful for altering the default
305 font without resetting the default fontsizes: "--font
306 DEFAULT:0:Courier".
307
308 RRDtool comes with a preset default font. You can set the environment
309 variable "RRD_DEFAULT_FONT" if you want to change this.
310
311 RRDtool uses Pango for its font handling. This means you can to use the
312 full Pango syntax when selecting your font:
313
314 The font name has the form "[FAMILY-LIST] [STYLE-OPTIONS] [SIZE]",
315 where FAMILY-LIST is a comma separated list of families optionally
316 terminated by a comma, STYLE_OPTIONS is a whitespace separated list of
317 words where each WORD describes one of style, variant, weight, stretch,
318 or gravity, and SIZE is a decimal number (size in points) or optionally
319 followed by the unit modifier "px" for absolute size. Any one of the
320 options may be absent.
321
322 [-R|--font-render-mode {normal,light,mono}]
323
324 There are 3 font render modes:
325
326 normal: Full Hinting and Antialiasing (default)
327
328 light: Slight Hinting and Antialiasing
329
330 mono: Full Hinting and NO Antialiasing
331
332 [-B|--font-smoothing-threshold size]
333
334 (this gets ignored in 1.3 for now!)
335
336 This specifies the largest font size which will be rendered bitmapped,
337 that is, without any font smoothing. By default, no text is rendered
338 bitmapped.
339
340 [-P|--pango-markup]
341
342 All text in rrdtool is rendered using Pango. With the --pango-markup
343 option, all text will be processed by pango markup. This allows to
344 embed some simple html like markup tags using
345
346 <span key="value">text</span>
347
348 Apart from the verbose syntax, there are also the following short tags
349 available.
350
351 b Bold
352 big Makes font relatively larger, equivalent to <span size="larger">
353 i Italic
354 s Strikethrough
355 sub Subscript
356 sup Superscript
357 small Makes font relatively smaller, equivalent to <span size="smaller">
358 tt Monospace font
359 u Underline
360
361 More details on
362 <http://developer.gnome.org/doc/API/2.0/pango/PangoMarkupFormat.html>.
363
364 [-G|--graph-render-mode {normal,mono}]
365
366 There are 2 render modes:
367
368 normal: Graphs are fully Antialiased (default)
369
370 mono: No Antialiasing
371
372 [-E|--slope-mode]
373
374 RRDtool graphs are composed of stair case curves by default. This is in
375 line with the way RRDtool calculates its data. Some people favor a more
376 'organic' look for their graphs even though it is not all that true.
377
378 [-a|--imgformat PNG|SVG|EPS|PDF]
379
380 Image format for the generated graph. For the vector formats you can
381 choose among the standard Postscript fonts Courier-Bold, Courier-
382 BoldOblique, Courier-Oblique, Courier, Helvetica-Bold, Helvetica-
383 BoldOblique, Helvetica-Oblique, Helvetica, Symbol, Times-Bold, Times-
384 BoldItalic, Times-Italic, Times-Roman, and ZapfDingbats.
385
386 [-i|--interlaced]
387
388 (this gets ignored in 1.3 for now!)
389
390 If images are interlaced they become visible on browsers more quickly.
391
392 [-g|--no-legend]
393
394 Suppress generation of the legend; only render the graph.
395
396 [-F|--force-rules-legend]
397
398 Force the generation of HRULE and VRULE legends even if those HRULE or
399 VRULE will not be drawn because out of graph boundaries (mimics
400 behaviour of pre 1.0.42 versions).
401
402 [-T|--tabwidth value]
403
404 By default the tab-width is 40 pixels, use this option to change it.
405
406 [-b|--base value]
407
408 If you are graphing memory (and NOT network traffic) this switch should
409 be set to 1024 so that one Kb is 1024 byte. For traffic measurement, 1
410 kb/s is 1000 b/s.
411
412 [-W|--watermark string]
413
414 Adds the given string as a watermark, horizontally centered, at the
415 bottom of the graph.
416
417 Data and variables
418 DEF:vname=rrdfile:ds-name:CF[:step=step][:start=time][:end=time]
419
420 CDEF:vname=RPN expression
421
422 VDEF:vname=RPN expression
423
424 You need at least one DEF statement to generate anything. The other
425 statements are useful but optional. See rrdgraph_data and rrdgraph_rpn
426 for the exact format.
427
428 NOTE: Graph and print elements
429
430 You need at least one graph element to generate an image and/or at
431 least one print statement to generate a report. See rrdgraph_graph for
432 the exact format.
433
434 graphv
435 Calling rrdtool with the graphv option will return information in the
436 rrdtool info format. On the command line this means that all output
437 will be in key=value format. When used from the Perl and Ruby bindings
438 a hash pointer will be returned from the call.
439
440 When the filename '-' is given, the contents of the graph itself will
441 also be returned through this interface (hash key 'image'). On the
442 command line the output will look like this:
443
444 print[0] = "0.020833"
445 print[1] = "0.0440833"
446 graph_left = 51
447 graph_top = 22
448 graph_width = 400
449 graph_height = 100
450 graph_start = 1232908800
451 graph_end = 1232914200
452 image_width = 481
453 image_height = 154
454 value_min = 0.0000000000e+00
455 value_max = 4.0000000000e-02
456 image = BLOB_SIZE:8196
457 [... 8196 bytes of image data ...]
458
459 There is more information returned than in the standard interface.
460 Especially the 'graph_*' keys are new. They help applications that want
461 to know what is where on the graph.
462
464 rrdgraph gives an overview of how rrdtool graph works. rrdgraph_data
465 describes DEF,CDEF and VDEF in detail. rrdgraph_rpn describes the RPN
466 language used in the ?DEF statements. rrdgraph_graph page describes
467 all of the graph and print functions.
468
469 Make sure to read rrdgraph_examples for tips&tricks.
470
472 Program by Tobias Oetiker <tobi@oetiker.ch>
473
474 This manual page by Alex van den Bogaerdt <alex@vandenbogaerdt.nl> with
475 corrections and/or additions by several people
476
477
478
4791.3.8 2009-04-07 RRDGRAPH(1)