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