Code

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