1RRDGRAPH(1)                         rrdtool                        RRDGRAPH(1)
2
3
4

NAME

6       rrdgraph - Round Robin Database tool graphing functions
7

SYNOPSIS

9       rrdtool graph|graphv filename [option ...]  [data definition ...]
10       [data calculation ...]  [variable definition ...]  [graph element ...]
11       [print element ...]
12

DESCRIPTION

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

OVERVIEW

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

OPTIONS

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

ENVIRONMENT VARIABLES

593       The following environment variables may be used to change the behavior
594       of "rrdtool graph":
595
596       RRDCACHED_ADDRESS
597           If this environment variable is set it will have the same effect as
598           specifying the "--daemon" option on the command line. If both are
599           present, the command line argument takes precedence.
600
601       RRD_DEFAULT_FONT
602           RRDtool comes with a preset default font. You can set the
603           environment variable RRD_DEFAULT_FONT if you want to change this.
604

SEE ALSO

606       rrdgraph gives an overview of how rrdtool graph works.  rrdgraph_data
607       describes DEF,CDEF and VDEF in detail.  rrdgraph_rpn describes the RPN
608       language used in the ?DEF statements.  rrdgraph_graph page describes
609       all of the graph and print functions.
610
611       Make sure to read rrdgraph_examples for tips&tricks.
612

AUTHOR

614       Program by Tobias Oetiker <tobi@oetiker.ch>
615
616       This manual page by Alex van den Bogaerdt <alex@vandenbogaerdt.nl> with
617       corrections and/or additions by several people
618
619
620
6211.8.0                             2022-03-14                       RRDGRAPH(1)
Impressum