Code

Imported upstream version 1.2.28.
[pkg-rrdtool.git] / doc / rrdgraph.html
1 <?xml version="1.0" ?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml">
4 <head>
5 <title>rrdgraph</title>
6 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
7 <link rev="made" href="mailto:root@localhost" />
8 </head>
10 <body style="background-color: white">
12 <p><a name="__index__"></a></p>
13 <!-- INDEX BEGIN -->
14 <!--
16 <ul>
18         <li><a href="#name">NAME</a></li>
19         <li><a href="#synopsis">SYNOPSIS</a></li>
20         <li><a href="#description">DESCRIPTION</a></li>
21         <li><a href="#overview">OVERVIEW</a></li>
22         <li><a href="#options">OPTIONS</a></li>
23         <li><a href="#see_also">SEE ALSO</a></li>
24         <li><a href="#author">AUTHOR</a></li>
25 </ul>
26 -->
27 <!-- INDEX END -->
29 <p>
30 </p>
31 <h1><a name="name">NAME</a></h1>
32 <p>rrdgraph - Round Robin Database tool grapher functions</p>
33 <p>
34 </p>
35 <hr />
36 <h1><a name="synopsis">SYNOPSIS</a></h1>
37 <p><strong>rrdtool graph</strong> <em>filename</em>
38 [<em><a href="././rrdgraph.html#options">option</a></em> ...]
39 [<em><a href="././rrdgraph_data.html#def">data definition</a></em> ...]
40 [<em><a href="././rrdgraph_data.html#cdef">data calculation</a></em> ...]
41 [<em><a href="././rrdgraph_data.html#vdef">variable definition</a></em> ...]
42 [<em><a href="././rrdgraph_graph.html#graph">graph element</a></em> ...]
43 [<em><a href="././rrdgraph_graph.html#print">print element</a></em> ...]</p>
44 <p>
45 </p>
46 <hr />
47 <h1><a name="description">DESCRIPTION</a></h1>
48 <p>The <strong>graph</strong> function of <strong>RRDtool</strong> is used to present the
49 data from an <strong>RRD</strong> to a human viewer.  Its main purpose is to
50 create a nice graphical representation, but it can also generate
51 a numerical report.</p>
52 <p>
53 </p>
54 <hr />
55 <h1><a name="overview">OVERVIEW</a></h1>
56 <p><strong>rrdtool graph</strong> needs data to work with, so you must use one or more
57 <strong><a href="././rrdgraph_data.html#def">data definition</a></strong> statements to collect this
58 data.  You are not limited to one database, it's perfectly legal to
59 collect data from two or more databases (one per statement, though).</p>
60 <p>If you want to display averages, maxima, percentiles, etcetera
61 it is best to collect them now using the
62 <strong><a href="././rrdgraph_data.html#vdef">variable definition</a></strong> statement.
63 Currently this makes no difference, but in a future version
64 of rrdtool you may want to collect these values before consolidation.</p>
65 <p>The data fetched from the <strong>RRA</strong> is then <strong>consolidated</strong> so that
66 there is exactly one datapoint per pixel in the graph. If you do
67 not take care yourself, <strong>RRDtool</strong> will expand the range slightly
68 if necessary. Note, in that case the first and/or last pixel may very
69 well become unknown!</p>
70 <p>Sometimes data is not exactly in the format you would like to display
71 it. For instance, you might be collecting <strong>bytes</strong> per second, but
72 want to display <strong>bits</strong> per second. This is what the <strong><a href="././rrdgraph_data.html#cdef">data calculation</a></strong> command is designed for. After
73 <strong>consolidating</strong> the data, a copy is made and this copy is modified
74 using a rather powerful <a href="././rrdgraph_rpn.html">the rrdgraph_rpn manpage</a> command set.</p>
75 <p>When you are done fetching and processing the data, it is time to
76 graph it (or print it).  This ends the <strong>rrdtool graph</strong> sequence.</p>
77 <p>
78 </p>
79 <hr />
80 <h1><a name="options">OPTIONS</a></h1>
81 <dl>
82 <dt><strong><a name="item_filename">filename</a></strong></dt>
84 <dd>
85 <p>The name and path of the graph to generate. It is recommended to
86 end this in <code>.png</code>, <code>.svg</code> or <code>.eps</code>, but <strong>RRDtool</strong> does not enforce this.</p>
87 <p><em>filename</em> can be '<code>-</code>' to send the image to <code>stdout</code>. In
88 this case, no other output is generated.</p>
89 </dd>
90 <dt><strong><a name="item_time_range">Time range</a></strong></dt>
92 <dd>
93 <p>[<strong>-s</strong>|<strong>--start</strong> <em>time</em>]
94 [<strong>-e</strong>|<strong>--end</strong> <em>time</em>]
95 [<strong>-S</strong>|<strong>--step</strong> <em>seconds</em>]</p>
96 <p>The start and end of the time series you would like to display, and which
97 <strong>RRA</strong> the data should come from.  Defaults are: 1 day ago until
98 now, with the best possible resolution. <strong>Start</strong> and <strong>end</strong> can
99 be specified in several formats, see
100 <a href="././rrdfetch.html">the rrdfetch manpage</a> and <a href="././rrdgraph_examples.html">the rrdgraph_examples manpage</a>.
101 By default, <strong>rrdtool graph</strong> calculates the width of one pixel in
102 the time domain and tries to get data from an <strong>RRA</strong> with that
103 resolution.  With the <strong>step</strong> option you can alter this behaviour.
104 If you want <strong>rrdtool graph</strong> to get data at a one-hour resolution
105 from the <strong>RRD</strong>, set <strong>step</strong> to 3'600. Note: a step smaller than
106 one pixel will silently be ignored.</p>
107 </dd>
108 <dt><strong><a name="item_labels">Labels</a></strong></dt>
110 <dd>
111 <p>[<strong>-t</strong>|<strong>--title</strong> <em>string</em>]
112 [<strong>-v</strong>|<strong>--vertical-label</strong> <em>string</em>]</p>
113 <p>A horizontal string at the top of the graph and/or a vertically
114 placed string at the left hand side of the graph.</p>
115 </dd>
116 <dt><strong><a name="item_size">Size</a></strong></dt>
118 <dd>
119 <p>[<strong>-w</strong>|<strong>--width</strong> <em>pixels</em>]
120 [<strong>-h</strong>|<strong>--height</strong> <em>pixels</em>]
121 [<strong>-j</strong>|<strong>--only-graph</strong>]</p>
122 <p>The width and height of the <strong>canvas</strong> (the part of the graph with
123 the actual data and such). This defaults to 400 pixels by 100 pixels.</p>
124 <p>If you specify the <strong>--only-graph</strong> option and set the height &lt; 32
125 pixels you will get a tiny graph image (thumbnail) to use as an icon
126 for use in an overview, for example. All labeling will be stripped off
127 the graph.</p>
128 </dd>
129 <dt><strong><a name="item_limits">Limits</a></strong></dt>
131 <dd>
132 <p>[<strong>-u</strong>|<strong>--upper-limit</strong> <em>value</em>]
133 [<strong>-l</strong>|<strong>--lower-limit</strong> <em>value</em>]
134 [<strong>-r</strong>|<strong>--rigid</strong>]</p>
135 <p>By default the graph will be autoscaling so that it will adjust the
136 y-axis to the range of the data. You can change this behaviour by
137 explicitly setting the limits. The displayed y-axis will then range at
138 least from <strong>lower-limit</strong> to <strong>upper-limit</strong>. Autoscaling will still
139 permit those boundaries to be stretched unless the <strong>rigid</strong> option is
140 set.</p>
141 <p>[<strong>-A</strong>|<strong>--alt-autoscale</strong>]</p>
142 <p>Sometimes the default algorithm for selecting the y-axis scale is not
143 satisfactory. Normally the scale is selected from a predefined
144 set of ranges and this fails miserably when you need to graph something
145 like <code>260 + 0.001 * sin(x)</code>. This option calculates the minimum and
146 maximum y-axis from the actual minimum and maximum data values. Our example
147 would display slightly less than <code>260-0.001</code> to slightly more than
148 <code>260+0.001</code> (this feature was contributed by Sasha Mikheev).</p>
149 <p>[<strong>-J</strong>|<strong>--alt-autoscale-min</strong>]</p>
150 <p>Where <code>--alt-autoscale</code> will modify both the absolute maximum AND minimum
151 values, this option will only affect the minimum value. The maximum
152 value, if not defined on the command line, will be 0. This option can
153 be useful when graphing router traffic when the WAN line uses compression,
154 and thus the throughput may be higher than the WAN line speed.</p>
155 <p>[<strong>-M</strong>|<strong>--alt-autoscale-max</strong>]</p>
156 <p>Where <code>--alt-autoscale</code> will modify both the absolute maximum AND minimum
157 values, this option will only affect the maximum value. The minimum
158 value, if not defined on the command line, will be 0. This option can
159 be useful when graphing router traffic when the WAN line uses compression,
160 and thus the throughput may be higher than the WAN line speed.</p>
161 <p>[<strong>-N</strong>|<strong>--no-gridfit</strong>]</p>
162 <p>In order to avoid anti-aliasing effects gridlines are placed on
163 integer pixel values. This is by default done by extending
164 the scale so that gridlines happens to be spaced using an
165 integer number of pixels and also start on an integer pixel value.
166 This might extend the scale too much for some logarithmic scales
167 and for linear scales where <strong>--alt-autoscale</strong> is needed.
168 Using <strong>--no-gridfit</strong> disables modification of the scale.</p>
169 </dd>
170 <dt><strong><a name="item_x_2dgrid">X-Grid</a></strong></dt>
172 <dd>
173 <p>[<strong>-x</strong>|<strong>--x-grid</strong> <em>GTM</em><strong>:</strong><em>GST</em><strong>:</strong><em>MTM</em><strong>:</strong><em>MST</em><strong>:</strong><em>LTM</em><strong>:</strong><em>LST</em><strong>:</strong><em>LPR</em><strong>:</strong><em>LFM</em>]</p>
174 <p>[<strong>-x</strong>|<strong>--x-grid</strong> <strong>none</strong>]</p>
175 <p>The x-axis label is quite complex to configure. If you don't have
176 very special needs it is probably best to rely on the autoconfiguration
177 to get this right. You can specify the string <code>none</code> to suppress the grid
178 and labels altogether.</p>
179 <p>The grid is defined by specifying a certain amount of time in the <em>?TM</em>
180 positions. You can choose from <code>SECOND</code>, <code>MINUTE</code>, <code>HOUR</code>, <code>DAY</code>,
181 <code>WEEK</code>, <code>MONTH</code> or <code>YEAR</code>. Then you define how many of these should
182 pass between each line or label.  This pair (<em>?TM:?ST</em>) needs to be
183 specified for the base grid (<em>G??</em>), the major grid (<em>M??</em>) and the
184 labels (<em>L??</em>). For the labels you also must define a precision
185 in <em>LPR</em> and a <em>strftime</em> format string in <em>LFM</em>.  <em>LPR</em> defines
186 where each label will be placed. If it is zero, the label will be
187 placed right under the corresponding line (useful for hours, dates
188 etcetera).  If you specify a number of seconds here the label is
189 centered on this interval (useful for Monday, January etcetera).</p>
190 <pre>
191  --x-grid MINUTE:10:HOUR:1:HOUR:4:0:%X</pre>
192 <p>This places grid lines every 10 minutes, major grid lines every hour,
193 and labels every 4 hours. The labels are placed under the major grid
194 lines as they specify exactly that time.</p>
195 <pre>
196  --x-grid HOUR:8:DAY:1:DAY:1:86400:%A</pre>
197 <p>This places grid lines every 8 hours, major grid lines and labels
198 each day. The labels are placed exactly between two major grid lines
199 as they specify the complete day and not just midnight.</p>
200 </dd>
201 <dt><strong><a name="item_y_2dgrid">Y-Grid</a></strong></dt>
203 <dd>
204 <p>[<strong>-y</strong>|<strong>--y-grid</strong> <em>grid step</em><strong>:</strong><em>label factor</em>]</p>
205 <p>[<strong>-y</strong>|<strong>--y-grid</strong> <strong>none</strong>]</p>
206 <p>Y-axis grid lines appear at each <em>grid step</em> interval.  Labels are
207 placed every <em>label factor</em> lines.  You can specify <code>-y none</code> to
208 suppress the grid and labels altogether.  The default for this option is
209 to automatically select sensible values.</p>
210 <p>If you have set --y-grid to 'none' not only the labels get supressed, also
211 the space reserved for the labels is removed. You can still add space
212 manually if you use the --units-length command to explicitly reserve space.</p>
213 <p>[<strong>-Y</strong>|<strong>--alt-y-grid</strong>]</p>
214 <p>Place the Y grid dynamically based on the graph's Y range. The algorithm
215 ensures that you always have a grid, that there are enough but not too many
216 grid lines, and that the grid is metric. That is the grid lines are placed
217 every 1, 2, 5 or 10 units. This parameter will also ensure that you get
218 enough decimals displayed even if your graph goes from 69.998 to 70.001. 
219 (contributed by Sasha Mikheev).</p>
220 <p>[<strong>-o</strong>|<strong>--logarithmic</strong>]</p>
221 <p>Logarithmic y-axis scaling.</p>
222 <p>[<strong>-X</strong>|<strong>--units-exponent</strong> <em>value</em>]</p>
223 <p>This sets the 10**exponent scaling of the y-axis values. Normally,
224 values will be scaled to the appropriate units (k, M, etc.).  However,
225 you may wish to display units always in k (Kilo, 10e3) even if the data
226 is in the M (Mega, 10e6) range, for instance. Value should be an
227 integer which is a multiple of 3 between -18 and 18 inclusively.  It is
228 the exponent on the units you wish to use. For example, use 3 to
229 display the y-axis values in k (Kilo, 10e3, thousands), use -6 to
230 display the y-axis values in u (Micro, 10e-6, millionths).  Use a value
231 of 0 to prevent any scaling of the y-axis values.</p>
232 <p>This option is very effective at confusing the heck out of the default
233 rrdtool autoscaler and grid painter. If rrdtool detects that it is not
234 successful in labeling the graph under the given circumstances, it will switch
235 to the more robust <strong>--alt-y-grid</strong> mode.</p>
236 <p>[<strong>-L</strong>|<strong>--units-length</strong> <em>value</em>]</p>
237 <p>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.</p>
240 <p>[<strong>--units=si</strong>]</p>
241 <p>With this option y-axis values on logarithmic graphs will be scaled to 
242 the appropriate units (k, M, etc.) instead of using exponential notation.
243 Note that for linear graphs, SI notation is used by default.</p>
244 </dd>
245 <dt><strong><a name="item_miscellaneous">Miscellaneous</a></strong></dt>
247 <dd>
248 <p>[<strong>-z</strong>|<strong>--lazy</strong>]</p>
249 <p>Only generate the graph if the current graph is out of date or not
250 existent.</p>
251 <p>[<strong>-f</strong>|<strong>--imginfo</strong> <em>printfstr</em>]</p>
252 <p>After the image has been created, the graph function uses printf
253 together with this format string to create output similar to the PRINT
254 function, only that the printf function is supplied with the parameters
255 <em>filename</em>, <em>xsize</em> and <em>ysize</em>. In order to generate an <strong>IMG</strong> tag
256 suitable for including the graph into a web page, the command line
257 would look like this:</p>
258 <pre>
259  --imginfo '&lt;IMG SRC=&quot;/img/%s&quot; WIDTH=&quot;%lu&quot; HEIGHT=&quot;%lu&quot; ALT=&quot;Demo&quot;&gt;'</pre>
260 <p>[<strong>-c</strong>|<strong>--color</strong> <em>COLORTAG</em>#<em>rrggbb</em>[<em>aa</em>]]</p>
261 <p>Override the default colors for the standard elements of the graph. The
262 <em>COLORTAG</em> is one of <code>BACK</code> background, <code>CANVAS</code> for the background of
263 the actual graph, <code>SHADEA</code> for the left and top border, <code>SHADEB</code> for the
264 right and bottom border, <code>GRID</code>, <code>MGRID</code> for the major grid, <code>FONT</code> for
265 the color of the font, <code>AXIS</code> for the axis of the graph, <code>FRAME</code> for the
266 line around the color spots and finally <code>ARROW</code> for the arrow head pointing
267 up and forward. Each color is composed out of three hexadecimal numbers
268 specifying its rgb color component (00 is off, FF is maximum) of red, green
269 and blue. Optionally you may add another hexadecimal number specifying the
270 transparency (FF is solid). You may set this option several times to alter
271 multiple defaults.</p>
272 <p>A green arrow is made by: <code>--color ARROW#00FF00</code></p>
273 <p>[<strong>--zoom</strong> <em>factor</em>]</p>
274 <p>Zoom the graphics by the given amount. The factor must be &gt; 0</p>
275 <p>[<strong>-n</strong>|<strong>--font</strong> <em>FONTTAG</em><strong>:</strong><em>size</em><strong>:</strong>[<em>font</em>]]</p>
276 <p>This lets you customize which font to use for the various text
277 elements on the RRD graphs. <code>DEFAULT</code> sets the default value for all
278 elements, <code>TITLE</code> for the title, <code>AXIS</code> for the axis labels, <code>UNIT</code>
279 for the vertical unit label, <code>LEGEND</code> for the graph legend.</p>
280 <p>Use Times for the title: <code>--font TITLE:13:/usr/lib/fonts/times.ttf</code></p>
281 <p>If you do not give a font string you can modify just the sice of the default font:
282 <code>--font TITLE:13:</code>.</p>
283 <p>If you specify the size 0 then you can modify just the font without touching
284 the size. This is especially usefull for altering the default font without
285 resetting the default fontsizes: <code>--font DEFAULT:0:/usr/lib/fonts/times.ttf</code>.</p>
286 <p>RRDtool comes with a preset default font. You can set the environment
287 variable <code>RRD_DEFAULT_FONT</code> if you want to change this.</p>
288 <p>Truetype fonts are only supported for PNG output. See below.</p>
289 <p>[<strong>-R</strong>|<strong>--font-render-mode</strong> {<em>normal</em>,<em>light</em>,<em>mono</em>}]</p>
290 <p>This lets you customize the strength of the font smoothing,
291 or disable it entirely using <em>mono</em>. By default, <em>normal</em>
292 font smoothing is used.</p>
293 <p>[<strong>-B</strong>|<strong>--font-smoothing-threshold</strong> <em>size</em>]</p>
294 <p>This specifies the largest font size which will be rendered
295 bitmapped, that is, without any font smoothing. By default,
296 no text is rendered bitmapped.</p>
297 <p>[<strong>-E</strong>|<strong>--slope-mode</strong>]</p>
298 <p>RRDtool graphs are composed of stair case curves by default. This is in line with
299 the way RRDtool calculates its data. Some people favor a more 'organic' look
300 for their graphs even though it is not all that true.</p>
301 <p>[<strong>-a</strong>|<strong>--imgformat</strong> <strong>PNG</strong>|<strong>SVG</strong>|<strong>EPS</strong>|<strong>PDF</strong>]</p>
302 <p>Image format for the generated graph. For the vector formats you can
303 choose among the standard Postscript fonts Courier-Bold,
304 Courier-BoldOblique, Courier-Oblique, Courier, Helvetica-Bold,
305 Helvetica-BoldOblique, Helvetica-Oblique, Helvetica, Symbol,
306 Times-Bold, Times-BoldItalic, Times-Italic, Times-Roman, and ZapfDingbats.</p>
307 <p>[<strong>-i</strong>|<strong>--interlaced</strong>]</p>
308 <p>If images are interlaced they become visible on browsers more quickly.</p>
309 <p>[<strong>-g</strong>|<strong>--no-legend</strong>]</p>
310 <p>Suppress generation of the legend; only render the graph.</p>
311 <p>[<strong>-F</strong>|<strong>--force-rules-legend</strong>]</p>
312 <p>Force the generation of HRULE and VRULE legends even if those HRULE or
313 VRULE will not be drawn because out of graph boundaries (mimics
314 behaviour of pre 1.0.42 versions).</p>
315 <p>[<strong>-T</strong>|<strong>--tabwidth</strong> <em>value</em>]</p>
316 <p>By default the tab-width is 40 pixels, use this option to change it.</p>
317 <p>[<strong>-b</strong>|<strong>--base</strong> <em>value</em>]</p>
318 <p>If you are graphing memory (and NOT network traffic) this switch
319 should be set to 1024 so that one Kb is 1024 byte. For traffic
320 measurement, 1 kb/s is 1000 b/s.</p>
321 <p>[<strong>-W</strong>|<strong>--watermark</strong> <em>string</em>]</p>
322 <p>Adds the given string as a watermark, horizontally centred, at the bottom 
323 of the graph.</p>
324 </dd>
325 <dt><strong><a name="item_data_and_variables">Data and variables</a></strong></dt>
327 <dd>
328 <p><strong>DEF:</strong><em>vname</em><strong>=</strong><em>rrdfile</em><strong>:</strong><em>ds-name</em><strong>:</strong><em>CF</em>[<strong>:step=</strong><em>step</em>][<strong>:start=</strong><em>time</em>][<strong>:end=</strong><em>time</em>]</p>
329 <p><strong>CDEF:</strong><em>vname</em><strong>=</strong><em>RPN expression</em></p>
330 <p><strong>VDEF:</strong><em>vname</em><strong>=</strong><em>RPN expression</em></p>
331 <p>You need at least one <strong>DEF</strong> statement to generate anything. The
332 other statements are useful but optional.
333 See <a href="././rrdgraph_data.html">the rrdgraph_data manpage</a> and <a href="././rrdgraph_rpn.html">the rrdgraph_rpn manpage</a> for the exact format.</p>
334 </dd>
335 <dt><strong><a name="item_graph_and_print_elements">Graph and print elements</a></strong></dt>
337 <dd>
338 <p>You need at least one graph element to generate an image and/or
339 at least one print statement to generate a report.
340 See <a href="././rrdgraph_graph.html">the rrdgraph_graph manpage</a> for the exact format.</p>
341 </dd>
342 </dl>
343 <p>
344 </p>
345 <hr />
346 <h1><a name="see_also">SEE ALSO</a></h1>
347 <p><a href="././rrdgraph.html">the rrdgraph manpage</a> gives an overview of how <strong>rrdtool graph</strong> works.
348 <a href="././rrdgraph_data.html">the rrdgraph_data manpage</a> describes <strong>DEF</strong>,<strong>CDEF</strong> and <strong>VDEF</strong> in detail.
349 <a href="././rrdgraph_rpn.html">the rrdgraph_rpn manpage</a> describes the <strong>RPN</strong> language used in the <strong>?DEF</strong> statements.
350 <a href="././rrdgraph_graph.html">the rrdgraph_graph manpage</a> page describes all of the graph and print functions.</p>
351 <p>Make sure to read <a href="././rrdgraph_examples.html">the rrdgraph_examples manpage</a> for tips&amp;tricks.</p>
352 <p>
353 </p>
354 <hr />
355 <h1><a name="author">AUTHOR</a></h1>
356 <p>Program by Tobias Oetiker &lt;<a href="mailto:tobi@oetiker.ch">tobi@oetiker.ch</a>&gt;</p>
357 <p>This manual page by Alex van den Bogaerdt &lt;<a href="mailto:alex@ergens.op.het.net">alex@ergens.op.het.net</a>&gt;</p>
359 </body>
361 </html>