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