Code

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