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 [--week-fmt strftime format string]
172
173 By default rrdtool uses "Week %V" to render the week number. With this
174 option you can define your own format, without completely overriding
175 the xaxis format.
176
177 Y-Axis
178 [-y|--y-grid grid step:label factor]
179
180 [-y|--y-grid none]
181
182 Y-axis grid lines appear at each grid step interval. Labels are placed
183 every label factor lines. You can specify "-y none" to suppress the
184 grid and labels altogether. The default for this option is to
185 automatically select sensible values.
186
187 If you have set --y-grid to 'none' not only the labels get suppressed,
188 also the space reserved for the labels is removed. You can still add
189 space manually if you use the --units-length command to explicitly
190 reserve space.
191
192 [--left-axis-formatter formatter-name]
193
194 Specify what formatter to use to render axis values.
195
196 numeric
197 The default, values are expressed as numeric quantities.
198
199 timestamp
200 Values are interpreted as unix timestamps (number of seconds since
201 1970-01-01 00:00:00 UTC) and expressed using strftime format
202 (default is '%Y-%m-%d %H:%M:%S'). See also --units-length and
203 --left-axis-format.
204
205 duration
206 Values are interpreted as duration in milliseconds. Formatting
207 follows the rules of valstrfduration qualified PRINT/GPRINT. See
208 rrdgraph_graph.
209
210 [--left-axis-format format-string]
211
212 By default the format of the axis labels gets determined automatically.
213 If you want to do this your self, use this option with the same %lf
214 arguments you know from the PRINT and GPRINT commands, or others if
215 using different formatter.
216
217 [-Y|--alt-y-grid]
218
219 Place the Y grid dynamically based on the graph's Y range. The
220 algorithm ensures that you always have a grid, that there are enough
221 but not too many grid lines, and that the grid is metric. That is the
222 grid lines are placed every 1, 2, 5 or 10 units. This parameter will
223 also ensure that you get enough decimals displayed even if your graph
224 goes from 69.998 to 70.001. (contributed by Sasha Mikheev).
225
226 [-o|--logarithmic]
227
228 Logarithmic y-axis scaling.
229
230 [-X|--units-exponent value]
231
232 This sets the 10**exponent scaling of the y-axis values. Normally,
233 values will be scaled to the appropriate units (k, M, etc.). However,
234 you may wish to display units always in k (Kilo, 10e3) even if the data
235 is in the M (Mega, 10e6) range, for instance. Value should be an
236 integer which is a multiple of 3 between -18 and 18 inclusively. It is
237 the exponent on the units you wish to use. For example, use 3 to
238 display the y-axis values in k (Kilo, 10e3, thousands), use -6 to
239 display the y-axis values in u (Micro, 10e-6, millionths). Use a value
240 of 0 to prevent any scaling of the y-axis values.
241
242 This option is very effective at confusing the heck out of the default
243 RRDtool autoscaling function and grid painter. If RRDtool detects that
244 it is not successful in labeling the graph under the given
245 circumstances, it will switch to the more robust --alt-y-grid mode.
246
247 [-L|--units-length value]
248
249 How many digits should RRDtool assume the y-axis labels to be? You may
250 have to use this option to make enough space once you start fiddling
251 with the y-axis labeling.
252
253 [--units=si]
254
255 With this option y-axis values on logarithmic graphs will be scaled to
256 the appropriate units (k, M, etc.) instead of using exponential
257 notation. Note that for linear graphs, SI notation is used by default.
258
259 Right Y Axis
260 [--right-axis scale:shift] [--right-axis-label label]
261
262 A second axis will be drawn to the right of the graph. It is tied to
263 the left axis via the scale and shift parameters. You can also define a
264 label for the right axis.
265
266 [--right-axis-formatter formatter-name]
267
268 Specify what formatter to use to render axis values.
269
270 numeric
271 The default, values are expressed as numeric quantities.
272
273 timestamp
274 Values are interpreted as unix timestamps (number of seconds since
275 1970-01-01 00:00:00 UTC) and expressed using strftime format
276 (default is '%Y-%m-%d %H:%M:%S'). See also --units-length and
277 --right-axis-format.
278
279 duration
280 Values are interpreted as duration in milliseconds. Formatting
281 follows the rules of valstrfduration qualified PRINT/GPRINT. See
282 rrdgraph_graph.
283
284 [--right-axis-format format-string]
285
286 By default the format of the axis labels gets determined automatically.
287 If you want to do this your self, use this option with the same %lf
288 arguments you know from the PRINT and GPRINT commands, or others if
289 using different formatter.
290
291 Legend
292 [-g|--no-legend]
293
294 Suppress generation of the legend; only render the graph.
295
296 [-F|--force-rules-legend]
297
298 Force the generation of HRULE and VRULE legends even if those HRULE or
299 VRULE will not be drawn because out of graph boundaries (mimics
300 behavior of pre 1.0.42 versions).
301
302 [--legend-position=(north|south|west|east)]
303
304 Place the legend at the given side of the graph. The default is south.
305 In west or east position it is necessary to add line breaks manually.
306
307 [--legend-direction=(topdown|bottomup|bottomup2)]
308
309 Place the legend items in the given vertical order. The default is
310 topdown. Using bottomup the legend items appear in the same vertical
311 order as a stack of lines or areas. Using bottomup2 will keep leading
312 and trailing COMMENT lines in order, this might be useful for
313 generators that use them for table headers and the like.
314
315 Miscellaneous
316 [-z|--lazy]
317
318 Only generate the graph if the current graph is out of date or not
319 existent. Note, that all the calculations will happen regardless so
320 that the output of PRINT and graphv will be complete regardless. Note
321 that the behavior of lazy in this regard has seen several changes over
322 time. The only thing you can really rely on before RRDtool 1.3.7 is
323 that lazy will not generate the graph when it is already there and up
324 to date, and also that it will output the size of the graph.
325
326 [-d|--daemon address]
327
328 Address of the rrdcached daemon. If specified, a "flush" command is
329 sent to the server before reading the RRD files. This allows the graph
330 to contain fresh data even if the daemon is configured to cache values
331 for a long time. For a list of accepted formats, see the -l option in
332 the rrdcached manual.
333
334 rrdtool graph [...] --daemon unix:/var/run/rrdcached.sock [...]
335
336 [-f|--imginfo printfstr]
337
338 After the image has been created, the graph function uses printf
339 together with this format string to create output similar to the PRINT
340 function, only that the printf function is supplied with the parameters
341 filename, xsize and ysize. In order to generate an IMG tag suitable for
342 including the graph into a web page, the command line would look like
343 this:
344
345 --imginfo '<IMG SRC="/img/%s" WIDTH="%lu" HEIGHT="%lu" ALT="Demo">'
346
347 [-c|--color COLORTAG#rrggbb[aa]]
348
349 Override the default colors for the standard elements of the graph. The
350 COLORTAG is one of "BACK" background, "CANVAS" for the background of
351 the actual graph, "SHADEA" for the left and top border, "SHADEB" for
352 the right and bottom border, "GRID", "MGRID" for the major grid, "FONT"
353 for the color of the font, "AXIS" for the axis of the graph, "FRAME"
354 for the line around the color spots, and finally "ARROW" for the arrow
355 head pointing up and forward. Each color is composed out of three
356 hexadecimal numbers specifying its rgb color component (00 is off, FF
357 is maximum) of red, green and blue. Optionally you may add another
358 hexadecimal number specifying the transparency (FF is solid). You may
359 set this option several times to alter multiple defaults.
360
361 A green arrow is made by: "--color ARROW#00FF00"
362
363 [--grid-dash on:off]
364
365 by default the grid is drawn in a 1 on, 1 off pattern. With this option
366 you can set this yourself
367
368 --grid-dash 1:3 for a dot grid
369
370 --grid-dash 1:0 for uninterrupted grid lines
371
372 [--border width]
373
374 Width in pixels for the 3d border drawn around the image. Default 2, 0
375 disables the border. See "SHADEA" and "SHADEB" above for setting the
376 border color.
377
378 [--dynamic-labels]
379
380 Pick the shape of the color marker next to the label according to the
381 element drawn on the graph.
382
383 [-m|--zoom factor]
384
385 Zoom the graphics by the given amount. The factor must be > 0
386
387 [-n|--font FONTTAG:size[:font]]
388
389 This lets you customize which font to use for the various text elements
390 on the RRD graphs. "DEFAULT" sets the default value for all elements,
391 "TITLE" for the title, "AXIS" for the axis labels, "UNIT" for the
392 vertical unit label, "LEGEND" for the graph legend, "WATERMARK" for the
393 watermark on the edge of the graph.
394
395 Use Times for the title: "--font TITLE:13:Times"
396
397 Note that you need to quote the argument to --font if the font-name
398 contains whitespace: --font "TITLE:13:Some Font"
399
400 If you do not give a font string you can modify just the size of the
401 default font: "--font TITLE:13:".
402
403 If you specify the size 0 then you can modify just the font without
404 touching the size. This is especially useful for altering the default
405 font without resetting the default fontsizes: "--font
406 DEFAULT:0:Courier".
407
408 RRDtool comes with a preset default font. You can set the environment
409 variable "RRD_DEFAULT_FONT" if you want to change this.
410
411 RRDtool uses Pango for its font handling. This means you can to use the
412 full Pango syntax when selecting your font:
413
414 The font name has the form "[FAMILY-LIST] [STYLE-OPTIONS] [SIZE]",
415 where FAMILY-LIST is a comma separated list of families optionally
416 terminated by a comma, STYLE_OPTIONS is a whitespace separated list of
417 words where each WORD describes one of style, variant, weight, stretch,
418 or gravity, and SIZE is a decimal number (size in points) or optionally
419 followed by the unit modifier "px" for absolute size. Any one of the
420 options may be absent.
421
422 [-R|--font-render-mode {normal,light,mono}]
423
424 There are 3 font render modes:
425
426 normal: Full Hinting and Anti-aliasing (default)
427
428 light: Slight Hinting and Anti-aliasing
429
430 mono: Full Hinting and NO Anti-aliasing
431
432 [-B|--font-smoothing-threshold size]
433
434 (this gets ignored in 1.3 for now!)
435
436 This specifies the largest font size which will be rendered bitmapped,
437 that is, without any font smoothing. By default, no text is rendered
438 bitmapped.
439
440 [-P|--pango-markup]
441
442 All text in RRDtool is rendered using Pango. With the --pango-markup
443 option, all text will be processed by pango markup. This allows one to
444 embed some simple html like markup tags using
445
446 <span key="value">text</span>
447
448 Apart from the verbose syntax, there are also the following short tags
449 available.
450
451 b Bold
452 big Makes font relatively larger, equivalent to <span size="larger">
453 i Italic
454 s Strikethrough
455 sub Subscript
456 sup Superscript
457 small Makes font relatively smaller, equivalent to <span size="smaller">
458 tt Monospace font
459 u Underline
460
461 More details on
462 <http://developer.gnome.org/pango/stable/PangoMarkupFormat.html>.
463
464 [-G|--graph-render-mode {normal,mono}]
465
466 There are 2 render modes:
467
468 normal: Graphs are fully Anti-aliased (default)
469
470 mono: No Anti-aliasing
471
472 [-E|--slope-mode]
473
474 RRDtool graphs are composed of stair case curves by default. This is in
475 line with the way RRDtool calculates its data. Some people favor a more
476 'organic' look for their graphs even though it is not all that true.
477
478 [-a|--imgformat PNG|SVG|EPS|PDF|XML|XMLENUM|JSON|JSONTIME|CSV|TSV|SSV]
479
480 Image format for the generated graph. For the vector formats you can
481 choose among the standard Postscript fonts Courier-Bold, Courier-
482 BoldOblique, Courier-Oblique, Courier, Helvetica-Bold, Helvetica-
483 BoldOblique, Helvetica-Oblique, Helvetica, Symbol, Times-Bold, Times-
484 BoldItalic, Times-Italic, Times-Roman, and ZapfDingbats.
485
486 For Export type you can define XML, XMLENUM (enummerates the value tags
487 <v0>,<v1>,<v2>,...), JSON, JSONTIME (adds a timestamp to each data
488 row), CSV (=comma separated values), TSV (=tab separated values), SSV
489 (=semicolon separated values), (for comma/tab/semicolon separated
490 values the time format by default is in the form of unix time. to
491 change it to something else use: --x-grid
492 MINUTE:10:HOUR:1:HOUR:4:0:"%Y-%m-%d %H:%M:%S")
493
494 [-i|--interlaced]
495
496 (this gets ignored in 1.3 for now!)
497
498 If images are interlaced they become visible on browsers more quickly.
499
500 [-T|--tabwidth value]
501
502 By default the tab-width is 40 pixels, use this option to change it.
503
504 [-b|--base value]
505
506 If you are graphing memory (and NOT network traffic) this switch should
507 be set to 1024 so that one Kb is 1024 byte. For traffic measurement, 1
508 kb/s is 1000 b/s.
509
510 [-W|--watermark string]
511
512 Adds the given string as a watermark, horizontally centered, at the
513 bottom of the graph.
514
515 [-Z|--use-nan-for-all-missing-data]
516
517 If one DS is missing, either because the RRD is not available or
518 because it does not contain the requested DS name, just assume that we
519 got empty values instead of raising a fatal error.
520
521 Data and variables
522 DEF:vname=rrdfile:ds-name:CF[:step=step][:start=time][:end=time]
523
524 CDEF:vname=RPN expression
525
526 VDEF:vname=RPN expression
527
528 You need at least one DEF and one LINE, AREA, GPRINT, PRINT statement
529 to generate anything useful.
530
531 See rrdgraph_data and rrdgraph_rpn for the exact format.
532
533 NOTE: Graph and print elements
534
535 You need at least one graph element to generate an image and/or at
536 least one print statement to generate a report. See rrdgraph_graph for
537 the exact format.
538
539 graphv
540 Calling RRDtool with the graphv option will return information in the
541 RRDtool info format. On the command line this means that all output
542 will be in key=value format. When used from the Perl and Ruby bindings
543 a hash pointer will be returned from the call.
544
545 When the filename '-' is given, the contents of the graph itself will
546 also be returned through this interface (hash key 'image'). On the
547 command line the output will look like this:
548
549 print[0] = "0.020833"
550 print[1] = "0.0440833"
551 graph_left = 51
552 graph_top = 22
553 graph_width = 400
554 graph_height = 100
555 graph_start = 1232908800
556 graph_end = 1232914200
557 image_width = 481
558 image_height = 154
559 value_min = 0.0000000000e+00
560 value_max = 4.0000000000e-02
561 image = BLOB_SIZE:8196
562 [... 8196 bytes of image data ...]
563
564 There is more information returned than in the standard interface.
565 Especially the 'graph_*' keys are new. They help applications that want
566 to know what is where on the graph.
567
569 The following environment variables may be used to change the behavior
570 of "rrdtool graph":
571
572 RRDCACHED_ADDRESS
573 If this environment variable is set it will have the same effect as
574 specifying the "--daemon" option on the command line. If both are
575 present, the command line argument takes precedence.
576
577 RRD_DEFAULT_FONT
578 RRDtool comes with a preset default font. You can set the
579 environment variable RRD_DEFAULT_FONT if you want to change this.
580
582 rrdgraph gives an overview of how rrdtool graph works. rrdgraph_data
583 describes DEF,CDEF and VDEF in detail. rrdgraph_rpn describes the RPN
584 language used in the ?DEF statements. rrdgraph_graph page describes
585 all of the graph and print functions.
586
587 Make sure to read rrdgraph_examples for tips&tricks.
588
590 Program by Tobias Oetiker <tobi@oetiker.ch>
591
592 This manual page by Alex van den Bogaerdt <alex@vandenbogaerdt.nl> with
593 corrections and/or additions by several people
594
595
596
5971.5.999 2016-05-23 RRDGRAPH(1)