1 =head1 NAME
3 rrdtool - Round Robin Database Tool
5 =head1 SYNOPSIS
7 B<rrdtool> B<-> [workdir]| I<function>
9 =head1 DESCRIPTION
11 =head2 OVERVIEW
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.
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.
28 For an introduction to the usage of RRDtool make sure you consult the
29 L<rrdtutorial>.
31 =head2 FUNCTIONS
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.
42 =over 8
44 =item B<create>
46 Set up a new Round Robin Database (RRD). Check L<rrdcreate>.
48 =item B<update>
50 Store new data values into an RRD. Check L<rrdupdate>.
52 =item B<updatev>
54 Operationally equivalent to B<update> except for output. Check L<rrdupdate>.
56 =item B<graph>
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>.
61 =item B<dump>
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>.
67 =item B<restore>
69 Restore an RRD in XML format to a binary RRD. Check L<rrdrestore>
71 =item B<fetch>
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>.
76 =item B<tune>
78 Alter setup of an RRD. Check L<rrdtune>.
80 =item B<last>
82 Find the last update time of an RRD. Check L<rrdlast>.
84 =item B<info>
86 Get information about an RRD. Check L<rrdinfo>.
88 =item B<rrdresize>
90 Change the size of individual RRAs. This is dangerous! Check L<rrdresize>.
92 =item B<xport>
94 Export data retrieved from one or several RRDs. Check L<rrdxport>.
96 =item B<flushcached>
98 Flush the values for a specific RRD file from memory. Check L<rrdflushcached>.
100 =item B<rrdcgi>
102 This is a standalone tool for producing RRD graphs on the fly. Check
103 L<rrdcgi>.
105 =back
107 =head2 HOW DOES RRDTOOL WORK?
109 =over 8
111 =item Data Acquisition
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 log file 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.
123 =item Consolidation
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>.
139 =item Round Robin Archives
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.
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.
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.
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.
168 =item Unknown Data
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>.
183 =item Graphing
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.
191 =item Aberrant Behavior Detection
193 by Jake Brutlag
195 B<RRDtool> provides the building blocks for near real-time aberrant
196 behavior detection. These components include:
198 =over
200 =item *
202 An algorithm for predicting the value of a time series one time step
203 into the future.
205 =item *
207 A measure of deviation between predicted and observed values.
209 =item *
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).
214 =back
216 Here is a brief explanation of these components:
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.
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).
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).
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.
253 For a detailed description on how to set this up, see L<rrdcreate>.
255 =back
257 =head2 REMOTE CONTROL
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:
267 rrdtool help cd|mkdir|pwd|ls|quit
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>.
279 =head2 RRD Server
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:
284 rrdsrv 13900/tcp # RRD server
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.
290 With this configuration you can add RRDtool as meta-server to
291 I</etc/inetd.conf>. For example:
293 rrdsrv stream tcp nowait root /opt/rrd/bin/rrdtool rrdtool - /var/rrd
295 Don't forget to create the database directory /var/rrd and
296 reinitialize your inetd.
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'.
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.
305 =head1 RRDCACHED, THE CACHING DAEMON
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.
312 =head1 SEE ALSO
314 rrdcreate, rrdupdate, rrdgraph, rrddump, rrdfetch, rrdtune, rrdlast, rrdxport,
315 rrdflushcached, rrdcached
317 =head1 BUGS
319 Bugs? Features!
321 =head1 AUTHOR
323 Tobias Oetiker <tobi@oetiker.ch>