RRDTOOL(1) | rrdtool | RRDTOOL(1) |
rrdtool - Round Robin Database Tool
rrdtool - [workdir]| function
It is pretty easy to gather status information from all sorts of things, ranging from the temperature in your office to the number of octets which have passed through the FDDI interface of your router. But it is not so trivial to store this data in an efficient and systematic manner. This is where RRDtool comes in handy. It lets you log and analyze the data you gather from all kinds of data-sources (DS). The data analysis part of RRDtool is based on the ability to quickly generate graphical representations of the data values collected over a definable time period.
In this man page you will find general information on the design and functionality of the Round Robin Database Tool (RRDtool). For a more detailed description of how to use the individual functions of RRDtool check the corresponding man page.
For an introduction to the usage of RRDtool make sure you consult the rrdtutorial.
While the man pages talk of command line switches you have to set in order to make RRDtool work it is important to note that RRDtool can be remotely controlled through a set of pipes. This saves a considerable amount of startup time when you plan to make RRDtool do a lot of things quickly. Check the section on "REMOTE CONTROL" further down. There is also a number of language bindings for RRDtool which allow you to use it directly from Perl, python, Tcl, PHP, etc.
It works like this: If you want to store 1'000 values in 5 minute interval, RRDtool will allocate space for 1'000 data values and a header area. In the header it will store a pointer telling which slots (value) in the storage area was last written to. New values are written to the Round Robin Archive in, you guessed it, a round robin manner. This automatically limits the history to the last 1'000 values (in our example). Because you can define several RRAs within a single RRD, you can setup another one, for storing 750 data values at a 2 hour interval, for example, and thus keep a log for the last two months at a lower resolution.
The use of RRAs guarantees that the RRD does not grow over time and that old data is automatically eliminated. By using the consolidation feature, you can still keep data for a very long time, while gradually reducing the resolution of the data along the time axis.
Using different consolidation functions (CF) allows you to store exactly the type of information that actually interests you: the maximum one minute traffic on the LAN, the minimum temperature of your wine cellar, ... etc.
RRDtool provides the building blocks for near real-time aberrant behavior detection. These components include:
Here is a brief explanation of these components:
The Holt-Winters time series forecasting algorithm is an on-line (or incremental) algorithm that adaptively predicts future observations in a time series. Its forecast is the sum of three components: a baseline (or intercept), a linear trend over time (or slope), and a seasonal coefficient (a periodic effect, such as a daily cycle). There is one seasonal coefficient for each time point in the period (cycle). After a value is observed, each of these components is updated via exponential smoothing. This means that the algorithm "learns" from past values and uses them to predict the future. The rate of adaptation is governed by 3 parameters, alpha (intercept), beta (slope), and gamma (seasonal). The prediction can also be viewed as a smoothed value for the time series.
The measure of deviation is a seasonal weighted absolute deviation. The term seasonal means deviation is measured separately for each time point in the seasonal cycle. As with Holt-Winters forecasting, deviation is predicted using the measure computed from past values (but only at that point in the seasonal cycle). After the value is observed, the algorithm learns from the observed value via exponential smoothing. Confidence bands for the observed time series are generated by scaling the sequence of predicted deviation values (we usually think of the sequence as a continuous line rather than a set of discrete points).
Aberrant behavior (a potential failure) is reported whenever the number of times the observed value violates the confidence bands meets or exceeds a specified threshold within a specified temporal window (e.g. 5 violations during the past 45 minutes with a value observed every 5 minutes).
This functionality is embedded in a set of related RRAs. In particular, a FAILURES RRA logs potential failures. With these data you could, for example, use a front-end application to RRDtool to initiate real-time alerts.
For a detailed description on how to set this up, see rrdcreate.
When you start RRDtool with the command line option '-' it waits for input via standard input (STDIN). With this feature you can improve performance by attaching RRDtool to another process (MRTG is one example) through a set of pipes. Over these pipes RRDtool accepts the same arguments as on the command line and some special commands like cd, mkdir, pwd, ls and quit. For detailed help on the server commands type:
rrdtool help cd
When a command is completed, RRDtool will print the string '"OK"', followed by timing information of the form u:usertime s:systemtime. Both values are the running totals of seconds since RRDtool was started. If an error occurs, a line of the form '"ERROR:" Description of error' will be printed instead. RRDtool will not abort, unless something really serious happens. If a workdir is specified and the UID is 0, RRDtool will do a chroot to that workdir. If the UID is not 0, RRDtool only changes the current directory to workdir.
If you want to create a RRD-Server, you must choose a TCP/IP Service number and add them to /etc/services like this:
rrdsrv 13900/tcp # RRD server
Attention: the TCP port 13900 isn't officially registered for rrdsrv. You can use any unused port in your services file, but the server and the client system must use the same port, of course.
With this configuration you can add RRDtool as meta-server to /etc/inetd.conf. For example:
rrdsrv stream tcp nowait root /opt/rrd/bin/rrdtool rrdtool - /var/rrd
Don't forget to create the database directory /var/rrd and reinitialize your inetd.
If all was setup correctly, you can access the server with Perl sockets, tools like netcat, or in a quick interactive test by using 'telnet localhost rrdsrv'.
NOTE: that there is no authentication with this feature! Do not setup such a port unless you are sure what you are doing.
For very big setups, updating thousands of RRD files often becomes a serious IO problem. If you run into such problems, you might want to take a look at rrdcached, a caching daemon for RRDtool which may help you lessen the stress on your disks.
rrdcreate, rrdupdate, rrdgraph, rrddump, rrdfetch, rrdtune, rrdlast, rrdxport, rrdflushcached, rrdcached
Bugs? Features!
Tobias Oetiker <tobi@oetiker.ch>
2023-01-31 | 1.7.2 |