Code

Imported upstream version 1.2.26
[pkg-rrdtool.git] / doc / rrdtool.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>rrdtool</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         <ul>
23                 <li><a href="#overview">OVERVIEW</a></li>
24                 <li><a href="#functions">FUNCTIONS</a></li>
25                 <li><a href="#how_does_rrdtool_work">HOW DOES RRDTOOL WORK?</a></li>
26                 <li><a href="#remote_control">REMOTE CONTROL</a></li>
27                 <li><a href="#rrd_server">RRD Server</a></li>
28         </ul>
30         <li><a href="#see_also">SEE ALSO</a></li>
31         <li><a href="#bugs">BUGS</a></li>
32         <li><a href="#author">AUTHOR</a></li>
33 </ul>
34 -->
35 <!-- INDEX END -->
37 <p>
38 </p>
39 <h1><a name="name">NAME</a></h1>
40 <p>rrdtool - Round Robin Database Tool</p>
41 <p>
42 </p>
43 <hr />
44 <h1><a name="synopsis">SYNOPSIS</a></h1>
45 <p><strong>rrdtool</strong> <strong>-</strong> [workdir]| <em>function</em></p>
46 <p>
47 </p>
48 <hr />
49 <h1><a name="description">DESCRIPTION</a></h1>
50 <p>
51 </p>
52 <h2><a name="overview">OVERVIEW</a></h2>
53 <p>It is pretty easy to gather status information from all sorts of
54 things, ranging from the temperature in your office to the number of
55 octets which have passed through the FDDI interface of your
56 router. But it is not so trivial to store this data in an efficient and
57 systematic manner. This is where <strong>RRDtool</strong> comes in handy. It lets you
58 <em>log and analyze</em> the data you gather from all kinds of data-sources
59 (<strong>DS</strong>). The data analysis part of RRDtool is based on the ability to
60 quickly generate graphical representations of the data values
61 collected over a definable time period.</p>
62 <p>In this man page you will find general information on the design and
63 functionality of the Round Robin Database Tool (RRDtool). For a more
64 detailed description of how to use the individual functions of
65 <strong>RRDtool</strong> check the corresponding man page.</p>
66 <p>For an introduction to the usage of RRDtool make sure you consult the
67 <a href="././rrdtutorial.html">the rrdtutorial manpage</a>.</p>
68 <p>
69 </p>
70 <h2><a name="functions">FUNCTIONS</a></h2>
71 <p>While the man pages talk of command line switches you have to set in
72 order to make <strong>RRDtool</strong> work it is important to note that
73 <strong>RRDtool</strong> can be remotely controlled through a set of pipes. This
74 saves a considerable amount of startup time when you plan to make
75 <strong>RRDtool</strong> do a lot of things quickly. Check the section on <a href="#remote_control">Remote Control</a> further down. There is also a number of language bindings
76 for RRDtool which allow you to use it directly from perl, python, tcl,
77 php, etc.</p>
78 <dl>
79 <dt><strong><a name="item_create"><strong>create</strong></a></strong>
81 <dd>
82 <p>Set up a new Round Robin Database (RRD). Check <a href="././rrdcreate.html">the rrdcreate manpage</a>.</p>
83 </dd>
84 </li>
85 <dt><strong><a name="item_update"><strong>update</strong></a></strong>
87 <dd>
88 <p>Store new data values into an RRD. Check <a href="././rrdupdate.html">the rrdupdate manpage</a>.</p>
89 </dd>
90 </li>
91 <dt><strong><a name="item_updatev"><strong>updatev</strong></a></strong>
93 <dd>
94 <p>Operationally equivalent to <strong>update</strong> except for output. Check <a href="././rrdupdate.html">the rrdupdate manpage</a>.</p>
95 </dd>
96 </li>
97 <dt><strong><a name="item_graph"><strong>graph</strong></a></strong>
99 <dd>
100 <p>Create a graph from data stored in one or several RRDs. Apart from
101 generating graphs, data can also be extracted to stdout. Check <a href="././rrdgraph.html">the rrdgraph manpage</a>.</p>
102 </dd>
103 </li>
104 <dt><strong><a name="item_dump"><strong>dump</strong></a></strong>
106 <dd>
107 <p>Dump the contents of an RRD in plain ASCII. In connection with restore
108 you can use this to move an RRD from one computer architecture to
109 another.  Check <a href="././rrddump.html">the rrddump manpage</a>.</p>
110 </dd>
111 </li>
112 <dt><strong><a name="item_restore"><strong>restore</strong></a></strong>
114 <dd>
115 <p>Restore an RRD in XML format to a binary RRD. Check <a href="././rrdrestore.html">the rrdrestore manpage</a></p>
116 </dd>
117 </li>
118 <dt><strong><a name="item_fetch"><strong>fetch</strong></a></strong>
120 <dd>
121 <p>Get data for a certain time period from a RRD. The graph function
122 uses fetch to retrieve its data from an RRD. Check <a href="././rrdfetch.html">the rrdfetch manpage</a>.</p>
123 </dd>
124 </li>
125 <dt><strong><a name="item_tune"><strong>tune</strong></a></strong>
127 <dd>
128 <p>Alter setup of an RRD. Check <a href="././rrdtune.html">the rrdtune manpage</a>.</p>
129 </dd>
130 </li>
131 <dt><strong><a name="item_last"><strong>last</strong></a></strong>
133 <dd>
134 <p>Find the last update time of an RRD. Check <a href="././rrdlast.html">the rrdlast manpage</a>.</p>
135 </dd>
136 </li>
137 <dt><strong><a name="item_info"><strong>info</strong></a></strong>
139 <dd>
140 <p>Get information about an RRD. Check <a href="././rrdinfo.html">the rrdinfo manpage</a>.</p>
141 </dd>
142 </li>
143 <dt><strong><a name="item_rrdresize"><strong>rrdresize</strong></a></strong>
145 <dd>
146 <p>Change the size of individual RRAs. This is dangerous! Check <a href="././rrdresize.html">the rrdresize manpage</a>.</p>
147 </dd>
148 </li>
149 <dt><strong><a name="item_xport"><strong>xport</strong></a></strong>
151 <dd>
152 <p>Export data retrieved from one or several RRDs. Check <a href="././rrdxport.html">the rrdxport manpage</a></p>
153 </dd>
154 </li>
155 <dt><strong><a name="item_rrdcgi"><strong>rrdcgi</strong></a></strong>
157 <dd>
158 <p>This is a standalone tool for producing RRD graphs on the fly. Check
159 <a href="././rrdcgi.html">the rrdcgi manpage</a>.</p>
160 </dd>
161 </li>
162 </dl>
163 <p>
164 </p>
165 <h2><a name="how_does_rrdtool_work">HOW DOES RRDTOOL WORK?</a></h2>
166 <dl>
167 <dt><strong><a name="item_data_acquisition">Data Acquisition</a></strong>
169 <dd>
170 <p>When monitoring the state of a system, it is convenient to have the
171 data available at a constant time interval. Unfortunately, you may not
172 always be able to fetch data at exactly the time you want
173 to. Therefore <strong>RRDtool</strong> lets you update the logfile at any time you
174 want. It will automatically interpolate the value of the data-source
175 (<strong>DS</strong>) at the latest official time-slot (intervall) and write this
176 interpolated value to the log. The original value you have supplied is
177 stored as well and is also taken into account when interpolating the
178 next log entry.</p>
179 </dd>
180 </li>
181 <dt><strong><a name="item_consolidation">Consolidation</a></strong>
183 <dd>
184 <p>You may log data at a 1 minute interval, but you might also be
185 interested to know the development of the data over the last year. You
186 could do this by simply storing the data in 1 minute intervals for the
187 whole year. While this would take considerable disk space it would
188 also take a lot of time to analyze the data when you wanted to create
189 a graph covering the whole year. <strong>RRDtool</strong> offers a solution to this
190 problem through its data consolidation feature. When setting up an
191 Round Robin Database (<strong>RRD</strong>), you can define at which interval this
192 consolidation should occur, and what consolidation function (<strong>CF</strong>)
193 (average, minimum, maximum, total, last) should be used to build the
194 consolidated values (see rrdcreate). You can define any number of
195 different consolidation setups within one <strong>RRD</strong>. They will all be
196 maintained on the fly when new data is loaded into the <strong>RRD</strong>.</p>
197 </dd>
198 </li>
199 <dt><strong><a name="item_round_robin_archives">Round Robin Archives</a></strong>
201 <dd>
202 <p>Data values of the same consolidation setup are stored into Round
203 Robin Archives (<strong>RRA</strong>). This is a very efficient manner to store data
204 for a certain amount of time, while using a known and constant amount
205 of storage space.</p>
206 </dd>
207 <dd>
208 <p>It works like this: If you want to store 1'000 values in 5 minute
209 interval, <strong>RRDtool</strong> will allocate space for 1'000 data values and a
210 header area. In the header it will store a pointer telling which slots
211 (value) in the storage area was last written to. New values are
212 written to the Round Robin Archive in, you guessed it, a round robin
213 manner. This automatically limits the history to the last 1'000 values
214 (in our example). Because you can define several <strong>RRA</strong>s within a
215 single <strong>RRD</strong>, you can setup another one, for storing 750 data values
216 at a 2 hour interval, for example, and thus keep a log for the last
217 two months at a lower resolution.</p>
218 </dd>
219 <dd>
220 <p>The use of <strong>RRA</strong>s guarantees that the <strong>RRD</strong> does not grow over
221 time and that old data is automatically eliminated. By using the
222 consolidation feature, you can still keep data for a very long time,
223 while gradually reducing the resolution of the data along the time
224 axis.</p>
225 </dd>
226 <dd>
227 <p>Using different consolidation functions (<strong>CF</strong>) allows you to store
228 exactly the type of information that actually interests you: the maximum
229 one minute traffic on the LAN, the minimum temperature of your wine cellar,
230 the total minutes of down time, etc.</p>
231 </dd>
232 </li>
233 <dt><strong><a name="item_unknown_data">Unknown Data</a></strong>
235 <dd>
236 <p>As mentioned earlier, the <strong>RRD</strong> stores data at a constant
237 interval. Sometimes it may happen that no new data is available when a
238 value has to be written to the <strong>RRD</strong>. Data acquisition may not be
239 possible for one reason or other. With <strong>RRDtool</strong> you can handle these
240 situations by storing an <em>*UNKNOWN*</em> value into the database. The
241 value '<em>*UNKNOWN*</em>' is supported through all the functions of the
242 tool. When consolidating a data set, the amount of <em>*UNKNOWN*</em> data
243 values is accounted for and when a new consolidated value is ready to
244 be written to its Round Robin Archive (<strong>RRA</strong>), a validity check is
245 performed to make sure that the percentage of unknown values in the
246 data point is above a configurable level. If not, an <em>*UNKNOWN*</em> value
247 will be written to the <strong>RRA</strong>.</p>
248 </dd>
249 </li>
250 <dt><strong><a name="item_graphing">Graphing</a></strong>
252 <dd>
253 <p><strong>RRDtool</strong> allows you to generate reports in numerical and
254 graphical form based on the data stored in one or several
255 <strong>RRD</strong>s. The graphing feature is fully configurable. Size, color and
256 contents of the graph can be defined freely. Check <a href="././rrdgraph.html">the rrdgraph manpage</a>
257 for more information on this.</p>
258 </dd>
259 </li>
260 <dt><strong><a name="item_aberrant_behavior_detection">Aberrant Behavior Detection</a></strong>
262 <dd>
263 <p>by Jake Brutlag</p>
264 </dd>
265 <dd>
266 <p><strong>RRDtool</strong> provides the building blocks for near real-time aberrant
267 behavior detection. These components include:</p>
268 </dd>
269 <ul>
270 <li>
271 <p>An algorithm for predicting the value of a time series one time step
272 into the future.</p>
273 </li>
274 <li>
275 <p>A measure of deviation between predicted and observed values.</p>
276 </li>
277 <li>
278 <p>A mechanism to decide if and when an observed value or sequence of
279 observed values is <em>too deviant</em> from the predicted value(s).</p>
280 </li>
281 </ul>
282 <p>Here is a brief explanation of these components:</p>
283 <p>The Holt-Winters time series forecasting algorithm is an on-line (or
284 incremental) algorithm that adaptively predicts future observations in
285 a time series. Its forecast is the sum of three components: a baseline
286 (or intercept), a linear trend over time (or slope), and a seasonal
287 coefficient (a periodic effect, such as a daily cycle). There is one
288 seasonal coefficient for each time point in the period (cycle). After
289 a value is observed, each of these components is updated via
290 exponential smoothing. This means that the algorithm ``learns'' from
291 past values and uses them to predict the future. The rate of
292 adaptation is governed by 3 parameters, alpha (intercept), beta
293 (slope), and gamma (seasonal). The prediction can also be viewed as a
294 smoothed value for the time series.</p>
295 <p>The measure of deviation is a seasonal weighted absolute
296 deviation. The term <em>seasonal</em> means deviation is measured separately
297 for each time point in the seasonal cycle. As with Holt-Winters
298 forecasting, deviation is predicted using the measure computed from
299 past values (but only at that point in the seasonal cycle). After the
300 value is observed, the algorithm learns from the observed value via
301 exponential smoothing. Confidence bands for the observed time series
302 are generated by scaling the sequence of predicted deviation values
303 (we usually think of the sequence as a continuous line rather than a
304 set of discrete points).</p>
305 <p>Aberrant behavior (a potential failure) is reported whenever the
306 number of times the observed value violates the confidence bands meets
307 or exceeds a specified threshold within a specified temporal window
308 (e.g. 5 violations during the past 45 minutes with a value observed
309 every 5 minutes).</p>
310 <p>This functionality is embedded in a set of related <strong>RRAs</strong>. In
311 particular, a FAILURES <strong>RRA</strong> logs potential failures. With these data
312 you could, for example, use a front-end application to <strong>RRDtool</strong> to
313 initiate real-time alerts.</p>
314 <p>For a detailed description on how to set this up, see <a href="././rrdcreate.html">the rrdcreate manpage</a>.</p>
315 </dl>
316 <p>
317 </p>
318 <h2><a name="remote_control">REMOTE CONTROL</a></h2>
319 <p>When you start <strong>RRDtool</strong> with the command line option '<strong>-</strong>' it waits
320 for input via standard input (STDIN). With this feature you can
321 improve performance by attaching <strong>RRDtool</strong> to another process (MRTG
322 is one example) through a set of pipes. Over these pipes <strong>RRDtool</strong>
323 accepts the same arguments as on the command line and some special
324 commands like <strong>quit, cd, mkdir</strong> and <strong>ls</strong>. For detailed help on the
325 server commands type:</p>
326 <pre>
327    rrdtool help cd|mkdir|pwd|ls|quit</pre>
328 <p>When a command is completed, RRDtool will print the string  '<code>OK</code>',
329 followed by timing information of the form <strong>u:</strong><em>usertime</em>
330 <strong>s:</strong><em>systemtime</em>. Both values are the running totals of seconds since
331 RRDtool was started. If an error occurs, a line of the form '<code>ERROR:</code>
332 <em>Description of error</em>' will be printed instead. <strong>RRDtool</strong> will not abort,
333 unless something realy serious happens. If
334 a <strong>workdir</strong> is specified and the UID is 0, RRDtool will do a chroot to that
335 workdir. If the UID is not 0, RRDtool only changes the current directory to
336 <strong>workdir</strong>.</p>
337 <p>
338 </p>
339 <h2><a name="rrd_server">RRD Server</a></h2>
340 <p>If you want to create a RRD-Server, you must choose a TCP/IP Service
341 number and add them to <em>/etc/services</em> like this:</p>
342 <pre>
343  rrdsrv      13900/tcp                       # RRD server</pre>
344 <p>Attention: the TCP port 13900 isn't officially registered for
345 rrdsrv. You can use any unused port in your services file, but the
346 server and the client system must use the same port, of course.</p>
347 <p>With this configuration you can add RRDtool as meta-server to
348 <em>/etc/inetd.conf</em>. For example:</p>
349 <pre>
350  rrdsrv stream tcp nowait root /opt/rrd/bin/rrdtool rrdtool - /var/rrd</pre>
351 <p>Don't forget to create the database directory /var/rrd and
352 reinitialize your inetd.</p>
353 <p>If all was setup correctly, you can access the server with perl
354 sockets, tools like netcat, or in a quick interactive test by using
355 'telnet localhost rrdsrv'.</p>
356 <p><strong>NOTE:</strong> that there is no authentication with this feature! Do not setup
357 such a port unless you are sure what you are doing.</p>
358 <p>
359 </p>
360 <hr />
361 <h1><a name="see_also">SEE ALSO</a></h1>
362 <p>rrdcreate, rrdupdate, rrdgraph, rrddump, rrdfetch, rrdtune, rrdlast, rrdxport</p>
363 <p>
364 </p>
365 <hr />
366 <h1><a name="bugs">BUGS</a></h1>
367 <p>Bugs? Features!</p>
368 <p>
369 </p>
370 <hr />
371 <h1><a name="author">AUTHOR</a></h1>
372 <p>Tobias Oetiker &lt;<a href="mailto:tobi@oetiker.ch">tobi@oetiker.ch</a>&gt;</p>
374 </body>
376 </html>