RRDTOOL(1)

๐Ÿ’… RRDTOOL(1) โ€” rrdtool, the Round Robin Database Tool ๐Ÿ’–

okay so bestie, welcome to the Round Robin Database Tool โ€” aka rrdtool โ€” and honestly it's giving main-character energy for time-series data. ๐ŸŽ€

โœจ NAME โœจ

rrdtool โ€” Round Robin Database Tool. That's the whole vibe: it logs stuff, stores stuff efficiently, and graphs stuff. Iconic. ๐Ÿ’…

๐ŸŽ€ SYNOPSIS ๐ŸŽ€

rrdtool - [workdir]| function

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

๐Ÿ’– OVERVIEW ๐Ÿ’–

So like, gathering status info from all sorts of things is pretty easy โ€” ranging from the temperature in your office to the number of octets which have passed through the FDDI interface of your router. No cap. But storing that data in an efficient and systematic manner? Not so trivial. That's exactly 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. Slay. ๐ŸŒˆ

In this man page you'll 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. Bestie, it's literally right there. ๐Ÿซถ

๐ŸŒˆ FUNCTIONS ๐ŸŒˆ

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. iykyk. ๐Ÿ

  • create โ€” Set up a new Round Robin Database (RRD). Check rrdcreate. โœจ
  • update โ€” Store new data values into an RRD. Check rrdupdate. ๐Ÿ’พ
  • updatev โ€” Operationally equivalent to update except for output. Check rrdupdate. ๐Ÿ‘€
  • graph โ€” Create a graph from data stored in one or several RRDs. Apart from generating graphs, data can also be extracted to stdout. Check rrdgraph. ๐Ÿ“ˆ
  • graphv โ€” Create a graph from data stored in one or several RRDs. Same as graph, but metadata are printed before the graph. Check rrdgraph. ๐Ÿ“Š
  • dump โ€” Dump the contents of an RRD in plain ASCII. In connection with restore you can use this to move an RRD from one computer architecture to another. Check rrddump. ๐Ÿ“ฆ
  • restore โ€” Restore an RRD in XML format to a binary RRD. Check rrdrestore. ๐Ÿงš
  • fetch โ€” Get data for a certain time period from a RRD. The graph function uses fetch to retrieve its data from an RRD. Check rrdfetch. ๐ŸŽฃ
  • tune โ€” Alter setup and structure of an RRD. Check rrdtune. ๐ŸŽ›๏ธ
  • first โ€” Find the first update time of an RRD. Check rrdfirst. โฎ๏ธ
  • last โ€” Find the last update time of an RRD. Check rrdlast. โญ๏ธ
  • lastupdate โ€” Find the last update time of an RRD. It also returns the value stored for each datum in the most recent update. Check rrdlastupdate. ๐Ÿ•
  • info โ€” Get information about an RRD. Check rrdinfo. ๐Ÿ”
  • resize โ€” Change the size of individual RRAs. This is dangerous! Check rrdresize. ๐Ÿ’€
  • xport โ€” Export data retrieved from one or several RRDs. Check rrdxport. ๐Ÿ“ค
  • flushcached โ€” Flush the values for a specific RRD file from memory. Check rrdflushcached. ๐Ÿงน
  • list โ€” List the directories and rrd databases remotely. Check rrdlist. ๐Ÿ“

๐Ÿ“ HOW DOES RRDTOOL WORK? ๐Ÿ“

๐ŸŒธ Data Acquisition ๐ŸŒธ

When monitoring the state of a system, it is convenient to have the data available at a constant time interval. Unfortunately, you may not always be able to fetch data at exactly the time you want to. Therefore RRDtool lets you update the log file at any time you want. It will automatically interpolate the value of the data-source (DS) at the latest official time-slot (interval) and write this interpolated value to the log. The original value you have supplied is stored as well and is also taken into account when interpolating the next log entry. Math girlie behavior, honestly. โœจ

๐Ÿ’œ Consolidation ๐Ÿ’œ

You may log data at a 1 minute interval, but you might also be interested to know the development of the data over the last year. You could do this by simply storing the data in 1 minute intervals for the whole year. While this would take considerable disk space it would also take a lot of time to analyze the data when you wanted to create a graph covering the whole year. RRDtool offers a solution to this problem through its data consolidation feature. When setting up a Round Robin Database (RRD), you can define at which interval this consolidation should occur, and what consolidation function (CF) (average, minimum, maximum, last) should be used to build the consolidated values (see rrdcreate). You can define any number of different consolidation setups within one RRD. They will all be maintained on the fly when new data is loaded into the RRD. Obsessed with the efficiency. ๐ŸŽ€

โญ Round Robin Archives โญ

Data values of the same consolidation setup are stored into Round Robin Archives (RRA). This is a very efficient manner to store data for a certain amount of time, while using a known and constant amount of storage space. Literally so clean. ๐ŸŒฟ

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. Time axis? More like time slay-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. ๐Ÿท

๐Ÿงš Unknown Data ๐Ÿงš

