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