As mentioned earlier, the RRD stores data at a constant interval. Sometimes it may happen that no new data is available when a value has to be written to the RRD. Data acquisition may not be possible for one reason or other. With RRDtool you can handle these situations by storing an *UNKNOWN* value into the database. The value *UNKNOWN* is supported through all the functions of the tool. When consolidating a data set, the amount of *UNKNOWN* data values is accounted for and when a new consolidated value is ready to be written to its Round Robin Archive (RRA), a validity check is performed to make sure that the percentage of unknown values in the data point is above a configurable level. If not, an *UNKNOWN* value will be written to the RRA. Mysterious but make it functional. ๐Ÿซถ

๐Ÿ”ฅ Graphing ๐Ÿ”ฅ

RRDtool allows you to generate reports in numerical and graphical form based on the data stored in one or several RRDs. The graphing feature is fully configurable. Size, color and contents of the graph can be defined freely. Check rrdgraph for more information on this. Graph go brrr. ๐Ÿ“ˆโœจ

๐Ÿ‘‘ Aberrant Behavior Detection ๐Ÿ‘‘

by Jake Brutlag

RRDtool provides the building blocks for near real-time aberrant behavior detection. These components include:

  • An algorithm for predicting the value of a time series one time step into the future. ๐Ÿ”ฎ
  • A measure of deviation between predicted and observed values. ๐Ÿ“
  • A mechanism to decide if and when an observed value or sequence of observed values is too deviant from the predicted value(s). ๐Ÿšจ

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. Predictive queen behavior. ๐Ÿ‘‘

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). Red flag behavior, literally detected. ๐Ÿšฉ

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. ๐Ÿ’–

๐ŸŽ€ REMOTE CONTROL ๐ŸŽ€

okay bestie, so when you start RRDtool with the command line option -, it literally just waits for input via standard input (STDIN) ๐Ÿ‘€. and this is kind of iconic because you can make it way faster by attaching RRDtool to another process โ€” MRTG is the example, iykyk โ€” through a set of pipes. over these pipes, RRDtool accepts the same arguments as on the command line plus some special commands like cd, mkdir, pwd, ls, and quit. for the full detailed help on the server commands, type:

rrdtool help cd

when a command is done, RRDtool prints the string "OK", followed by timing info in this form: u:usertime s:systemtimer:runtime. the usertime and systemtime values are running totals of seconds since RRDtool was started. runtime is the total amount of seconds RRDtool has been running. if an error happens, it prints a line like "ERROR:" Description of error instead. RRDtool will not abort unless something really serious goes down. if a workdir is specified and the UID is 0, RRDtool does a chroot to that workdir. if the UID is not 0, RRDtool only changes the current directory to workdir.


๐Ÿ›ฐ๏ธ RRD Server ๐Ÿ›ฐ๏ธ

if you wanna create a RRD-Server, you have to choose a TCP/IP Service number and add it to /etc/services, like this:

rrdsrv      13900/tcp                       # RRD server
โš ๏ธ attention bestie: TCP port 13900 isn't officially registered for rrdsrv. you can use any unused port in your services file, but the server and client system must use the same port, obviously ๐Ÿ’….

with this configuration you can add RRDtool as a 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 everything was set up correctly, you can access the server with Perl sockets, tools like netcat, or in a quick interactive test by using telnet localhost rrdsrv.

๐Ÿšจ NOTE: there is no authentication with this feature! do not set up such a port unless you are sure what you're doing. fr fr, be careful.

๐ŸŒธ ENVIRONMENT VARIABLES ๐ŸŒธ

the following environment variables may be used to change the behavior of most of the utilities.

  • RRD_LOCKING โ€” if this environment variable is set, the RRD file is locked in the given mode:
    • try โ€” fails when the file is locked by another process. this is the default.
    • block โ€” waits until the lock is released.
    • none โ€” skips locking at all. the caller has to ensure proper locking which should be compatible with "fcntl(fd, F_SETLK, ...)".

some utilities have command line options (--locking) which override this variable.


๐Ÿงš RRDCACHED, THE CACHING DAEMON ๐Ÿงš

for very big setups, updating thousands of RRD files often becomes a serious IO problem ๐Ÿ˜ญ. if you run into such problems, you might wanna take a look at rrdcached, a caching daemon for RRDtool which may help you lessen the stress on your disks. periodt. ๐Ÿ’–


๐Ÿ‘€ SEE ALSO ๐Ÿ‘€

  • rrdcreate
  • rrdupdate
  • rrdgraph
  • rrddump
  • rrdfetch
  • rrdtune
  • rrdlast
  • rrdxport
  • rrdflushcached
  • rrdcached

๐Ÿ’€ BUGS ๐Ÿ’€

Bugs? Features! ๐Ÿ˜Œโœจ


๐Ÿ‘‘ AUTHOR ๐Ÿ‘‘

Tobias Oetiker <tobi@oetiker.ch>


and that's the whole vibe check, bestie ๐Ÿซถ this lil' rewrite is serving RRDtool 1.11.0, dated 2026-10-17, straight from the RRDTOOL(1) multiverse. slay responsibly ๐Ÿ’…๐ŸŽ€

๐Ÿ“ฆ where this page comes from